This is an automated email from the ASF dual-hosted git repository. cdutz pushed a commit to branch develop in repository https://gitbox.apache.org/repos/asf/incubator-plc4x.git
The following commit(s) were added to refs/heads/develop by this push: new 3c38bb2 - Made the C++ build run faster (Boost now builds the "system" library) - Fixed a problem with the Windows build (the boost build adds an additional directory when building on windows) 3c38bb2 is described below commit 3c38bb24bae9992204fd5bc38a983f4eb3a15188 Author: Christofer Dutz <christofer.d...@c-ware.de> AuthorDate: Thu Jan 3 14:58:02 2019 +0100 - Made the C++ build run faster (Boost now builds the "system" library) - Fixed a problem with the Windows build (the boost build adds an additional directory when building on windows) --- plc4cpp/api/pom.xml | 52 ------------------ plc4cpp/api/src/main/cmake/CMakeLists.txt | 81 ++++++++++++++++++++++++++++ plc4cpp/api/src/main/cpp/CMakeLists.txt | 73 ------------------------- plc4cpp/libs/pom.xml | 2 + plc4cpp/pom.xml | 89 +++++++++++++++++++++++++++++++ 5 files changed, 172 insertions(+), 125 deletions(-) diff --git a/plc4cpp/api/pom.xml b/plc4cpp/api/pom.xml index 85fc8d3..bb719cd 100644 --- a/plc4cpp/api/pom.xml +++ b/plc4cpp/api/pom.xml @@ -35,58 +35,6 @@ <build> <!-- This is probably not required, however it helps IntelliJ detect the files as sources --> <sourceDirectory>${project.basedir}/src/main/cpp</sourceDirectory> - <plugins> - <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>process-sources</phase> - <goals> - <goal>generate</goal> - </goals> - <configuration> - <!-- - Actually the path to the CMakeList.txt file which then again - tells to tool where to find the sources. - --> - <sourcePath>${project.basedir}/src/main/cpp</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}/make</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> - </configuration> - </execution> - <!-- Actually executes the build --> - <execution> - <id>cmake-compile</id> - <phase>compile</phase> - <goals> - <goal>compile</goal> - </goals> - <configuration> - <!-- The directory where the "generate" step generated the build configuration --> - <projectDirectory>${project.build.directory}/make</projectDirectory> - <classifier>${os.classifier}</classifier> - </configuration> - </execution> - </executions> - </plugin> - </plugins> </build> <dependencies> diff --git a/plc4cpp/api/src/main/cmake/CMakeLists.txt b/plc4cpp/api/src/main/cmake/CMakeLists.txt new file mode 100644 index 0000000..0d09718 --- /dev/null +++ b/plc4cpp/api/src/main/cmake/CMakeLists.txt @@ -0,0 +1,81 @@ +#[[ + 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. +]] + +cmake_minimum_required(VERSION 3.7) +set(CMAKE_CXX_STANDARD 11) +set(CMAKE_CXX_STANDARD_REQUIRED ON) +set(CMAKE_CXX_EXTENSIONS OFF) + +add_library(api ../../src/main/cpp/org/apache/plc4x/cpp/api/PlcConnection.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/authentication/PlcAuthentication.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/authentication/PlcUsernamePasswordAuthentication.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcConnectionException.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcException.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcFieldRangeException.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcIncompatibleDatatypeException.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcInvalidFieldException.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcIoException.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcNotImplementedException.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcProtocolException.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcProtocolPayloadTooBigException.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcRuntimeException.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcTimeoutException.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcUnsupportedDataTypeException.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/exceptions/PlcUnsupportedOperationException.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcFieldRequest.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcFieldResponse.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcMessage.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequest.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadRequestBuilder.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcReadResponse.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcRequest.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcRequestBuilder.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcResponse.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcSubscriptionEvent.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcSubscriptionRequest.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcSubscriptionResponse.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcUnsubscriptionRequest.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcUnsubscriptionResponse.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcWriteRequest.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/messages/PlcWriteResponse.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/messages/REQUEST.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/messages/RequestTemplate.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/messages/RESPONSE.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/messages/ResponseTemplate.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/metadata/PlcConnectionMetadata.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/model/Consumer.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/model/PlcConsumerRegistration.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/model/PlcField.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/model/PlcSubscriptionHandle.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/types/PlcClientDataType.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/types/PlcResponseCode.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/types/PlcSubscriptionType.cpp + ../../src/main/cpp/org/apache/plc4x/cpp/api/types/ValueTypeObject.cpp + ) + +#[[ + Import for non-windows systems +]] +target_include_directories (api PUBLIC ../../../libs/libs/boost/include) + +#[[ + Import for windows systems +]] +target_include_directories (api PUBLIC ../../../libs/libs/boost/include/boost-${boost.version.underline-short}) + diff --git a/plc4cpp/api/src/main/cpp/CMakeLists.txt b/plc4cpp/api/src/main/cpp/CMakeLists.txt deleted file mode 100644 index b9818d2..0000000 --- a/plc4cpp/api/src/main/cpp/CMakeLists.txt +++ /dev/null @@ -1,73 +0,0 @@ -#[[ - 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. -]] - -cmake_minimum_required(VERSION 3.7) -set(CMAKE_CXX_STANDARD 11) -set(CMAKE_CXX_STANDARD_REQUIRED ON) -set(CMAKE_CXX_EXTENSIONS OFF) - -add_library(api org/apache/plc4x/cpp/api/PlcConnection.cpp - org/apache/plc4x/cpp/api/authentication/PlcAuthentication.cpp - org/apache/plc4x/cpp/api/authentication/PlcUsernamePasswordAuthentication.cpp - org/apache/plc4x/cpp/api/exceptions/PlcConnectionException.cpp - org/apache/plc4x/cpp/api/exceptions/PlcException.cpp - org/apache/plc4x/cpp/api/exceptions/PlcFieldRangeException.cpp - org/apache/plc4x/cpp/api/exceptions/PlcIncompatibleDatatypeException.cpp - org/apache/plc4x/cpp/api/exceptions/PlcInvalidFieldException.cpp - org/apache/plc4x/cpp/api/exceptions/PlcIoException.cpp - org/apache/plc4x/cpp/api/exceptions/PlcNotImplementedException.cpp - org/apache/plc4x/cpp/api/exceptions/PlcProtocolException.cpp - org/apache/plc4x/cpp/api/exceptions/PlcProtocolPayloadTooBigException.cpp - org/apache/plc4x/cpp/api/exceptions/PlcRuntimeException.cpp - org/apache/plc4x/cpp/api/exceptions/PlcTimeoutException.cpp - org/apache/plc4x/cpp/api/exceptions/PlcUnsupportedDataTypeException.cpp - org/apache/plc4x/cpp/api/exceptions/PlcUnsupportedOperationException.cpp - org/apache/plc4x/cpp/api/messages/PlcFieldRequest.cpp - org/apache/plc4x/cpp/api/messages/PlcFieldResponse.cpp - org/apache/plc4x/cpp/api/messages/PlcMessage.cpp - org/apache/plc4x/cpp/api/messages/PlcReadRequest.cpp - org/apache/plc4x/cpp/api/messages/PlcReadRequestBuilder.cpp - org/apache/plc4x/cpp/api/messages/PlcReadResponse.cpp - org/apache/plc4x/cpp/api/messages/PlcRequest.cpp - org/apache/plc4x/cpp/api/messages/PlcRequestBuilder.cpp - org/apache/plc4x/cpp/api/messages/PlcResponse.cpp - org/apache/plc4x/cpp/api/messages/PlcSubscriptionEvent.cpp - org/apache/plc4x/cpp/api/messages/PlcSubscriptionRequest.cpp - org/apache/plc4x/cpp/api/messages/PlcSubscriptionResponse.cpp - org/apache/plc4x/cpp/api/messages/PlcUnsubscriptionRequest.cpp - org/apache/plc4x/cpp/api/messages/PlcUnsubscriptionResponse.cpp - org/apache/plc4x/cpp/api/messages/PlcWriteRequest.cpp - org/apache/plc4x/cpp/api/messages/PlcWriteResponse.cpp - org/apache/plc4x/cpp/api/messages/REQUEST.cpp - org/apache/plc4x/cpp/api/messages/RequestTemplate.cpp - org/apache/plc4x/cpp/api/messages/RESPONSE.cpp - org/apache/plc4x/cpp/api/messages/ResponseTemplate.cpp - org/apache/plc4x/cpp/api/metadata/PlcConnectionMetadata.cpp - org/apache/plc4x/cpp/api/model/Consumer.cpp - org/apache/plc4x/cpp/api/model/PlcConsumerRegistration.cpp - org/apache/plc4x/cpp/api/model/PlcField.cpp - org/apache/plc4x/cpp/api/model/PlcSubscriptionHandle.cpp - org/apache/plc4x/cpp/api/types/PlcClientDataType.cpp - org/apache/plc4x/cpp/api/types/PlcResponseCode.cpp - org/apache/plc4x/cpp/api/types/PlcSubscriptionType.cpp - org/apache/plc4x/cpp/api/types/ValueTypeObject.cpp - ) - -target_include_directories (api PUBLIC ../../../../libs/libs/boost/include) - diff --git a/plc4cpp/libs/pom.xml b/plc4cpp/libs/pom.xml index 4943b63..5c8a8b0 100644 --- a/plc4cpp/libs/pom.xml +++ b/plc4cpp/libs/pom.xml @@ -134,6 +134,8 @@ <argument>install</argument> <!-- Tell it where to install the libraries and header files --> <argument>--prefix=${project.basedir}/libs/boost</argument> + <!-- Build only the system module (speeds up build-time drastically) --> + <argument>--with-system</argument> <!-- On Windows machines the build failed, if this was not explicitly set --> <argument>address-model=64</argument> </arguments> diff --git a/plc4cpp/pom.xml b/plc4cpp/pom.xml index 38506d0..abc53a8 100644 --- a/plc4cpp/pom.xml +++ b/plc4cpp/pom.xml @@ -36,6 +36,7 @@ <properties> <boost.version>1.69.0</boost.version> <boost.version.underline>1_69_0</boost.version.underline> + <boost.version.underline-short>1_69</boost.version.underline-short> <boost.working-directory>${project.build.directory}/libs/boost_${boost.version.underline}</boost.working-directory> </properties> @@ -125,6 +126,94 @@ <boost.build.executable>${boost.working-directory}/b2.exe</boost.build.executable> </properties> </profile> + <!-- + Profile inherited and automatically activated as soon as a directory contains a + src/main/cmake directory. + --> + <profile> + <id>cmake-module</id> + <activation> + <file> + <exists>src/main/cmake</exists> + </file> + </activation> + <build> + <plugins> + <plugin> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-resources-plugin</artifactId> + <executions> + <execution> + <id>process-cmake-files</id> + <phase>process-sources</phase> + <goals> + <goal>resources</goal> + </goals> + <configuration> + <resources> + <resource> + <directory>src/main/cmake</directory> + <filtering>true</filtering> + </resource> + </resources> + <outputDirectory>${project.build.directory}/cmake</outputDirectory> + </configuration> + </execution> + </executions> + </plugin> + <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>process-sources</phase> + <goals> + <goal>generate</goal> + </goals> + <configuration> + <!-- + Actually the path to the CMakeList.txt file which then again + tells to tool where to find the sources. + --> + <sourcePath>${project.build.directory}/cmake</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}/make</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> + </configuration> + </execution> + <!-- Actually executes the build --> + <execution> + <id>cmake-compile</id> + <phase>compile</phase> + <goals> + <goal>compile</goal> + </goals> + <configuration> + <!-- The directory where the "generate" step generated the build configuration --> + <projectDirectory>${project.build.directory}/make</projectDirectory> + <classifier>${os.classifier}</classifier> + </configuration> + </execution> + </executions> + </plugin> + </plugins> + </build> + </profile> </profiles> </project> \ No newline at end of file