You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@plc4x.apache.org by cd...@apache.org on 2019/07/11 07:20:48 UTC

[plc4x] branch develop updated: - Make the cmake-maven-plugin use a manually downloaded and newer version of CMake to avoid problems with the thrift build.

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.git


The following commit(s) were added to refs/heads/develop by this push:
     new 9ba4032  - Make the cmake-maven-plugin use a manually downloaded and newer version of CMake to avoid problems with the thrift build.
9ba4032 is described below

commit 9ba40327584919cb4ab900f8d007ce3e0b7b521f
Author: Christofer Dutz <ch...@c-ware.de>
AuthorDate: Thu Jul 11 09:20:42 2019 +0200

    - Make the cmake-maven-plugin use a manually downloaded and newer version of CMake to avoid problems with the thrift build.
---
 pom.xml              |  10 +++
 tools/thrift/pom.xml | 229 +++++++++++++++++++++++++++++++++++++--------------
 2 files changed, 176 insertions(+), 63 deletions(-)

diff --git a/pom.xml b/pom.xml
index fe731af..52e54ef 100644
--- a/pom.xml
+++ b/pom.xml
@@ -113,6 +113,7 @@
     <boost.version.underline-short>1_70</boost.version.underline-short>
     <boost.version.underline>${boost.version.underline-short}_0</boost.version.underline>
     <byte-buddy.version>1.9.10</byte-buddy.version>
+    <cmake-version>3.14.5</cmake-version>
     <commons-codec.version>1.12</commons-codec.version>
     <commons-collections4.version>4.1</commons-collections4.version>
     <commons-configuration2.version>2.2</commons-configuration2.version>
@@ -1479,6 +1480,9 @@
       <properties>
         <os.suffix>linux</os.suffix>
         <os.classifier>linux-x86_64</os.classifier>
+        <cmake.url>https://github.com/Kitware/CMake/releases/download/v${cmake-version}/cmake-${cmake-version}-Linux-x86_64.tar.gz</cmake.url>
+        <cmake.root-dir>${project.build.directory}/cmake-${cmake-version}-Linux-x86_64</cmake.root-dir>
+        <cmake.child-dir>bin/cmake</cmake.child-dir>
         <cmake.generator>Unix Makefiles</cmake.generator>
         <boost.url>https://dl.bintray.com/boostorg/release/${boost.version}/source/boost_${boost.version.underline}.tar.gz</boost.url>
         <boost.bootstrap.executable>./bootstrap.sh</boost.bootstrap.executable>
@@ -1500,6 +1504,9 @@
       <properties>
         <os.suffix>mac</os.suffix>
         <os.classifier>mac-x86_64</os.classifier>
+        <cmake.url>https://github.com/Kitware/CMake/releases/download/v${cmake-version}/cmake-${cmake-version}-Darwin-x86_64.tar.gz</cmake.url>
+        <cmake.root-dir>${project.build.directory}/cmake-${cmake-version}-Darwin-x86_64</cmake.root-dir>
+        <cmake.child-dir>CMake.app/Contents/BIN/cmake</cmake.child-dir>
         <cmake.generator>Unix Makefiles</cmake.generator>
         <boost.url>https://dl.bintray.com/boostorg/release/${boost.version}/source/boost_${boost.version.underline}.tar.gz</boost.url>
         <boost.bootstrap.executable>./bootstrap.sh</boost.bootstrap.executable>
@@ -1521,6 +1528,9 @@
       <properties>
         <os.suffix>win</os.suffix>
         <os.classifier>windows-x86_64</os.classifier>
+        <cmake.url>https://github.com/Kitware/CMake/releases/download/v${cmake-version}/cmake-${cmake-version}-win64-x64.zip</cmake.url>
+        <cmake.root-dir>${project.build.directory}/cmake-${cmake-version}-win64-x64</cmake.root-dir>
+        <cmake.child-dir>bin/cmake.exe</cmake.child-dir>
         <cmake.generator>MinGW Makefiles</cmake.generator>
         <boost.url>https://dl.bintray.com/boostorg/release/${boost.version}/source/boost_${boost.version.underline}.zip</boost.url>
         <boost.bootstrap.executable>bootstrap.bat</boost.bootstrap.executable>
diff --git a/tools/thrift/pom.xml b/tools/thrift/pom.xml
index 06efc3c..08df62f 100644
--- a/tools/thrift/pom.xml
+++ b/tools/thrift/pom.xml
@@ -38,14 +38,162 @@
     <thrift.with.python>OFF</thrift.with.python>
   </properties>
 
+  <profiles>
+    <!-- Profile for linux -->
+    <profile>
+      <id>os-unix</id>
+      <activation>
+        <os>
+          <family>unix</family>
+        </os>
+      </activation>
+      <!-- Make the cmake executable executable (Seems not to be per default) -->
+      <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 (Seems not to be per default) -->
+      <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>
+    <!-- If C++ is enabled, we need to add another assembly to the build to package the libraries -->
+    <profile>
+      <id>with-cpp</id>
+      <properties>
+        <thrift.with.cpp>ON</thrift.with.cpp>
+      </properties>
+      <build>
+        <plugins>
+          <plugin>
+            <artifactId>maven-assembly-plugin</artifactId>
+            <version>3.1.1</version>
+            <executions>
+              <execution>
+                <id>package-thrift-cpp</id>
+                <phase>package</phase>
+                <goals>
+                  <goal>single</goal>
+                </goals>
+                <configuration>
+                  <finalName>${project.artifactId}-${project.version}</finalName>
+                  <descriptors>
+                    <descriptor>src/assembly/cpp.xml</descriptor>
+                  </descriptors>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+    <!-- If Python is enabled, we need to add another assembly to the build to package the libraries -->
+    <profile>
+      <id>with-python</id>
+      <properties>
+        <thrift.with.python>ON</thrift.with.python>
+      </properties>
+      <build>
+        <plugins>
+          <plugin>
+            <artifactId>maven-assembly-plugin</artifactId>
+            <version>3.1.1</version>
+            <executions>
+              <execution>
+                <id>package-thrift-python</id>
+                <phase>package</phase>
+                <goals>
+                  <goal>single</goal>
+                </goals>
+                <configuration>
+                  <finalName>${project.artifactId}-${project.version}</finalName>
+                  <descriptors>
+                    <descriptor>src/assembly/python.xml</descriptor>
+                  </descriptors>
+                </configuration>
+              </execution>
+            </executions>
+          </plugin>
+        </plugins>
+      </build>
+    </profile>
+  </profiles>
+
   <build>
     <plugins>
-      <!-- First download the sources for building the thrift compiler -->
       <plugin>
         <groupId>com.googlecode.maven-download-plugin</groupId>
         <artifactId>download-maven-plugin</artifactId>
         <version>1.4.0</version>
         <executions>
+          <!-- Download the CMake binary distribution for this platform. -->
+          <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>
+          <!-- Download the sources for building the thrift compiler -->
           <execution>
             <id>get-thrift</id>
             <phase>generate-sources</phase>
@@ -74,6 +222,14 @@
               <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>
+
               <sourcePath>${project.build.directory}/thrift-${thrift.version}</sourcePath>
               <targetPath>${project.build.directory}/build</targetPath>
               <generator>${cmake.generator}</generator>
@@ -92,6 +248,7 @@
                 <option>-DBUILD_JAVA=OFF</option>
                 <option>-DBUILD_PYTHON=${thrift.with.python}</option>
                 <option>-DBUILD_HASKELL=OFF</option>
+                <option>--debug</option>
               </options>
             </configuration>
           </execution>
@@ -103,6 +260,14 @@
               <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>
@@ -140,66 +305,4 @@
     </plugins>
   </build>
 
-  <profiles>
-    <profile>
-      <id>with-cpp</id>
-      <properties>
-        <thrift.with.cpp>ON</thrift.with.cpp>
-      </properties>
-      <build>
-        <plugins>
-          <plugin>
-            <artifactId>maven-assembly-plugin</artifactId>
-            <version>3.1.1</version>
-            <executions>
-              <execution>
-                <id>package-thrift-cpp</id>
-                <phase>package</phase>
-                <goals>
-                  <goal>single</goal>
-                </goals>
-                <configuration>
-                  <finalName>${project.artifactId}-${project.version}</finalName>
-                  <descriptors>
-                    <descriptor>src/assembly/cpp.xml</descriptor>
-                  </descriptors>
-                </configuration>
-              </execution>
-            </executions>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
-
-    <profile>
-      <id>with-python</id>
-      <properties>
-        <thrift.with.python>ON</thrift.with.python>
-      </properties>
-      <build>
-        <plugins>
-          <plugin>
-            <artifactId>maven-assembly-plugin</artifactId>
-            <version>3.1.1</version>
-            <executions>
-              <execution>
-                <id>package-thrift-python</id>
-                <phase>package</phase>
-                <goals>
-                  <goal>single</goal>
-                </goals>
-                <configuration>
-                  <finalName>${project.artifactId}-${project.version}</finalName>
-                  <descriptors>
-                    <descriptor>src/assembly/python.xml</descriptor>
-                  </descriptors>
-                </configuration>
-              </execution>
-            </executions>
-          </plugin>
-        </plugins>
-      </build>
-    </profile>
-  </profiles>
-
 </project>
\ No newline at end of file