com.badlogic.gdx.jnigen.resources.scripts.build-ios.xml.template Maven / Gradle / Ivy
<project name="%projectName%" basedir="." default="postcompile"> <!-- include the environment --> <property environment="env"/> <!-- output directory for temporary object files --> <property name="buildDir" value="%buildDir%" /> <!-- output directory for the shared library --> <property name="libsDir" value="%libsDir%" /> <!-- the name of the shared library --> <property name="libName" value="%libName%"/> <!-- the jni header jniPlatform to use --> <property name="jniPlatform" value="mac"/> <!-- the compilerPrefix for the C & C++ compilers --> <property name="compilerPrefix" value="%compilerPrefix%"/> <property name="iphoneos-sdk" value="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneOS.platform/Developer/SDKs/iPhoneOS.sdk/"/> <property name="iphonesimulator-sdk" value="/Applications/Xcode.app/Contents/Developer/Platforms/iPhoneSimulator.platform/Developer/SDKs/iPhoneSimulator.sdk"/> <property name="tvos-sdk" value="/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVOS.platform/Developer/SDKs/AppleTVOS.sdk/"/> <property name="tvossimulator-sdk" value="/Applications/Xcode.app/Contents/Developer/Platforms/AppleTVSimulator.platform/Developer/SDKs/AppleTVSimulator.sdk"/> <!-- define gcc compiler, options and files to compile --> <property name="gcc" value="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang"/> <property name="gcc-opts" value="%cFlags%"/> <fileset id="gcc-files" dir="./"> <exclude name="target/"/> %cIncludes% %cExcludes% </fileset> <!-- define g++ compiler, options and files to compile --> <property name="g++" value="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/clang++"/> <property name="g++-opts" value="%cppFlags%"/> <fileset id="g++-files" dir="./"> <exclude name="target/"/> %cppIncludes% %cppExcludes% </fileset> <!-- define linker and options --> <property name="linker" value="/Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/bin/ar"/> <property name="linker-opts" value="%linkerFlags%"/> <property name="libraries" value="%libraries%"/> <!-- cleans the build directory, removes all object files and shared libs --> <target name="clean"> <delete includeemptydirs="true" quiet="true"> <fileset dir="${buildDir}"/> <fileset dir="${libsDir}" includes="**/*" excludes="**/.svn"/> </delete> </target> <target name="clean-objfiles"> <delete> <fileset dir="${buildDir}"> <include name="**/*.o"/> </fileset> </delete> </target> <target name="create-build-dir"> <!-- FIXME this is pretty nasty :/ --> <copy todir="${buildDir}"> <fileset refid="g++-files"/> <fileset refid="gcc-files"/> </copy> <delete> <fileset dir="${buildDir}"> <include name="*"/> <exclude name="*.o"/> </fileset> </delete> </target> <!-- compiles all C and C++ files to object files in the build directory, for 386 builds--> <target name="compile-386" depends="clean,create-build-dir"> <mkdir dir="${buildDir}"/> <apply failonerror="true" executable="${g++}" dest="${buildDir}" verbose="true"> <arg line="-isysroot ${iphonesimulator-sdk} -arch i386 -miphoneos-version-min=6.0 ${g++-opts}"/> <arg value="-Ijni-headers"/> <arg value="-Ijni-headers/${jniPlatform}"/> <arg value="-I."/> %headerDirs% <srcfile/> <arg value="-o"/> <targetfile/> <fileset refid="g++-files"/> <compositemapper> <mapper type="glob" from="*.cpp" to="*.o"/> <mapper type="glob" from="*.mm" to="*.o"/> </compositemapper> </apply> <apply failonerror="true" executable="${gcc}" dest="${buildDir}" verbose="true"> <arg line="-isysroot ${iphonesimulator-sdk} -arch i386 -miphoneos-version-min=6.0 ${gcc-opts}"/> <arg value="-Ijni-headers"/> <arg value="-Ijni-headers/${jniPlatform}"/> <arg value="-I."/> %headerDirs% <srcfile/> <arg value="-o"/> <targetfile/> <fileset refid="gcc-files"/> <compositemapper> <mapper type="glob" from="*.c" to="*.o"/> </compositemapper> </apply> </target> <!-- links the shared library based on the previously compiled object files --> <target name="link-386" depends="compile-386"> <fileset dir="${buildDir}" id="objFileSet"> <patternset> <include name="**/*.o" /> </patternset> </fileset> <pathconvert pathsep=" " property="objFiles" refid="objFileSet" /> <mkdir dir="${libsDir}" /> <exec executable="${linker}" failonerror="true" dir="${buildDir}"> <arg line="${linker-opts}" /> <arg path="${libsDir}/${libName}.386" /> <arg line="${objFiles}"/> <arg line="${libraries}" /> </exec> </target> <!-- compiles all C and C++ files to object files in the build directory, for x86_64 builds--> <target name="compile-x86_64" depends="create-build-dir"> <mkdir dir="${buildDir}"/> <antcall target="clean-objfiles"/> <apply failonerror="true" executable="${g++}" dest="${buildDir}" verbose="true"> <arg line="-isysroot ${iphonesimulator-sdk} -arch x86_64 -miphoneos-version-min=6.0 ${g++-opts}"/> <arg value="-Ijni-headers"/> <arg value="-Ijni-headers/${jniPlatform}"/> <arg value="-I."/> %headerDirs% <srcfile/> <arg value="-o"/> <targetfile/> <fileset refid="g++-files"/> <compositemapper> <mapper type="glob" from="*.cpp" to="*.o"/> <mapper type="glob" from="*.mm" to="*.o"/> </compositemapper> </apply> <apply failonerror="true" executable="${gcc}" dest="${buildDir}" verbose="true"> <arg line="-isysroot ${iphonesimulator-sdk} -arch x86_64 -miphoneos-version-min=6.0 ${gcc-opts}"/> <arg value="-Ijni-headers"/> <arg value="-Ijni-headers/${jniPlatform}"/> <arg value="-I."/> %headerDirs% <srcfile/> <arg value="-o"/> <targetfile/> <fileset refid="gcc-files"/> <compositemapper> <mapper type="glob" from="*.c" to="*.o"/> </compositemapper> </apply> </target> <!-- links the shared library based on the previously compiled object files --> <target name="link-x86_64" depends="compile-x86_64"> <fileset dir="${buildDir}" id="objFileSet"> <patternset> <include name="**/*.o" /> </patternset> </fileset> <pathconvert pathsep=" " property="objFiles" refid="objFileSet" /> <mkdir dir="${libsDir}" /> <exec executable="${linker}" failonerror="true" dir="${buildDir}"> <arg line="${linker-opts}" /> <arg path="${libsDir}/${libName}.x86_64" /> <arg line="${objFiles}"/> <arg line="${libraries}" /> </exec> </target> <!-- compiles all C and C++ files to object files in the build directory, for armv7 builds--> <target name="compile-arm" depends="create-build-dir"> <mkdir dir="${buildDir}"/> <antcall target="clean-objfiles"/> <apply failonerror="true" executable="${g++}" dest="${buildDir}" verbose="true"> <arg line="-isysroot ${iphoneos-sdk} -arch armv7 -miphoneos-version-min=6.0 -fembed-bitcode ${g++-opts}"/> <arg value="-Ijni-headers"/> <arg value="-Ijni-headers/${jniPlatform}"/> <arg value="-I."/> %headerDirs% <srcfile/> <arg value="-o"/> <targetfile/> <fileset refid="g++-files"/> <compositemapper> <mapper type="glob" from="*.cpp" to="*.o"/> <mapper type="glob" from="*.mm" to="*.o"/> </compositemapper> </apply> <apply failonerror="true" executable="${gcc}" dest="${buildDir}" verbose="true"> <arg line="-isysroot ${iphoneos-sdk} -arch armv7 -miphoneos-version-min=6.0 -fembed-bitcode ${gcc-opts}"/> <arg value="-Ijni-headers"/> <arg value="-Ijni-headers/${jniPlatform}"/> <arg value="-I."/> %headerDirs% <srcfile/> <arg value="-o"/> <targetfile/> <fileset refid="gcc-files"/> <compositemapper> <mapper type="glob" from="*.c" to="*.o"/> </compositemapper> </apply> </target> <!-- links the shared library based on the previously compiled object files --> <target name="link-arm" depends="compile-arm"> <fileset dir="${buildDir}" id="objFileSet"> <patternset> <include name="**/*.o" /> </patternset> </fileset> <pathconvert pathsep=" " property="objFiles" refid="objFileSet" /> <mkdir dir="${libsDir}" /> <exec executable="${linker}" failonerror="true" dir="${buildDir}"> <arg line="${linker-opts}" /> <arg path="${libsDir}/${libName}.armv7" /> <arg line="${objFiles}"/> <arg line="${libraries}" /> </exec> </target> <!-- compiles all C and C++ files to object files in the build directory, for arm64 builds--> <target name="compile-arm64" depends="create-build-dir,clean-objfiles"> <mkdir dir="${buildDir}"/> <antcall target="clean-objfiles"/> <apply failonerror="true" executable="${g++}" dest="${buildDir}" verbose="true"> <arg line="-isysroot ${iphoneos-sdk} -arch arm64 -miphoneos-version-min=6.0 -fembed-bitcode ${g++-opts}"/> <arg value="-Ijni-headers"/> <arg value="-Ijni-headers/${jniPlatform}"/> <arg value="-I."/> %headerDirs% <srcfile/> <arg value="-o"/> <targetfile/> <fileset refid="g++-files"/> <compositemapper> <mapper type="glob" from="*.cpp" to="*.o"/> <mapper type="glob" from="*.mm" to="*.o"/> </compositemapper> </apply> <apply failonerror="true" executable="${gcc}" dest="${buildDir}" verbose="true"> <arg line="-isysroot ${iphoneos-sdk} -arch arm64 -miphoneos-version-min=6.0 -fembed-bitcode ${gcc-opts}"/> <arg value="-Ijni-headers"/> <arg value="-Ijni-headers/${jniPlatform}"/> <arg value="-I."/> %headerDirs% <srcfile/> <arg value="-o"/> <targetfile/> <fileset refid="gcc-files"/> <compositemapper> <mapper type="glob" from="*.c" to="*.o"/> </compositemapper> </apply> </target> <!-- links the shared library based on the previously compiled object files --> <target name="link-arm64" depends="compile-arm64"> <fileset dir="${buildDir}" id="objFileSet"> <patternset> <include name="**/*.o" /> </patternset> </fileset> <pathconvert pathsep=" " property="objFiles" refid="objFileSet" /> <mkdir dir="${libsDir}" /> <exec executable="${linker}" failonerror="true" dir="${buildDir}"> <arg line="${linker-opts}" /> <arg path="${libsDir}/${libName}.arm64" /> <arg line="${objFiles}"/> <arg line="${libraries}" /> </exec> </target> <!-- compiles all C and C++ files to object files in the build directory, for tvOS x86_64 builds--> <target name="compile-tvos-x86_64" depends="create-build-dir"> <mkdir dir="${buildDir}"/> <antcall target="clean-objfiles"/> <apply failonerror="true" executable="${g++}" dest="${buildDir}" verbose="true"> <arg line="-isysroot ${tvossimulator-sdk} -arch x86_64 -mtvos-version-min=9.0 ${g++-opts}"/> <arg value="-Ijni-headers"/> <arg value="-Ijni-headers/${jniPlatform}"/> <arg value="-I."/> %headerDirs% <srcfile/> <arg value="-o"/> <targetfile/> <fileset refid="g++-files"/> <compositemapper> <mapper type="glob" from="*.cpp" to="*.o"/> <mapper type="glob" from="*.mm" to="*.o"/> </compositemapper> </apply> <apply failonerror="true" executable="${gcc}" dest="${buildDir}" verbose="true"> <arg line="-isysroot ${tvossimulator-sdk} -arch x86_64 -mtvos-version-min=9.0 ${gcc-opts}"/> <arg value="-Ijni-headers"/> <arg value="-Ijni-headers/${jniPlatform}"/> <arg value="-I."/> %headerDirs% <srcfile/> <arg value="-o"/> <targetfile/> <fileset refid="gcc-files"/> <compositemapper> <mapper type="glob" from="*.c" to="*.o"/> </compositemapper> </apply> </target> <!-- links the shared library based on the previously compiled object files --> <target name="link-tvos-x86_64" depends="compile-tvos-x86_64"> <fileset dir="${buildDir}" id="objFileSet"> <patternset> <include name="**/*.o" /> </patternset> </fileset> <pathconvert pathsep=" " property="objFiles" refid="objFileSet" /> <mkdir dir="${libsDir}" /> <exec executable="${linker}" failonerror="true" dir="${buildDir}"> <arg line="${linker-opts}" /> <arg path="${libsDir}/${libName}.tvos.x86_64" /> <arg line="${objFiles}"/> <arg line="${libraries}" /> </exec> </target> <!-- compiles all C and C++ files to object files in the build directory, for tvOS arm64 builds--> <target name="compile-tvos-arm64" depends="create-build-dir,clean-objfiles"> <mkdir dir="${buildDir}"/> <antcall target="clean-objfiles"/> <apply failonerror="true" executable="${g++}" dest="${buildDir}" verbose="true"> <arg line="-isysroot ${tvos-sdk} -arch arm64 -mtvos-version-min=9.0 -fembed-bitcode ${g++-opts}"/> <arg value="-Ijni-headers"/> <arg value="-Ijni-headers/${jniPlatform}"/> <arg value="-I."/> %headerDirs% <srcfile/> <arg value="-o"/> <targetfile/> <fileset refid="g++-files"/> <compositemapper> <mapper type="glob" from="*.cpp" to="*.o"/> <mapper type="glob" from="*.mm" to="*.o"/> </compositemapper> </apply> <apply failonerror="true" executable="${gcc}" dest="${buildDir}" verbose="true"> <arg line="-isysroot ${tvos-sdk} -arch arm64 -mtvos-version-min=9.0 -fembed-bitcode ${gcc-opts}"/> <arg value="-Ijni-headers"/> <arg value="-Ijni-headers/${jniPlatform}"/> <arg value="-I."/> %headerDirs% <srcfile/> <arg value="-o"/> <targetfile/> <fileset refid="gcc-files"/> <compositemapper> <mapper type="glob" from="*.c" to="*.o"/> </compositemapper> </apply> </target> <!-- links the shared library based on the previously compiled object files --> <target name="link-tvos-arm64" depends="compile-tvos-arm64"> <fileset dir="${buildDir}" id="objFileSet"> <patternset> <include name="**/*.o" /> </patternset> </fileset> <pathconvert pathsep=" " property="objFiles" refid="objFileSet" /> <mkdir dir="${libsDir}" /> <exec executable="${linker}" failonerror="true" dir="${buildDir}"> <arg line="${linker-opts}" /> <arg path="${libsDir}/${libName}.tvos.arm64" /> <arg line="${objFiles}"/> <arg line="${libraries}" /> </exec> </target> <target name="link-fat"> <exec executable="lipo" failonerror="true" dir="${libsDir}"> <arg line="-create -output ${libName} ${libName}.386 ${libName}.x86_64 ${libName}.armv7 ${libName}.arm64"/> </exec> <exec executable="lipo" failonerror="true" dir="${libsDir}"> <arg line="-create -output ${libName}.tvos ${libName}.tvos.x86_64 ${libName}.tvos.arm64"/> </exec> </target> <target name="postcompile" depends="link-386,link-x86_64,link-arm,link-arm64,link-tvos-x86_64,link-tvos-arm64,link-fat"> %postcompile% </target> </project>