1 <project name="gdx-IOS-32" basedir="." default="postcompile">
\r
2 <!-- include the environment -->
\r
3 <property environment="env"/>
\r
4 <!-- output directory for temporary object files -->
\r
5 <property name="buildDir" value="../target/native/ios32" />
\r
6 <!-- output directory for the shared library -->
\r
7 <property name="libsDir" value="../libs/ios32" />
\r
8 <!-- the name of the shared library -->
\r
9 <property name="libName" value="libgdx.a"/>
\r
10 <!-- the jni header jniPlatform to use -->
\r
11 <property name="jniPlatform" value="mac"/>
\r
12 <!-- the compilerPrefix for the C & C++ compilers -->
\r
13 <property name="compilerPrefix" value=""/>
\r
14 <property name="iphoneos-platform" value="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/usr/bin"/>
\r
15 <property name="iphoneos-sdk" value="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS6.0.sdk/"/>
\r
16 <property name="iphonesimulator-platform" value="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/usr/bin"/>
\r
17 <property name="iphonesimulator-sdk" value="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator6.0.sdk/"/>
\r
19 <!-- define gcc compiler, options and files to compile -->
\r
20 <property name="gcc" value="${compilerPrefix}gcc"/>
\r
21 <property name="gcc-opts" value="-c -Wall -O2"/>
\r
22 <fileset id="gcc-files" dir="./">
\r
23 <exclude name="target/"/>
\r
24 <include name="memcpy_wrap.c"/>
25 <include name="**/*.c"/>
30 <!-- define g++ compiler, options and files to compile -->
\r
31 <property name="g++" value="${compilerPrefix}g++"/>
\r
32 <property name="g++-opts" value="-c -Wall -O2"/>
\r
33 <fileset id="g++-files" dir="./">
\r
34 <exclude name="target/"/>
\r
35 <include name="**/*.cpp"/>
40 <!-- define linker and options -->
\r
41 <property name="linker" value="${compilerPrefix}ar"/>
\r
42 <property name="linker-opts" value="rcs"/>
\r
43 <property name="libraries" value=""/>
\r
45 <!-- cleans the build directory, removes all object files and shared libs -->
\r
46 <target name="clean">
\r
47 <delete includeemptydirs="true" quiet="true">
\r
48 <fileset dir="${buildDir}"/>
\r
49 <fileset dir="${libsDir}" includes="**/*" excludes="**/.svn"/>
\r
53 <target name="clean-objfiles">
\r
55 <fileset dir="${buildDir}">
\r
56 <include name="**/*.o"/>
\r
61 <target name="create-build-dir">
\r
62 <!-- FIXME this is pretty nasty :/ -->
\r
63 <copy todir="${buildDir}">
\r
64 <fileset refid="g++-files"/>
\r
65 <fileset refid="gcc-files"/>
\r
68 <fileset dir="${buildDir}">
\r
70 <exclude name="*.o"/>
\r
75 <!-- compiles all C and C++ files to object files in the build directory, for 386 builds-->
\r
76 <target name="compile-386" depends="clean,create-build-dir">
\r
77 <mkdir dir="${buildDir}"/>
\r
78 <apply failonerror="true" executable="${iphonesimulator-platform}/${g++}" dest="${buildDir}" verbose="true">
\r
79 <arg line="-isysroot ${iphonesimulator-sdk} -arch i386 ${g++-opts}"/>
\r
80 <arg value="-Ijni-headers"/>
\r
81 <arg value="-Ijni-headers/${jniPlatform}"/>
\r
87 <fileset refid="g++-files"/>
\r
89 <mapper type="glob" from="*.cpp" to="*.o"/>
\r
90 <mapper type="glob" from="*.mm" to="*.o"/>
\r
93 <apply failonerror="true" executable="${iphonesimulator-platform}/${gcc}" dest="${buildDir}" verbose="true">
\r
94 <arg line="-isysroot ${iphonesimulator-sdk} -arch i386 ${gcc-opts}"/>
\r
95 <arg value="-Ijni-headers"/>
\r
96 <arg value="-Ijni-headers/${jniPlatform}"/>
\r
102 <fileset refid="gcc-files"/>
\r
104 <mapper type="glob" from="*.c" to="*.o"/>
\r
109 <!-- links the shared library based on the previously compiled object files -->
\r
110 <target name="link-386" depends="compile-386">
\r
111 <fileset dir="${buildDir}" id="objFileSet">
\r
113 <include name="**/*.o" />
\r
116 <pathconvert pathsep=" " property="objFiles" refid="objFileSet" />
\r
117 <mkdir dir="${libsDir}" />
\r
118 <exec executable="${iphonesimulator-platform}/${linker}" failonerror="true" dir="${buildDir}">
\r
119 <arg line="${linker-opts}" />
\r
120 <arg path="${libsDir}/${libName}.386" />
\r
121 <arg line="${objFiles}"/>
\r
122 <arg line="${libraries}" />
\r
126 <!-- compiles all C and C++ files to object files in the build directory, for 386 builds-->
\r
127 <target name="compile-arm" depends="create-build-dir,clean-objfiles">
\r
128 <mkdir dir="${buildDir}"/>
\r
129 <apply failonerror="true" executable="${iphoneos-platform}/${g++}" dest="${buildDir}" verbose="true">
\r
130 <arg line="-isysroot ${iphoneos-sdk} -arch armv7 ${g++-opts}"/>
\r
131 <arg value="-Ijni-headers"/>
\r
132 <arg value="-Ijni-headers/${jniPlatform}"/>
\r
138 <fileset refid="g++-files"/>
\r
140 <mapper type="glob" from="*.cpp" to="*.o"/>
\r
141 <mapper type="glob" from="*.mm" to="*.o"/>
\r
144 <apply failonerror="true" executable="${iphoneos-platform}/${gcc}" dest="${buildDir}" verbose="true">
\r
145 <arg line="-isysroot ${iphoneos-sdk} -arch armv7 ${gcc-opts}"/>
\r
146 <arg value="-Ijni-headers"/>
\r
147 <arg value="-Ijni-headers/${jniPlatform}"/>
\r
153 <fileset refid="gcc-files"/>
\r
155 <mapper type="glob" from="*.c" to="*.o"/>
\r
160 <!-- links the shared library based on the previously compiled object files -->
\r
161 <target name="link-arm" depends="compile-arm">
\r
162 <fileset dir="${buildDir}" id="objFileSet">
\r
164 <include name="**/*.o" />
\r
167 <pathconvert pathsep=" " property="objFiles" refid="objFileSet" />
\r
168 <mkdir dir="${libsDir}" />
\r
169 <exec executable="${iphoneos-platform}/${linker}" failonerror="true" dir="${buildDir}">
\r
170 <arg line="${linker-opts}" />
\r
171 <arg path="${libsDir}/${libName}.armv7" />
\r
172 <arg line="${objFiles}"/>
\r
173 <arg line="${libraries}" />
\r
177 <target name="link-fat">
\r
178 <exec executable="lipo" failonerror="true" dir="${libsDir}">
\r
179 <arg line="-create -output ${libName} ${libName}.386 ${libName}.armv7"/>
\r
183 <target name="postcompile" depends="link-386,link-arm,link-fat">
\r