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.1.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.1.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 -miphoneos-version-min=5.1"/>
\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 -miphoneos-version-min=5.1"/>
\r
33 <fileset id="g++-files" dir="./">
\r
34 <exclude name="target/"/>
\r
35 <include name="**/*.cpp"/>
37 <exclude name="android/**"/>
41 <!-- define linker and options -->
\r
42 <property name="linker" value="${compilerPrefix}ar"/>
\r
43 <property name="linker-opts" value="rcs"/>
\r
44 <property name="libraries" value=""/>
\r
46 <!-- cleans the build directory, removes all object files and shared libs -->
\r
47 <target name="clean">
\r
48 <delete includeemptydirs="true" quiet="true">
\r
49 <fileset dir="${buildDir}"/>
\r
50 <fileset dir="${libsDir}" includes="**/*" excludes="**/.svn"/>
\r
54 <target name="clean-objfiles">
\r
56 <fileset dir="${buildDir}">
\r
57 <include name="**/*.o"/>
\r
62 <target name="create-build-dir">
\r
63 <!-- FIXME this is pretty nasty :/ -->
\r
64 <copy todir="${buildDir}">
\r
65 <fileset refid="g++-files"/>
\r
66 <fileset refid="gcc-files"/>
\r
69 <fileset dir="${buildDir}">
\r
71 <exclude name="*.o"/>
\r
76 <!-- compiles all C and C++ files to object files in the build directory, for 386 builds-->
\r
77 <target name="compile-386" depends="clean,create-build-dir">
\r
78 <mkdir dir="${buildDir}"/>
\r
79 <apply failonerror="true" executable="${iphonesimulator-platform}/${g++}" dest="${buildDir}" verbose="true">
\r
80 <arg line="-isysroot ${iphonesimulator-sdk} -arch i386 ${g++-opts}"/>
\r
81 <arg value="-Ijni-headers"/>
\r
82 <arg value="-Ijni-headers/${jniPlatform}"/>
\r
85 <arg value="-Ijni-headers"/>
86 <arg value="-Ijni-headers/mac"/>
87 <arg value="-Iiosgl"/>
92 <fileset refid="g++-files"/>
\r
94 <mapper type="glob" from="*.cpp" to="*.o"/>
\r
95 <mapper type="glob" from="*.mm" to="*.o"/>
\r
98 <apply failonerror="true" executable="${iphonesimulator-platform}/${gcc}" dest="${buildDir}" verbose="true">
\r
99 <arg line="-isysroot ${iphonesimulator-sdk} -arch i386 ${gcc-opts}"/>
\r
100 <arg value="-Ijni-headers"/>
\r
101 <arg value="-Ijni-headers/${jniPlatform}"/>
\r
104 <arg value="-Ijni-headers"/>
105 <arg value="-Ijni-headers/mac"/>
106 <arg value="-Iiosgl"/>
111 <fileset refid="gcc-files"/>
\r
113 <mapper type="glob" from="*.c" to="*.o"/>
\r
118 <!-- links the shared library based on the previously compiled object files -->
\r
119 <target name="link-386" depends="compile-386">
\r
120 <fileset dir="${buildDir}" id="objFileSet">
\r
122 <include name="**/*.o" />
\r
125 <pathconvert pathsep=" " property="objFiles" refid="objFileSet" />
\r
126 <mkdir dir="${libsDir}" />
\r
127 <exec executable="${iphonesimulator-platform}/${linker}" failonerror="true" dir="${buildDir}">
\r
128 <arg line="${linker-opts}" />
\r
129 <arg path="${libsDir}/${libName}.386" />
\r
130 <arg line="${objFiles}"/>
\r
131 <arg line="${libraries}" />
\r
135 <!-- compiles all C and C++ files to object files in the build directory, for 386 builds-->
\r
136 <target name="compile-arm" depends="create-build-dir,clean-objfiles">
\r
137 <mkdir dir="${buildDir}"/>
\r
138 <apply failonerror="true" executable="${iphoneos-platform}/${g++}" dest="${buildDir}" verbose="true">
\r
139 <arg line="-isysroot ${iphoneos-sdk} -arch armv7 ${g++-opts}"/>
\r
140 <arg value="-Ijni-headers"/>
\r
141 <arg value="-Ijni-headers/${jniPlatform}"/>
\r
144 <arg value="-Ijni-headers"/>
145 <arg value="-Ijni-headers/mac"/>
146 <arg value="-Iiosgl"/>
151 <fileset refid="g++-files"/>
\r
153 <mapper type="glob" from="*.cpp" to="*.o"/>
\r
154 <mapper type="glob" from="*.mm" to="*.o"/>
\r
157 <apply failonerror="true" executable="${iphoneos-platform}/${gcc}" dest="${buildDir}" verbose="true">
\r
158 <arg line="-isysroot ${iphoneos-sdk} -arch armv7 ${gcc-opts}"/>
\r
159 <arg value="-Ijni-headers"/>
\r
160 <arg value="-Ijni-headers/${jniPlatform}"/>
\r
163 <arg value="-Ijni-headers"/>
164 <arg value="-Ijni-headers/mac"/>
165 <arg value="-Iiosgl"/>
170 <fileset refid="gcc-files"/>
\r
172 <mapper type="glob" from="*.c" to="*.o"/>
\r
177 <!-- links the shared library based on the previously compiled object files -->
\r
178 <target name="link-arm" depends="compile-arm">
\r
179 <fileset dir="${buildDir}" id="objFileSet">
\r
181 <include name="**/*.o" />
\r
184 <pathconvert pathsep=" " property="objFiles" refid="objFileSet" />
\r
185 <mkdir dir="${libsDir}" />
\r
186 <exec executable="${iphoneos-platform}/${linker}" failonerror="true" dir="${buildDir}">
\r
187 <arg line="${linker-opts}" />
\r
188 <arg path="${libsDir}/${libName}.armv7" />
\r
189 <arg line="${objFiles}"/>
\r
190 <arg line="${libraries}" />
\r
194 <target name="link-fat">
\r
195 <exec executable="lipo" failonerror="true" dir="${libsDir}">
\r
196 <arg line="-create -output ${libName} ${libName}.386 ${libName}.armv7"/>
\r
200 <target name="postcompile" depends="link-386,link-arm,link-fat">
\r