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