|
16 | 16 |
|
17 | 17 | <!-- skip javah execution for java9+, see profile below. -->
|
18 | 18 | <javah.skip>false</javah.skip>
|
19 |
| - <cmake.download.binaries>false</cmake.download.binaries> |
20 |
| - <!-- cmake maven plugin --> |
21 |
| - <cmake.classifier>linux-x86_64</cmake.classifier> |
22 |
| - <!--FIXME "Makefiles" parameter MUST be optional see cmake-maven-project/cmake-maven-project#7 --> |
23 |
| - <cmake.generator>Unix Makefiles</cmake.generator> |
24 |
| - <!-- Additional command-line options, last prevents warnings on unused options --> |
25 |
| - <!--FIXME empty option tag throw NPE see cmake-maven-project/cmake-maven-project#24 --> |
26 |
| - <cmake.option.first>-DFIRST=empty</cmake.option.first> |
27 |
| - <cmake.option.second>-DSECOND=empty</cmake.option.second> |
28 |
| - <cmake.option.third>-DTHIRD=empty</cmake.option.third> |
29 |
| - <cmake.option.fourth>-DFOURTH=empty</cmake.option.fourth> |
30 |
| - <cmake.option.last>--no-warn-unused-cli</cmake.option.last> |
31 | 19 | <!-- native lib loader (dependency) -->
|
32 | 20 | <native.lib.directory>linux_64</native.lib.directory>
|
| 21 | + |
| 22 | + <!-- custom directories and file paths --> |
| 23 | + <cmake.generated.directory>${project.build.directory}/cmake</cmake.generated.directory> |
| 24 | + <cmake.liststxt.path>${project.basedir}/CMakeLists.txt</cmake.liststxt.path> |
| 25 | + |
| 26 | + <!-- custom cmake options --> |
| 27 | + <cmake.generate.args></cmake.generate.args> |
| 28 | + <cmake.build.args></cmake.build.args> |
| 29 | + <!-- options given in compile phase after double dashes. --> |
| 30 | + <cmake.buildtool.args></cmake.buildtool.args> |
| 31 | + |
| 32 | + <!-- dependency versions --> |
| 33 | + <dependency.nativelibloader.version>2.0.2</dependency.nativelibloader.version> |
| 34 | + |
| 35 | + <!-- plugin versions --> |
| 36 | + <plugin.antrun.version>1.8</plugin.antrun.version> |
| 37 | + <plugin.nar.version>3.6.0</plugin.nar.version> |
33 | 38 | </properties>
|
34 | 39 |
|
35 | 40 | <dependencies>
|
36 | 41 | <dependency>
|
37 | 42 | <groupId>org.scijava</groupId>
|
38 | 43 | <artifactId>native-lib-loader</artifactId>
|
39 |
| - <version>2.0.2</version> |
| 44 | + <version>${dependency.nativelibloader.version}</version> |
40 | 45 | </dependency>
|
41 | 46 | <dependency>
|
42 | 47 | <groupId>junit</groupId>
|
|
59 | 64 | <plugin>
|
60 | 65 | <groupId>com.github.maven-nar</groupId>
|
61 | 66 | <artifactId>nar-maven-plugin</artifactId>
|
62 |
| - <version>3.6.0</version> |
| 67 | + <version>${plugin.nar.version}</version> |
63 | 68 | <extensions>true</extensions>
|
64 | 69 |
|
65 | 70 | <executions>
|
|
78 | 83 |
|
79 | 84 | <!-- execute cmake -->
|
80 | 85 | <plugin>
|
81 |
| - <groupId>com.googlecode.cmake-maven-project</groupId> |
82 |
| - <artifactId>cmake-maven-plugin</artifactId> |
83 |
| - <version>3.7.2-b1</version> |
84 |
| - |
85 |
| - <configuration> |
86 |
| - <downloadBinaries>${cmake.download.binaries}</downloadBinaries> |
87 |
| - <classifier>${cmake.classifier}</classifier> |
88 |
| - </configuration> |
| 86 | + <groupId>org.apache.maven.plugins</groupId> |
| 87 | + <artifactId>maven-antrun-plugin</artifactId> |
| 88 | + <version>${plugin.antrun.version}</version> |
89 | 89 |
|
90 | 90 | <executions>
|
91 | 91 | <execution>
|
92 | 92 | <id>cmake-generate</id>
|
93 |
| - <goals> |
94 |
| - <goal>generate</goal> |
95 |
| - </goals> |
| 93 | + <goals><goal>run</goal></goals> |
| 94 | + <phase>generate-sources</phase> |
96 | 95 | <configuration>
|
97 |
| - <sourcePath>${project.basedir}</sourcePath> |
98 |
| - <targetPath>${project.build.directory}/cmake</targetPath> |
99 |
| - <!--FIXME "Makefiles" parameter MUST be optional see cmake-maven-project/cmake-maven-project#7 --> |
100 |
| - <generator>${cmake.generator}</generator> |
101 |
| - <options> |
102 |
| - <option>${cmake.option.first}</option> |
103 |
| - <option>${cmake.option.second}</option> |
104 |
| - <option>${cmake.option.third}</option> |
105 |
| - <option>${cmake.option.fourth}</option> |
106 |
| - <option>${cmake.option.last}</option> |
107 |
| - </options> |
| 96 | + <target name="cmake-generate"> |
| 97 | + <mkdir dir="${cmake.generated.directory}" /> |
| 98 | + |
| 99 | + <exec executable="cmake" dir="${cmake.generated.directory}" failonerror="true"> |
| 100 | + <arg line="${project.basedir}" /> |
| 101 | + <arg line="--no-warn-unused-cli" /> |
| 102 | + <arg line="${cmake.generate.args}" /> |
| 103 | + </exec> |
| 104 | + </target> |
108 | 105 | </configuration>
|
109 | 106 | </execution>
|
110 | 107 |
|
111 | 108 | <execution>
|
112 | 109 | <id>cmake-compile</id>
|
113 |
| - <goals> |
114 |
| - <goal>compile</goal> |
115 |
| - </goals> |
| 110 | + <goals><goal>run</goal></goals> |
| 111 | + <phase>compile</phase> |
116 | 112 | <configuration>
|
117 |
| - <projectDirectory>${project.build.directory}/cmake</projectDirectory> |
| 113 | + <target name="cmake-build"> |
| 114 | + <exec executable="cmake" dir="${project.basedir}" failonerror="true"> |
| 115 | + <arg line="--build" /> |
| 116 | + <arg line="${cmake.generated.directory}" /> |
| 117 | + <arg line="${cmake.build.args}" /> |
| 118 | + <arg line="--" /> |
| 119 | + <arg line="${cmake.buildtool.args}" /> |
| 120 | + </exec> |
| 121 | + </target> |
118 | 122 | </configuration>
|
119 | 123 | </execution>
|
120 | 124 | </executions>
|
121 | 125 | </plugin>
|
122 | 126 |
|
| 127 | + |
123 | 128 | <plugin>
|
124 | 129 | <groupId>org.apache.maven.plugins</groupId>
|
125 | 130 | <artifactId>maven-surefire-plugin</artifactId>
|
|
172 | 177 | </activation>
|
173 | 178 | <properties>
|
174 | 179 | <native.lib.directory>windows_64</native.lib.directory>
|
175 |
| - <cmake.root.dir>${env.PROGRAMFILES}/CMake</cmake.root.dir> |
176 |
| - <!--FIXME "Makefiles" parameter MUST be optional see cmake-maven-project/cmake-maven-project#7 --> |
177 | 180 | <cmake.generator>Visual Studio 14 2015</cmake.generator>
|
178 |
| - <cmake.classifier>windows-x86_64</cmake.classifier> |
179 |
| - <cmake.option.first>--config Release</cmake.option.first> |
180 |
| - <cmake.option.second>-DCMAKE_GENERATOR_PLATFORM=x64</cmake.option.second> |
181 |
| - <cmake.option.third>-DNATIVE_LIB_DIR=${native.lib.directory}</cmake.option.third> |
| 181 | + <cmake.generate.args>-G "${cmake.generator}" --config Release -DCMAKE_GENERATOR_PLATFORM=x64 -DNATIVE_LIB_DIR=${native.lib.directory}</cmake.generate.args> |
| 182 | + <cmake.build.args>${cmake.generate.args}</cmake.build.args> |
182 | 183 | </properties>
|
183 | 184 | </profile>
|
184 | 185 |
|
|
193 | 194 | </activation>
|
194 | 195 | <properties>
|
195 | 196 | <native.lib.directory>windows_32</native.lib.directory>
|
196 |
| - <cmake.root.dir>${env.PROGRAMFILES}/CMake</cmake.root.dir> |
197 |
| - <!--FIXME "Makefiles" parameter MUST be optional see cmake-maven-project/cmake-maven-project#7 --> |
198 | 197 | <cmake.generator>Visual Studio 14 2015</cmake.generator>
|
199 |
| - <cmake.classifier>windows-x86_32</cmake.classifier> |
200 |
| - <cmake.option.first>--config Release</cmake.option.first> |
201 |
| - <cmake.option.second>-DNATIVE_LIB_DIR=${native.lib.directory}</cmake.option.second> |
| 198 | + <cmake.generate.args>-G "${cmake.generator}" --config Release -DNATIVE_LIB_DIR=${native.lib.directory}</cmake.generate.args> |
| 199 | + <cmake.build.args>${cmake.generate.args}</cmake.build.args> |
202 | 200 | </properties>
|
203 | 201 | </profile>
|
204 | 202 |
|
|
207 | 205 | <id>cmake-mingw32</id>
|
208 | 206 | <properties>
|
209 | 207 | <native.lib.directory>windows_32</native.lib.directory>
|
210 |
| - <cmake.generator>Unix Makefiles</cmake.generator> |
211 |
| - <cmake.classifier>windows-x86_32</cmake.classifier> |
212 |
| - <cmake.option.first>-DCMAKE_TOOLCHAIN_FILE=toolchain/Mingw32.cmake</cmake.option.first> |
213 |
| - <cmake.option.second>-DNATIVE_LIB_DIR=${native.lib.directory}</cmake.option.second> |
214 |
| - <cmake.child.dir>bin/cmake</cmake.child.dir> |
| 208 | + <cmake.generate.args>-DCMAKE_TOOLCHAIN_FILE=toolchain/Mingw32.cmake -DNATIVE_LIB_DIR=${native.lib.directory}</cmake.generate.args> |
| 209 | + <cmake.build.args>${cmake.generate.args}</cmake.build.args> |
215 | 210 | </properties>
|
216 | 211 | </profile>
|
217 | 212 |
|
|
220 | 215 | <id>cmake-mingw64</id>
|
221 | 216 | <properties>
|
222 | 217 | <native.lib.directory>windows_64</native.lib.directory>
|
223 |
| - <cmake.generator>Unix Makefiles</cmake.generator> |
224 |
| - <cmake.classifier>windows-x86_64</cmake.classifier> |
225 |
| - <cmake.option.first>-DCMAKE_TOOLCHAIN_FILE=toolchain/Mingw64.cmake</cmake.option.first> |
226 |
| - <cmake.option.second>-DNATIVE_LIB_DIR=${native.lib.directory}</cmake.option.second> |
227 |
| - <cmake.child.dir>bin/cmake</cmake.child.dir> |
| 218 | + <cmake.generate.args>-DCMAKE_TOOLCHAIN_FILE=toolchain/Mingw64.cmake -DNATIVE_LIB_DIR=${native.lib.directory</cmake.generate.args> |
| 219 | + <cmake.build.args>${cmake.generate.args}</cmake.build.args> |
228 | 220 | </properties>
|
229 | 221 | </profile>
|
230 | 222 |
|
|
238 | 230 | </activation>
|
239 | 231 | <properties>
|
240 | 232 | <!-- final dir is: ${cmake.root.dir}/${cmake.child.dir} -->
|
241 |
| - <cmake.root.dir>/usr/local</cmake.root.dir> |
242 |
| - <cmake.classifier>mac-x86_64</cmake.classifier> |
243 | 233 | <native.lib.directory>osx_64</native.lib.directory>
|
244 |
| - <cmake.option.first>-DNATIVE_LIB_DIR=${native.lib.directory}</cmake.option.first> |
| 234 | + <cmake.generate.args>-DNATIVE_LIB_DIR=${native.lib.directory}</cmake.generate.args> |
| 235 | + <cmake.build.args>${cmake.generate.args}</cmake.build.args> |
245 | 236 | </properties>
|
246 | 237 |
|
247 | 238 | </profile>
|
|
0 commit comments