-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathbuild-cpp-internal.xml
205 lines (170 loc) · 7.69 KB
/
build-cpp-internal.xml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
<?xml version="1.0" encoding="UTF-8"?>
<project name="CoreCpp" default="compile">
<description>JavaProjects core build file</description>
<taskdef name="cmake"
classname="org.iainhull.ant.CmakeBuilder">
<classpath>
<pathelement location="${ant.file.JavaProjects}/../cmakeant.jar"/>
</classpath>
</taskdef>
<!-- settings for "jar" -->
<property name="manifest.file" value="manifest.mf"/>
<target name="-createmanifest" description="Creates an initial version of the manifest file" unless="${manifest.file.present}">
<tstamp>
<format property="MANIFEST_TIME" pattern="MMMM dd yyyy hh:mm aa" locale="en" />
</tstamp>
<property name="organisation" value=""/>
<echo file="${manifest.file}">Manifest-Version: 1.0
Main-Class: main
Name: ${ant.project.name}
Specification-Title: ${ant.project.name}
Specification-Version: 0.1
Specification-Vendor: ${organisation}
Implementation-Title: ${ant.project.name}
Implementation-Version: ${MANIFEST_TIME}
Implementation-Vendor: ${organisation}</echo>
</target>
<property name="cmake.base.dir" value="." />
<property name="src.dir" value="src" />
<property name="resource.dir" value="resource" />
<property name="lib.dir" value="lib" />
<property name="lib.local.dir" value="lib.local" />
<property name="build.dir" value="build" />
<property name="deps.dir" value="deps" />
<property name="dist.dir" value="dist" />
<property name="dist.dir.absolute" value="dist" />
<property name="dist.cpp.dir" value="${dist.dir}"/>
<property name="zip.tmp.dir" value="zip_root.tmp" />
<property name="dist.excludes" value="" />
<property name="test.cmake.base.dir" value="test" />
<property name="test.src.dir" value="test/src" />
<property name="test.build.dir" value="test/build" />
<!--property name="cmake.install.prefix" value="" / -->
<!-- Read build properties. Redundant when called from HmiShared/ant/build.xml, but needed for standalone versions -->
<property name="properties.file" value="build.properties"/>
<property file="${properties.file}" />
<available file="${properties.file}" property="properties.file.available" />
<property name="private.properties.dir" value="privateprops" />
<!-- The module.name is used for javadoc, jar files etec. -->
<!-- module.name can be set explicitly, but else we use ant.project.name as module name. -->
<!-- Note that ant.project.name is the name set by the top-most build file, so usually not the name of this build file -->
<property name="module.name" value="${ant.project.name}"/>
<!-- Names of main project directories -->
<property name="src.dir" value="src" />
<available file="${src.dir}" property="src.dir.present"/> <!-- requires (?) ant 1.8 -->
<target name="-help" description="Help for building and running projects">
<echo> -- Building/Running/Testing --
ant Default target is: ${ant.project.default-target}
compile Compiles all files in the project
build clean, then compile
</echo>
</target>
<target name="clean" description="Removes the build directory">
<delete dir="${zip.tmp.dir}" failonerror="false"/>
<delete dir="${build.dir}" failonerror="false"/>
<delete dir="${deps.dir}" failonerror="false"/>
<delete dir="${test.build.dir}" failonerror="false"/>
<delete dir="${test.report.dir}" failonerror="false"/>
<echo message="cpp-internal: Info: Cleaning ${dist.dir} completely" />
<delete dir="${dist.dir}" failonerror="false"/>
</target>
<target name="-build-setup">
<mkdir dir="${build.dir}"/>
<mkdir dir="${dist.dir}"/>
</target>
<target name="-pre-compilation">
<echo message="No preparations needed for compilation."/>
<!-- Preprocessing, such as compiling protocol files. Overwrite in own build.xml -->
</target>
<target name="-compilation" depends="-build-setup, -pre-compilation">
<cmake srcdir="${cmake.base.dir}"
bindir="${build.dir}"
buildtype="Debug">
<!--variable name="CMAKE_INSTALL_PREFIX" type="FILEPATH" value="${cmake.install.prefix}" /-->
</cmake>
</target>
<target name="compile" depends="-compilation" description="Compile the sources after preprocessing"/>
<target name="build" depends="compile" description="compile"/>
<target name="-jar-prepare-tmp">
<echo message="Installing to temporary root directory ${zip.tmp.dir}."/>
<mkdir dir="${zip.tmp.dir}"/>
<mkdir dir="${dist.dir}"/>
<mkdir dir="${dist.cpp.dir}"/>
</target>
<target name="-jar-install-tmp">
<exec executable="make" dir="${build.dir}">
<arg value="install"/>
<arg value="DESTDIR=../${dist.dir}"/>
</exec>
</target>
<target name="-jar" depends="build,-jar-prepare-tmp,-jar-install-tmp" description="Installs libraries and headers to the dist dir">
</target>
<target name="-check-test-binary-set">
<condition property="test.binary.set">
<not>
<equals arg1="${test.binary}" arg2=""/>
</not>
</condition>
<condition property="test.binary.set.unix">
<and>
<os family="unix" />
<not>
<equals arg1="${test.binary}" arg2=""/>
</not>
</and>
</condition>
<condition property="test.binary.set.windows">
<and>
<os family="windows" />
<not>
<equals arg1="${test.binary}" arg2=""/>
</not>
</and>
</condition>
</target>
<target name="-write-no-test-present" unless="test.binary.set">
<echo message="Skipping cpp unit test since $${test.binary} was not set." />
</target>
<target name="build-test" if="test.binary.set" depends="jar" description="Build test cases. Requires fully-built library.">
<cmake srcdir="${test.cmake.base.dir}"
bindir="${test.build.dir}"
buildtype="Debug">
<generator name="Visual Studio 10" platform="windows" buildargs="ALL_BUILD.vcxproj">
<variable name="CMAKE_INSTALL_PREFIX" type="PATH" value="../../${dist.dir}" />
</generator>
<generator name="Unix Makefiles" />
</cmake>
</target>
<target name="-install-test-make" depends="checkos" if="test.binary.set.unix">
<exec executable="make" dir="${test.build.dir}">
<arg value="install"/>
<arg value="DESTDIR=../../${dist.dir}"/>
</exec>
</target>
<target name="-install-test-vs" depends="checkos" if="test.binary.set.windows">
<exec executable="msbuild" dir="${test.build.dir}">
<arg value="INSTALL.vcxproj"/>
</exec>
</target>
<target name="-install-test" depends="-install-test-make,-install-test-vs" if="test.binary.set">
</target>
<target name="-run-test" if="test.binary.set" description="Actually run test cases">
<echo message="Running unit test binary ${test.binary} in directory ${dist.dir}/bin" />
<exec executable="./${test.binary}" dir="${dist.dir}/bin" resultproperty="test.exit.code">
<env key="LD_LIBRARY_PATH" value="${deps.dir}/lib"/>
<env key="DYLD_LIBRARY_PATH" value="${deps.dir}/lib"/>
</exec>
<fail message="Unit test binary reported errors!">
<condition>
<isfailure code="${test.exit.code}"/>
</condition>
</fail>
</target>
<target name="test" depends="-check-test-binary-set,build-test,-install-test,-write-no-test-present,-run-test" description="Run test cases">
</target>
<target name="compile-tests" depends="compile">
</target>
<target name="-findmain">
<echo message="Not implemented." />
</target>
</project>