| <?xml version="1.0" encoding="UTF-8"?> |
| <!-- |
| Licensed to the Apache Software Foundation (ASF) under one |
| or more contributor license agreements. See the NOTICE file |
| distributed with this work for additional information |
| regarding copyright ownership. The ASF licenses this file |
| to you under the Apache License, Version 2.0 (the |
| "License"); you may not use this file except in compliance |
| with the License. You may obtain a copy of the License at |
| |
| http://www.apache.org/licenses/LICENSE-2.0 |
| |
| Unless required by applicable law or agreed to in writing, |
| software distributed under the License is distributed on an |
| "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY |
| KIND, either express or implied. See the License for the |
| specific language governing permissions and limitations |
| under the License. |
| --> |
| <project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
| |
| <modelVersion>4.0.0</modelVersion> |
| |
| <parent> |
| <groupId>org.apache.plc4x</groupId> |
| <artifactId>plc4x-parent</artifactId> |
| <version>0.5.0</version> |
| </parent> |
| |
| <artifactId>plc4cpp</artifactId> |
| <packaging>pom</packaging> |
| |
| <name>PLC4Cpp</name> |
| <description>Implementation of the protocol adapters for usage as C++ library.</description> |
| |
| <properties> |
| <!-- Tell Sonar where to find the c++ sources --> |
| <sonar.sources>api/src/main/cpp,drivers/proxy/src/main/cpp,drivers/s7/src/main/cpp,protocols/driver-bases/base/src/main/cpp,protocols/s7/src/main/cpp,utils/logger/src/main/cpp,utils/systemconfig/src/main/cpp</sonar.sources> |
| <option.with-proxies>OFF</option.with-proxies> |
| </properties> |
| |
| <!-- |
| Notes: |
| - It turns out that the default version of CMake the cmake-maven-plugin uses is too |
| old to detect the recent boost version. So we need to manually download a newer version |
| and tell the plugin to use that instead. |
| - As downloading and building boost takes quite some time, we only do this, if no |
| target/lib/boost is found. |
| --> |
| |
| <profiles> |
| <!-- Profile for linux --> |
| <profile> |
| <id>os-unix</id> |
| <activation> |
| <os> |
| <family>unix</family> |
| </os> |
| </activation> |
| <!-- Make the cmake executable executable --> |
| <build> |
| <plugins> |
| <plugin> |
| <groupId>org.codehaus.mojo</groupId> |
| <artifactId>exec-maven-plugin</artifactId> |
| <version>1.6.0</version> |
| <executions> |
| <execution> |
| <id>make-cmake-executable</id> |
| <phase>process-sources</phase> |
| <goals> |
| <goal>exec</goal> |
| </goals> |
| <configuration> |
| <basedir>${cmake.root-dir}</basedir> |
| <executable>chmod</executable> |
| <arguments> |
| <argument>+x</argument> |
| <argument>${cmake.child-dir}</argument> |
| </arguments> |
| </configuration> |
| </execution> |
| </executions> |
| </plugin> |
| </plugins> |
| </build> |
| </profile> |
| <!-- Profile for mac --> |
| <profile> |
| <id>os-mac</id> |
| <activation> |
| <os> |
| <family>mac</family> |
| </os> |
| </activation> |
| <!-- Make the cmake executable executable --> |
| <build> |
| <plugins> |
| <plugin> |
| <groupId>org.codehaus.mojo</groupId> |
| <artifactId>exec-maven-plugin</artifactId> |
| <version>1.6.0</version> |
| <executions> |
| <execution> |
| <id>make-cmake-executable</id> |
| <phase>process-sources</phase> |
| <goals> |
| <goal>exec</goal> |
| </goals> |
| <configuration> |
| <basedir>${cmake.root-dir}</basedir> |
| <executable>chmod</executable> |
| <arguments> |
| <argument>+x</argument> |
| <argument>${cmake.child-dir}</argument> |
| </arguments> |
| </configuration> |
| </execution> |
| </executions> |
| </plugin> |
| </plugins> |
| </build> |
| </profile> |
| <profile> |
| <id>with-proxies</id> |
| <properties> |
| <!-- Disabled for now as the thrift code seems to have issues with boost 1.70 --> |
| <!--option.with-proxies>ON</option.with-proxies--> |
| </properties> |
| <build> |
| <plugins> |
| <plugin> |
| <groupId>org.apache.maven.plugins</groupId> |
| <artifactId>maven-dependency-plugin</artifactId> |
| <executions> |
| <execution> |
| <id>get-boost</id> |
| <phase>generate-sources</phase> |
| <goals> |
| <goal>unpack</goal> |
| </goals> |
| <configuration> |
| <artifactItems combine.children="append"> |
| <!-- Get the pre-packaged boost library --> |
| <artifactItem> |
| <groupId>org.apache.plc4x</groupId> |
| <artifactId>plc4x-tools-thrift</artifactId> |
| <version>${project.version}</version> |
| <type>zip</type> |
| <classifier>cpp-${os.classifier}</classifier> |
| <outputDirectory>${project.build.directory}/lib/thrift</outputDirectory> |
| </artifactItem> |
| </artifactItems> |
| </configuration> |
| </execution> |
| </executions> |
| </plugin> |
| </plugins> |
| </build> |
| </profile> |
| </profiles> |
| |
| <build> |
| <plugins> |
| <!-- First download the cmake binaries --> |
| <plugin> |
| <groupId>com.googlecode.maven-download-plugin</groupId> |
| <artifactId>download-maven-plugin</artifactId> |
| <version>1.4.0</version> |
| <executions> |
| <execution> |
| <id>get-cmake</id> |
| <phase>generate-sources</phase> |
| <goals> |
| <goal>wget</goal> |
| </goals> |
| <configuration> |
| <url>${cmake.url}</url> |
| <unpack>true</unpack> |
| <outputDirectory>${project.build.directory}</outputDirectory> |
| </configuration> |
| </execution> |
| </executions> |
| </plugin> |
| |
| <!-- |
| Get additional stuff we need for the build. |
| --> |
| <plugin> |
| <groupId>org.apache.maven.plugins</groupId> |
| <artifactId>maven-dependency-plugin</artifactId> |
| <executions> |
| <execution> |
| <id>get-boost</id> |
| <phase>generate-sources</phase> |
| <goals> |
| <goal>unpack</goal> |
| </goals> |
| <configuration> |
| <artifactItems> |
| <!-- Get the pre-packaged boost library --> |
| <artifactItem> |
| <groupId>org.apache.plc4x</groupId> |
| <artifactId>plc4x-tools-boost</artifactId> |
| <version>${project.version}</version> |
| <type>zip</type> |
| <classifier>lib-${os.classifier}</classifier> |
| <outputDirectory>${project.build.directory}/lib/boost</outputDirectory> |
| </artifactItem> |
| <!-- Unpack the protocol spec for the proxy driver --> |
| <artifactItem> |
| <groupId>org.apache.plc4x</groupId> |
| <artifactId>plc4x-protocols-proxy</artifactId> |
| <version>${project.version}</version> |
| <type>jar</type> |
| <overWrite>true</overWrite> |
| <outputDirectory>${project.build.directory}/protocol-spec</outputDirectory> |
| </artifactItem> |
| <!-- Unpack the thrift compiler --> |
| <artifactItem> |
| <groupId>org.apache.plc4x</groupId> |
| <artifactId>plc4x-tools-thrift</artifactId> |
| <version>${project.version}</version> |
| <type>zip</type> |
| <classifier>compiler-${os.classifier}</classifier> |
| <overWrite>true</overWrite> |
| <outputDirectory>${project.build.directory}/thrift-compiler</outputDirectory> |
| <destFileName>${thrift.compiler.executable}</destFileName> |
| </artifactItem> |
| </artifactItems> |
| </configuration> |
| </execution> |
| </executions> |
| </plugin> |
| <!-- |
| Generate the code for the Thrift-based interop server |
| --> |
| <plugin> |
| <groupId>org.apache.thrift.tools</groupId> |
| <artifactId>maven-thrift-plugin</artifactId> |
| <version>0.1.11</version> |
| <configuration> |
| <thriftExecutable>${project.build.directory}/thrift-compiler/${thrift.compiler.executable}</thriftExecutable> |
| <thriftSourceRoot>${project.build.directory}/protocol-spec</thriftSourceRoot> |
| <includes> |
| <include>**/interop.thrift</include> |
| </includes> |
| <generator>cpp</generator> |
| <outputDirectory>${project.build.directory}/generated-sources/drivers/proxy</outputDirectory> |
| </configuration> |
| <executions> |
| <execution> |
| <id>thrift-sources</id> |
| <phase>process-sources</phase> |
| <goals> |
| <goal>compile</goal> |
| </goals> |
| </execution> |
| </executions> |
| </plugin> |
| <!-- |
| Do the actual build. |
| --> |
| <plugin> |
| <groupId>com.googlecode.cmake-maven-project</groupId> |
| <artifactId>cmake-maven-plugin</artifactId> |
| <version>3.7.2-b1</version> |
| <executions> |
| <!-- Uses a CMake generator to generate the build using the build tool of choice --> |
| <execution> |
| <id>cmake-generate</id> |
| <phase>compile</phase> |
| <goals> |
| <goal>generate</goal> |
| </goals> |
| <configuration> |
| <!-- |
| We need to use a newer version of cmake, so disable downloading |
| and tell the plugin where to find that version. |
| --> |
| <downloadBinaries>false</downloadBinaries> |
| <cmakeRootDir>${cmake.root-dir}</cmakeRootDir> |
| <cmakeChildDir>${cmake.child-dir}</cmakeChildDir> |
| <!-- |
| Actually the path to the CMakeList.txt file which then again |
| tells to tool where to find the sources. |
| --> |
| <sourcePath>${project.basedir}</sourcePath> |
| <!-- |
| Path to where the build configuration is generated |
| (This directory is then used in the compile step to actually perform the build) |
| --> |
| <targetPath>${project.build.directory}/build</targetPath> |
| <!-- |
| Name of the generator the compile step will be executing. |
| --> |
| <generator>${cmake.generator}</generator> |
| <!-- |
| The classifier of the current platform. One of |
| [windows-x86_32, windows-x86_64, linux-x86_32, linux-x86_64, linux-arm_32, mac-x86_64]. |
| It defines the version and type of the cmake installation to download. |
| --> |
| <classifier>${os.classifier}</classifier> |
| <options> |
| <option>-DWITH_PROXIES:BOOL=${option.with-proxies}</option> |
| </options> |
| </configuration> |
| </execution> |
| <!-- Actually executes the build --> |
| <execution> |
| <id>cmake-compile</id> |
| <phase>compile</phase> |
| <goals> |
| <goal>compile</goal> |
| </goals> |
| <configuration> |
| <!-- |
| We need to use a newer version of cmake, so disable downloading |
| and tell the plugin where to find that version. |
| --> |
| <downloadBinaries>false</downloadBinaries> |
| <cmakeRootDir>${cmake.root-dir}</cmakeRootDir> |
| <cmakeChildDir>${cmake.child-dir}</cmakeChildDir> |
| <!-- The directory where the "generate" step generated the build configuration --> |
| <projectDirectory>${project.build.directory}/build</projectDirectory> |
| <classifier>${os.classifier}</classifier> |
| </configuration> |
| </execution> |
| </executions> |
| </plugin> |
| </plugins> |
| </build> |
| |
| <!-- This dependency is just to ensure boost is built first --> |
| <dependencies> |
| <dependency> |
| <groupId>org.apache.plc4x</groupId> |
| <artifactId>plc4x-tools-boost</artifactId> |
| <version>0.5.0</version> |
| <type>pom</type> |
| <scope>provided</scope> |
| </dependency> |
| </dependencies> |
| |
| </project> |