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/plc4x-extras.git
The following commit(s) were added to refs/heads/develop by this push: new 97640ce feat: Git the C build working again. 97640ce is described below commit 97640cef4edd49252df91ba21b0c167c15eee807 Author: Christofer Dutz <cd...@apache.org> AuthorDate: Fri Apr 19 14:08:32 2024 +0200 feat: Git the C build working again. --- .gitignore | 3 ++ plc4c/CMakeLists.txt | 89 +++++++++++++++++++++++++++++++++++++++++++++++++++ plc4c/pom.xml | 90 +++++++++++----------------------------------------- pom.xml | 2 +- 4 files changed, 112 insertions(+), 72 deletions(-) diff --git a/.gitignore b/.gitignore index 744e95a..9b01b06 100644 --- a/.gitignore +++ b/.gitignore @@ -4,3 +4,6 @@ target # Develocity .mvn/.gradle-enterprise/ /plc4j/tools/ui/application/derby.log + +# Source bundle from PLC4C +/plc4c/plc4c/ diff --git a/plc4c/CMakeLists.txt b/plc4c/CMakeLists.txt new file mode 100644 index 0000000..9e7be51 --- /dev/null +++ b/plc4c/CMakeLists.txt @@ -0,0 +1,89 @@ +#[[ + 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 + + https://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.20) + +# Set the name of this project +project(PLC4C) + +# Set the C language level to C11 +set(CMAKE_C_STANDARD 11) + +# Save the root directory +set(PLC4C_ROOT_DIR ${CMAKE_SOURCE_DIR}) + +# Our link to the maven lifecycle +set(BUILD_PHASE test-compile CACHE STRING "Phase of the Maven build we are executing cmake") + +# Access the Unity version the maven build is providing us with. +set(UNITY_VERSION 2.5.2 CACHE STRING "Version of the used Unity test framework") + +# MinGW GCC versions above 4.7 on Windows include inline definitions of these functions +# If you run into problems, please read this article: https://stackoverflow.com/questions/27853225/is-there-a-way-to-include-stdio-h-but-ignore-some-of-the-functions-therein +# These are the constants needed to activate all patches. +add_compile_definitions(NO_INLINE_VFSCANF=1) +add_compile_definitions(NO_INLINE_VSSCANF=1) +add_compile_definitions(NO_INLINE_VSCANF=1) +add_compile_definitions(NO_INLINE_VSNPRINTF=1) +add_compile_definitions(NO_INLINE_SNPRINTF=1) +add_compile_definitions(NO_INLINE_VFWSCANF=1) +add_compile_definitions(NO_INLINE_VSWSCANF=1) +add_compile_definitions(NO_INLINE_VWSCANF=1) +add_compile_definitions(NO_INLINE_SNWPRINTF=1) +add_compile_definitions(NO_INLINE_VSNWPRINTF=1) +add_compile_definitions(NO_INLINE_VSWPRINTF=1) +add_compile_definitions(NO_INLINE_SWPRINTF=1) + +# Depending on the phase of the build we are currently running, initialize +# The test system. +if (BUILD_PHASE STREQUAL compile) + # Nothing really to do here ... just need it to check the known values. +elseif (BUILD_PHASE STREQUAL test-compile) + # Initialize the test subsystem as well as the Unity library sources + include(CTest) + + # Add the Unity sources to the build + add_subdirectory(target/dependency/Unity-${UNITY_VERSION}) +else () + # Output an error + message(FATAL_ERROR "Given BUILD_PHASE unknown. Known values are 'compile' and 'test-compile'") +endif () + +set(DEBUG_OUTPUT ON CACHE BOOL "Enable outputting of debug information") +if (DEBUG_OUTPUT) + # Trace all CMAKE Variables + get_cmake_property(_variableNames VARIABLES) + list(SORT _variableNames) + foreach (_variableName ${_variableNames}) + message(STATUS "${_variableName}=${${_variableName}}") + endforeach () +endif () + +#[[ + Build all the modules of PLC4C +]] +# Core stuff +add_subdirectory(target/apache-plc4x-${PLC4X_VERSION}/api out/api) +add_subdirectory(target/apache-plc4x-${PLC4X_VERSION}/spi out/spi) +add_subdirectory(target/apache-plc4x-${PLC4X_VERSION}/transports out/transports) +add_subdirectory(target/apache-plc4x-${PLC4X_VERSION}/drivers out/drivers) + +# The examples +add_subdirectory(examples) +#add_subdirectory(integrations) diff --git a/plc4c/pom.xml b/plc4c/pom.xml index 396e8e4..e74a9e2 100644 --- a/plc4c/pom.xml +++ b/plc4c/pom.xml @@ -41,6 +41,8 @@ <sonar.sources>api,drivers,examples,integrations,spi,transports</sonar.sources> <sonar.cfamily.build-wrapper-output>${project.build.directory}/build-wrapper-output</sonar.cfamily.build-wrapper-output> <option.with-proxies>OFF</option.with-proxies> + + <plc4c-source-dir>target/plc4c</plc4c-source-dir> </properties> <build> @@ -82,86 +84,21 @@ </executions> </plugin> - <!-- Transform the ParserSerializer tests into c code --> <plugin> - <groupId>org.codehaus.mojo</groupId> - <artifactId>xml-maven-plugin</artifactId> - <version>1.1.0</version> + <groupId>org.apache.maven.plugins</groupId> + <artifactId>maven-dependency-plugin</artifactId> <executions> - <!--execution> - <id>generate-modbus-tests</id> - <phase>process-resources</phase> - <goals> - <goal>transform</goal> - </goals> - <configuration> - <transformationSets> - <transformationSet> - <dir>../protocols/modbus/src/test/resources/protocols/modbus</dir> - <includes>ParserSerializerTestsuite.xml</includes> - <stylesheet>build-utils/parser-serializer-testcase-generator.xsl</stylesheet> - <outputDir>generated-sources/modbus/test</outputDir> - <fileMappers> - <fileMapper implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper"> - <targetExtension>.c</targetExtension> - </fileMapper> - </fileMappers> - </transformationSet> - </transformationSets> - </configuration> - </execution--> <execution> - <id>generate-plc4x-tests</id> - <phase>process-resources</phase> + <id>unpack-protocol-test-suites</id> + <phase>generate-resources</phase> <goals> - <goal>transform</goal> + <goal>unpack-dependencies</goal> </goals> <configuration> - <transformationSets> - <transformationSet> - <dir>../protocols/plc4x/src/test/resources/protocols/plc4x</dir> - <includes>ParserSerializerTestsuite.xml</includes> - <stylesheet>build-utils/parser-serializer-testcase-generator.xsl</stylesheet> - <outputDir>generated-sources/plc4x/test</outputDir> - <fileMappers> - <fileMapper implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper"> - <targetExtension>.c</targetExtension> - </fileMapper> - </fileMappers> - </transformationSet> - </transformationSets> - </configuration> - </execution> - <execution> - <id>generate-s7-tests</id> - <phase>process-resources</phase> - <goals> - <goal>transform</goal> - </goals> - <configuration> - <transformationSets> - <transformationSet> - <dir>../protocols/s7/src/test/resources/protocols/s7</dir> - <includes>ParserSerializerTestsuite.xml</includes> - <stylesheet>build-utils/parser-serializer-testcase-generator.xsl</stylesheet> - <outputDir>generated-sources/s7/test</outputDir> - <fileMappers> - <fileMapper implementation="org.codehaus.plexus.components.io.filemappers.FileExtensionMapper"> - <targetExtension>.c</targetExtension> - </fileMapper> - </fileMappers> - </transformationSet> - </transformationSets> + <outputDirectory>${project.build.directory}</outputDirectory> </configuration> </execution> </executions> - <dependencies> - <dependency> - <groupId>net.sf.saxon</groupId> - <artifactId>Saxon-HE</artifactId> - <version>12.4</version> - </dependency> - </dependencies> </plugin> <!-- @@ -199,6 +136,7 @@ <options> <option>-DUNITY_VERSION:STRING=${unity.version}</option> <option>-DBUILD_PHASE=test-compile</option> + <option>-DPLC4X_VERSION:STRING=${project.version}</option> </options> </configuration> </execution> @@ -271,4 +209,14 @@ </pluginManagement> </build> + <dependencies> + <dependency> + <groupId>org.apache.plc4x</groupId> + <artifactId>plc4c</artifactId> + <version>${plc4x.version}</version> + <type>zip</type> + <classifier>sources</classifier> + </dependency> + </dependencies> + </project> \ No newline at end of file diff --git a/pom.xml b/pom.xml index 5faa957..46cbd08 100644 --- a/pom.xml +++ b/pom.xml @@ -88,7 +88,7 @@ <maven.build.timestamp.format>yyyy-MM-dd'T'HH:mm:ss'Z'</maven.build.timestamp.format> <project.build.outputTimestamp>2024-02-16T14:53:02Z</project.build.outputTimestamp> - <plc4x.version>0.13.0-SNAPSHOT</plc4x.version> + <plc4x.version>${project.version}</plc4x.version> </properties> <build>