• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1<project name="gdx-bullet-IOS-32" basedir="." default="postcompile">
2	<!-- include the environment -->
3	<property environment="env"/>
4	<!-- output directory for temporary object files -->
5	<property name="buildDir" value="target/ios32" />
6	<!-- output directory for the shared library -->
7	<property name="libsDir" value="../libs/ios32" />
8	<!-- the name of the shared library -->
9	<property name="libName" value="libgdx-bullet.a"/>
10	<!-- the jni header jniPlatform to use -->
11	<property name="jniPlatform" value="mac"/>
12	<!-- the compilerPrefix for the C & C++ compilers -->
13	<property name="compilerPrefix" value=""/>
14	<property name="iphoneos-sdk" value="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS9.3.sdk/"/>
15	<property name="iphonesimulator-sdk" value="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator9.3.sdk"/>
16	<property name="tvos-sdk" value="/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS9.2.sdk/"/>
17	<property name="tvossimulator-sdk" value="/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator9.2.sdk"/>
18
19
20	<!-- define gcc compiler, options and files to compile -->
21	<property name="gcc" value="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"/>
22	<property name="gcc-opts" value="-c -Wall -O2"/>
23	<fileset id="gcc-files" dir="./">
24		<exclude name="target/"/>
25				<include name="memcpy_wrap.c"/>
26		<include name="**/*.c"/>
27
28				<exclude name="src/bullet/BulletMultiThreaded/GpuSoftBodySolvers/**"/>
29
30	</fileset>
31
32	<!-- define g++ compiler, options and files to compile -->
33	<property name="g++" value="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"/>
34	<property name="g++-opts" value="-c -Wall -O2 -fno-strict-aliasing -fno-rtti -DBT_NO_PROFILE"/>
35	<fileset id="g++-files" dir="./">
36		<exclude name="target/"/>
37				<include name="**/*.cpp"/>
38
39				<exclude name="src/bullet/BulletMultiThreaded/GpuSoftBodySolvers/**"/>
40
41	</fileset>
42
43	<!-- define linker and options -->
44	<property name="linker" value="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar"/>
45	<property name="linker-opts" value="rcs"/>
46	<property name="libraries" value=""/>
47
48	<!-- cleans the build directory, removes all object files and shared libs -->
49	<target name="clean">
50		<delete includeemptydirs="true" quiet="true">
51			<fileset dir="${buildDir}"/>
52			<fileset dir="${libsDir}" includes="**/*" excludes="**/.svn"/>
53		</delete>
54	</target>
55
56	<target name="clean-objfiles">
57		<delete>
58			<fileset dir="${buildDir}">
59				<include name="**/*.o"/>
60			</fileset>
61		</delete>
62	</target>
63
64	<target name="create-build-dir">
65		<!-- FIXME this is pretty nasty :/ -->
66		<copy todir="${buildDir}">
67			<fileset refid="g++-files"/>
68			<fileset refid="gcc-files"/>
69		</copy>
70		<delete>
71			<fileset dir="${buildDir}">
72				<include name="*"/>
73				<exclude name="*.o"/>
74			</fileset>
75		</delete>
76	</target>
77
78	<!-- compiles all C and C++ files to object files in the build directory, for 386 builds-->
79	<target name="compile-386" depends="clean,create-build-dir">
80		<mkdir dir="${buildDir}"/>
81		<apply failonerror="true" executable="${g++}" dest="${buildDir}" verbose="true">
82			<arg line="-isysroot ${iphonesimulator-sdk} -arch i386 -miphoneos-version-min=6.0 ${g++-opts}"/>
83			<arg value="-Ijni-headers"/>
84			<arg value="-Ijni-headers/${jniPlatform}"/>
85			<arg value="-I."/>
86						<arg value="-Isrc/bullet/"/>
87			<arg value="-Isrc/custom/"/>
88			<arg value="-Isrc/extras/Serialize/"/>
89
90			<srcfile/>
91			<arg value="-o"/>
92			<targetfile/>
93			<fileset refid="g++-files"/>
94			<compositemapper>
95				<mapper type="glob" from="*.cpp" to="*.o"/>
96				<mapper type="glob" from="*.mm" to="*.o"/>
97			</compositemapper>
98		</apply>
99		<apply failonerror="true" executable="${gcc}" dest="${buildDir}" verbose="true">
100			<arg line="-isysroot ${iphonesimulator-sdk} -arch i386 -miphoneos-version-min=6.0 ${gcc-opts}"/>
101			<arg value="-Ijni-headers"/>
102			<arg value="-Ijni-headers/${jniPlatform}"/>
103			<arg value="-I."/>
104						<arg value="-Isrc/bullet/"/>
105			<arg value="-Isrc/custom/"/>
106			<arg value="-Isrc/extras/Serialize/"/>
107
108			<srcfile/>
109			<arg value="-o"/>
110			<targetfile/>
111			<fileset refid="gcc-files"/>
112			<compositemapper>
113				<mapper type="glob" from="*.c" to="*.o"/>
114			</compositemapper>
115		</apply>
116	</target>
117
118	<!-- links the shared library based on the previously compiled object files -->
119	<target name="link-386" depends="compile-386">
120		<fileset dir="${buildDir}" id="objFileSet">
121			<patternset>
122				<include name="**/*.o" />
123			</patternset>
124		</fileset>
125		<pathconvert pathsep=" " property="objFiles" refid="objFileSet" />
126		<mkdir dir="${libsDir}" />
127		<exec executable="${linker}" failonerror="true" dir="${buildDir}">
128			<arg line="${linker-opts}" />
129			<arg path="${libsDir}/${libName}.386" />
130			<arg line="${objFiles}"/>
131			<arg line="${libraries}" />
132		</exec>
133	</target>
134
135	<!-- compiles all C and C++ files to object files in the build directory, for x86_64 builds-->
136	<target name="compile-x86_64" depends="create-build-dir">
137		<mkdir dir="${buildDir}"/>
138		<antcall target="clean-objfiles"/>
139		<apply failonerror="true" executable="${g++}" dest="${buildDir}" verbose="true">
140			<arg line="-isysroot ${iphonesimulator-sdk} -arch x86_64 -miphoneos-version-min=6.0 ${g++-opts}"/>
141			<arg value="-Ijni-headers"/>
142			<arg value="-Ijni-headers/${jniPlatform}"/>
143			<arg value="-I."/>
144						<arg value="-Isrc/bullet/"/>
145			<arg value="-Isrc/custom/"/>
146			<arg value="-Isrc/extras/Serialize/"/>
147
148			<srcfile/>
149			<arg value="-o"/>
150			<targetfile/>
151			<fileset refid="g++-files"/>
152			<compositemapper>
153				<mapper type="glob" from="*.cpp" to="*.o"/>
154				<mapper type="glob" from="*.mm" to="*.o"/>
155			</compositemapper>
156		</apply>
157		<apply failonerror="true" executable="${gcc}" dest="${buildDir}" verbose="true">
158			<arg line="-isysroot ${iphonesimulator-sdk} -arch x86_64 -miphoneos-version-min=6.0 ${gcc-opts}"/>
159			<arg value="-Ijni-headers"/>
160			<arg value="-Ijni-headers/${jniPlatform}"/>
161			<arg value="-I."/>
162						<arg value="-Isrc/bullet/"/>
163			<arg value="-Isrc/custom/"/>
164			<arg value="-Isrc/extras/Serialize/"/>
165
166			<srcfile/>
167			<arg value="-o"/>
168			<targetfile/>
169			<fileset refid="gcc-files"/>
170			<compositemapper>
171				<mapper type="glob" from="*.c" to="*.o"/>
172			</compositemapper>
173		</apply>
174	</target>
175
176	<!-- links the shared library based on the previously compiled object files -->
177	<target name="link-x86_64" depends="compile-x86_64">
178		<fileset dir="${buildDir}" id="objFileSet">
179			<patternset>
180				<include name="**/*.o" />
181			</patternset>
182		</fileset>
183		<pathconvert pathsep=" " property="objFiles" refid="objFileSet" />
184		<mkdir dir="${libsDir}" />
185		<exec executable="${linker}" failonerror="true" dir="${buildDir}">
186			<arg line="${linker-opts}" />
187			<arg path="${libsDir}/${libName}.x86_64" />
188			<arg line="${objFiles}"/>
189			<arg line="${libraries}" />
190		</exec>
191	</target>
192
193	<!-- compiles all C and C++ files to object files in the build directory, for armv7 builds-->
194	<target name="compile-arm" depends="create-build-dir">
195		<mkdir dir="${buildDir}"/>
196		<antcall target="clean-objfiles"/>
197		<apply failonerror="true" executable="${g++}" dest="${buildDir}" verbose="true">
198			<arg line="-isysroot ${iphoneos-sdk} -arch armv7 -miphoneos-version-min=6.0 -fembed-bitcode ${g++-opts}"/>
199			<arg value="-Ijni-headers"/>
200			<arg value="-Ijni-headers/${jniPlatform}"/>
201			<arg value="-I."/>
202						<arg value="-Isrc/bullet/"/>
203			<arg value="-Isrc/custom/"/>
204			<arg value="-Isrc/extras/Serialize/"/>
205
206			<srcfile/>
207			<arg value="-o"/>
208			<targetfile/>
209			<fileset refid="g++-files"/>
210			<compositemapper>
211				<mapper type="glob" from="*.cpp" to="*.o"/>
212				<mapper type="glob" from="*.mm" to="*.o"/>
213			</compositemapper>
214		</apply>
215		<apply failonerror="true" executable="${gcc}" dest="${buildDir}" verbose="true">
216			<arg line="-isysroot ${iphoneos-sdk} -arch armv7 -miphoneos-version-min=6.0 -fembed-bitcode ${gcc-opts}"/>
217			<arg value="-Ijni-headers"/>
218			<arg value="-Ijni-headers/${jniPlatform}"/>
219			<arg value="-I."/>
220						<arg value="-Isrc/bullet/"/>
221			<arg value="-Isrc/custom/"/>
222			<arg value="-Isrc/extras/Serialize/"/>
223
224			<srcfile/>
225			<arg value="-o"/>
226			<targetfile/>
227			<fileset refid="gcc-files"/>
228			<compositemapper>
229				<mapper type="glob" from="*.c" to="*.o"/>
230			</compositemapper>
231		</apply>
232	</target>
233
234	<!-- links the shared library based on the previously compiled object files -->
235	<target name="link-arm" depends="compile-arm">
236		<fileset dir="${buildDir}" id="objFileSet">
237			<patternset>
238				<include name="**/*.o" />
239			</patternset>
240		</fileset>
241		<pathconvert pathsep=" " property="objFiles" refid="objFileSet" />
242		<mkdir dir="${libsDir}" />
243		<exec executable="${linker}" failonerror="true" dir="${buildDir}">
244			<arg line="${linker-opts}" />
245			<arg path="${libsDir}/${libName}.armv7" />
246			<arg line="${objFiles}"/>
247			<arg line="${libraries}" />
248		</exec>
249	</target>
250
251	<!-- compiles all C and C++ files to object files in the build directory, for arm64 builds-->
252	<target name="compile-arm64" depends="create-build-dir,clean-objfiles">
253		<mkdir dir="${buildDir}"/>
254		<antcall target="clean-objfiles"/>
255		<apply failonerror="true" executable="${g++}" dest="${buildDir}" verbose="true">
256			<arg line="-isysroot ${iphoneos-sdk} -arch arm64 -miphoneos-version-min=6.0 -fembed-bitcode ${g++-opts}"/>
257			<arg value="-Ijni-headers"/>
258			<arg value="-Ijni-headers/${jniPlatform}"/>
259			<arg value="-I."/>
260						<arg value="-Isrc/bullet/"/>
261			<arg value="-Isrc/custom/"/>
262			<arg value="-Isrc/extras/Serialize/"/>
263
264			<srcfile/>
265			<arg value="-o"/>
266			<targetfile/>
267			<fileset refid="g++-files"/>
268			<compositemapper>
269				<mapper type="glob" from="*.cpp" to="*.o"/>
270				<mapper type="glob" from="*.mm" to="*.o"/>
271			</compositemapper>
272		</apply>
273		<apply failonerror="true" executable="${gcc}" dest="${buildDir}" verbose="true">
274			<arg line="-isysroot ${iphoneos-sdk} -arch arm64 -miphoneos-version-min=6.0 -fembed-bitcode ${gcc-opts}"/>
275			<arg value="-Ijni-headers"/>
276			<arg value="-Ijni-headers/${jniPlatform}"/>
277			<arg value="-I."/>
278						<arg value="-Isrc/bullet/"/>
279			<arg value="-Isrc/custom/"/>
280			<arg value="-Isrc/extras/Serialize/"/>
281
282			<srcfile/>
283			<arg value="-o"/>
284			<targetfile/>
285			<fileset refid="gcc-files"/>
286			<compositemapper>
287				<mapper type="glob" from="*.c" to="*.o"/>
288			</compositemapper>
289		</apply>
290	</target>
291
292	<!-- links the shared library based on the previously compiled object files -->
293	<target name="link-arm64" depends="compile-arm64">
294		<fileset dir="${buildDir}" id="objFileSet">
295			<patternset>
296				<include name="**/*.o" />
297			</patternset>
298		</fileset>
299		<pathconvert pathsep=" " property="objFiles" refid="objFileSet" />
300		<mkdir dir="${libsDir}" />
301		<exec executable="${linker}" failonerror="true" dir="${buildDir}">
302			<arg line="${linker-opts}" />
303			<arg path="${libsDir}/${libName}.arm64" />
304			<arg line="${objFiles}"/>
305			<arg line="${libraries}" />
306		</exec>
307	</target>
308
309	<!-- compiles all C and C++ files to object files in the build directory, for tvOS x86_64 builds-->
310	<target name="compile-tvos-x86_64" depends="create-build-dir">
311		<mkdir dir="${buildDir}"/>
312		<antcall target="clean-objfiles"/>
313		<apply failonerror="true" executable="${g++}" dest="${buildDir}" verbose="true">
314			<arg line="-isysroot ${tvossimulator-sdk} -arch x86_64 -mtvos-version-min=9.0 ${g++-opts}"/>
315			<arg value="-Ijni-headers"/>
316			<arg value="-Ijni-headers/${jniPlatform}"/>
317			<arg value="-I."/>
318						<arg value="-Isrc/bullet/"/>
319			<arg value="-Isrc/custom/"/>
320			<arg value="-Isrc/extras/Serialize/"/>
321
322			<srcfile/>
323			<arg value="-o"/>
324			<targetfile/>
325			<fileset refid="g++-files"/>
326			<compositemapper>
327				<mapper type="glob" from="*.cpp" to="*.o"/>
328				<mapper type="glob" from="*.mm" to="*.o"/>
329			</compositemapper>
330		</apply>
331		<apply failonerror="true" executable="${gcc}" dest="${buildDir}" verbose="true">
332			<arg line="-isysroot ${tvossimulator-sdk} -arch x86_64 -mtvos-version-min=9.0 ${gcc-opts}"/>
333			<arg value="-Ijni-headers"/>
334			<arg value="-Ijni-headers/${jniPlatform}"/>
335			<arg value="-I."/>
336						<arg value="-Isrc/bullet/"/>
337			<arg value="-Isrc/custom/"/>
338			<arg value="-Isrc/extras/Serialize/"/>
339
340			<srcfile/>
341			<arg value="-o"/>
342			<targetfile/>
343			<fileset refid="gcc-files"/>
344			<compositemapper>
345				<mapper type="glob" from="*.c" to="*.o"/>
346			</compositemapper>
347		</apply>
348	</target>
349
350	<!-- links the shared library based on the previously compiled object files -->
351	<target name="link-tvos-x86_64" depends="compile-tvos-x86_64">
352		<fileset dir="${buildDir}" id="objFileSet">
353			<patternset>
354				<include name="**/*.o" />
355			</patternset>
356		</fileset>
357		<pathconvert pathsep=" " property="objFiles" refid="objFileSet" />
358		<mkdir dir="${libsDir}" />
359		<exec executable="${linker}" failonerror="true" dir="${buildDir}">
360			<arg line="${linker-opts}" />
361			<arg path="${libsDir}/${libName}.tvos.x86_64" />
362			<arg line="${objFiles}"/>
363			<arg line="${libraries}" />
364		</exec>
365	</target>
366
367	<!-- compiles all C and C++ files to object files in the build directory, for tvOS arm64 builds-->
368	<target name="compile-tvos-arm64" depends="create-build-dir,clean-objfiles">
369		<mkdir dir="${buildDir}"/>
370		<antcall target="clean-objfiles"/>
371		<apply failonerror="true" executable="${g++}" dest="${buildDir}" verbose="true">
372			<arg line="-isysroot ${tvos-sdk} -arch arm64 -mtvos-version-min=9.0 -fembed-bitcode ${g++-opts}"/>
373			<arg value="-Ijni-headers"/>
374			<arg value="-Ijni-headers/${jniPlatform}"/>
375			<arg value="-I."/>
376						<arg value="-Isrc/bullet/"/>
377			<arg value="-Isrc/custom/"/>
378			<arg value="-Isrc/extras/Serialize/"/>
379
380			<srcfile/>
381			<arg value="-o"/>
382			<targetfile/>
383			<fileset refid="g++-files"/>
384			<compositemapper>
385				<mapper type="glob" from="*.cpp" to="*.o"/>
386				<mapper type="glob" from="*.mm" to="*.o"/>
387			</compositemapper>
388		</apply>
389		<apply failonerror="true" executable="${gcc}" dest="${buildDir}" verbose="true">
390			<arg line="-isysroot ${tvos-sdk} -arch arm64 -mtvos-version-min=9.0 -fembed-bitcode ${gcc-opts}"/>
391			<arg value="-Ijni-headers"/>
392			<arg value="-Ijni-headers/${jniPlatform}"/>
393			<arg value="-I."/>
394						<arg value="-Isrc/bullet/"/>
395			<arg value="-Isrc/custom/"/>
396			<arg value="-Isrc/extras/Serialize/"/>
397
398			<srcfile/>
399			<arg value="-o"/>
400			<targetfile/>
401			<fileset refid="gcc-files"/>
402			<compositemapper>
403				<mapper type="glob" from="*.c" to="*.o"/>
404			</compositemapper>
405		</apply>
406	</target>
407
408	<!-- links the shared library based on the previously compiled object files -->
409	<target name="link-tvos-arm64" depends="compile-tvos-arm64">
410		<fileset dir="${buildDir}" id="objFileSet">
411			<patternset>
412				<include name="**/*.o" />
413			</patternset>
414		</fileset>
415		<pathconvert pathsep=" " property="objFiles" refid="objFileSet" />
416		<mkdir dir="${libsDir}" />
417		<exec executable="${linker}" failonerror="true" dir="${buildDir}">
418			<arg line="${linker-opts}" />
419			<arg path="${libsDir}/${libName}.tvos.arm64" />
420			<arg line="${objFiles}"/>
421			<arg line="${libraries}" />
422		</exec>
423	</target>
424
425	<target name="link-fat">
426		<exec executable="lipo" failonerror="true" dir="${libsDir}">
427			<arg line="-create -output ${libName} ${libName}.386 ${libName}.x86_64 ${libName}.armv7 ${libName}.arm64"/>
428		</exec>
429		<exec executable="lipo" failonerror="true" dir="${libsDir}">
430			<arg line="-create -output ${libName}.tvos ${libName}.tvos.x86_64 ${libName}.tvos.arm64"/>
431		</exec>
432	</target>
433
434	<target name="postcompile" depends="link-386,link-x86_64,link-arm,link-arm64,link-tvos-x86_64,link-tvos-arm64,link-fat">
435
436	</target>
437</project>
438