1 <project name="gdx-bullet-MacOsX-64" basedir="." default="postcompile"> 2 <!-- include the environment --> 3 <property environment="env"/> 4 <!-- output directory for temporary object files --> 5 <property name="buildDir" value="target/macosx64" /> 6 <!-- output directory for the shared library --> 7 <property name="libsDir" value="../libs/macosx64" /> 8 <!-- the name of the shared library --> 9 <property name="libName" value="libgdx-bullet64.dylib"/> 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 <!-- the compilerSuffix for the C & C++ compilers --> 15 <property name="compilerSuffix" value="" /> 16 17 <!-- define gcc compiler, options and files to compile --> 18 <property name="gcc" value="${compilerPrefix}gcc${compilerSuffix}"/> 19 <property name="gcc-opts" value="-c -Wall -O2 -arch x86_64 -DFIXED_POINT -fmessage-length=0 -fPIC -mmacosx-version-min=10.5"/> 20 <fileset id="gcc-files" dir="./"> 21 <exclude name="target/"/> 22 <include name="memcpy_wrap.c"/> 23 <include name="**/*.c"/> 24 25 <exclude name="src/bullet/BulletMultiThreaded/GpuSoftBodySolvers/**"/> 26 27 </fileset> 28 29 <!-- define g++ compiler, options and files to compile --> 30 <property name="g++" value="${compilerPrefix}g++${compilerSuffix}"/> 31 <property name="g++-opts" value="-c -Wall -O2 -arch x86_64 -DFIXED_POINT -fmessage-length=0 -fPIC -mmacosx-version-min=10.5 -fno-strict-aliasing -fno-rtti -DBT_NO_PROFILE"/> 32 <fileset id="g++-files" dir="./"> 33 <exclude name="target/"/> 34 <include name="**/*.cpp"/> 35 36 37 </fileset> 38 39 <!-- define linker and options --> 40 <property name="linker" value="${compilerPrefix}g++${compilerSuffix}"/> 41 <property name="linker-opts" value="-shared -arch x86_64 -mmacosx-version-min=10.5"/> 42 <property name="libraries" value=""/> 43 44 <!-- cleans the build directory, removes all object files and shared libs --> 45 <target name="clean"> 46 <delete includeemptydirs="true" quiet="true"> 47 <fileset dir="${buildDir}"/> 48 <fileset dir="${libsDir}" includes="**/*" excludes="**/.svn"/> 49 </delete> 50 </target> 51 52 <target name="precompile"> 53 <condition property="compiler-found"> 54 <and> 55 <or> 56 <!-- Include both b/c Windows might be either --> 57 <available file="${g++}" filepath="${env.PATH}"/> 58 <available file="${g++}" filepath="${env.Path}"/> 59 </or> 60 <or> 61 <!-- Include both b/c Windows might be either --> 62 <available file="${gcc}" filepath="${env.PATH}"/> 63 <available file="${gcc}" filepath="${env.Path}"/> 64 </or> 65 </and> 66 </condition> 67 <condition property="has-compiler"> 68 <equals arg1="${compiler-found}" arg2="true"/> 69 </condition> 70 71 </target> 72 73 <target name="create-build-dir" depends="precompile" if="has-compiler"> 74 <!-- FIXME this is pretty nasty :/ --> 75 <copy todir="${buildDir}"> 76 <fileset refid="g++-files"/> 77 <fileset refid="gcc-files"/> 78 </copy> 79 <delete> 80 <fileset dir="${buildDir}"> 81 <include name="*"/> 82 <exclude name="*.o"/> 83 </fileset> 84 </delete> 85 </target> 86 87 <!-- compiles all C and C++ files to object files in the build directory --> 88 <target name="compile" depends="create-build-dir" if="has-compiler"> 89 <mkdir dir="${buildDir}"/> 90 <apply failonerror="true" executable="${g++}" dest="${buildDir}" verbose="true"> 91 <arg line="${g++-opts}"/> 92 <arg value="-Ijni-headers"/> 93 <arg value="-Ijni-headers/${jniPlatform}"/> 94 <arg value="-I."/> 95 <arg value="-Isrc/bullet/"/> 96 <arg value="-Isrc/custom/"/> 97 <arg value="-Isrc/extras/Serialize/"/> 98 99 <srcfile/> 100 <arg value="-o"/> 101 <targetfile/> 102 <fileset refid="g++-files"/> 103 <compositemapper> 104 <mapper type="glob" from="*.cpp" to="*.o"/> 105 <mapper type="glob" from="*.mm" to="*.o"/> 106 </compositemapper> 107 </apply> 108 <apply failonerror="true" executable="${gcc}" dest="${buildDir}" verbose="true"> 109 <arg line="${gcc-opts}"/> 110 <arg value="-Ijni-headers"/> 111 <arg value="-Ijni-headers/${jniPlatform}"/> 112 <arg value="-I."/> 113 <arg value="-Isrc/bullet/"/> 114 <arg value="-Isrc/custom/"/> 115 <arg value="-Isrc/extras/Serialize/"/> 116 117 <srcfile/> 118 <arg value="-o"/> 119 <targetfile/> 120 <fileset refid="gcc-files"/> 121 <compositemapper> 122 <mapper type="glob" from="*.c" to="*.o"/> 123 <mapper type="glob" from="*.m" to="*.o"/> 124 </compositemapper> 125 </apply> 126 </target> 127 128 <!-- links the shared library based on the previously compiled object files --> 129 <target name="link" depends="compile" if="has-compiler"> 130 <fileset dir="${buildDir}" id="objFileSet"> 131 <patternset> 132 <include name="**/*.o" /> 133 </patternset> 134 </fileset> 135 <pathconvert pathsep=" " property="objFiles" refid="objFileSet" /> 136 <mkdir dir="${libsDir}" /> 137 <exec executable="${linker}" failonerror="true" dir="${buildDir}"> 138 <arg line="${linker-opts}" /> 139 <arg value="-o" /> 140 <arg path="${libsDir}/${libName}" /> 141 <arg line="${objFiles}"/> 142 <arg line="${libraries}" /> 143 </exec> 144 </target> 145 146 <target name="postcompile" depends="link"> 147 148 </target> 149 </project> 150