1 <project name="gdx-Linux-64" 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/linux64" />
\r
6 <!-- output directory for the shared library -->
\r
7 <property name="libsDir" value="../libs/linux64" />
\r
8 <!-- the name of the shared library -->
\r
9 <property name="libName" value="libgdx64.so"/>
\r
10 <!-- the jni header jniPlatform to use -->
\r
11 <property name="jniPlatform" value="linux"/>
\r
12 <!-- the compilerPrefix for the C & C++ compilers -->
\r
13 <property name="compilerPrefix" value=""/>
\r
14 <!-- the compilerSuffix for the C & C++ compilers -->
\r
15 <property name="compilerSuffix" value="" />
\r
17 <!-- define gcc compiler, options and files to compile -->
\r
18 <property name="gcc" value="${compilerPrefix}gcc${compilerSuffix}"/>
\r
19 <property name="gcc-opts" value="-c -Wall -O2 -mfpmath=sse -msse -fmessage-length=0 -m64 -fPIC"/>
\r
20 <fileset id="gcc-files" dir="./">
\r
21 <exclude name="target/"/>
\r
22 <include name="memcpy_wrap.c"/>
23 <include name="**/*.c"/>
28 <!-- define g++ compiler, options and files to compile -->
\r
29 <property name="g++" value="${compilerPrefix}g++${compilerSuffix}"/>
\r
30 <property name="g++-opts" value="-c -Wall -O2 -mfpmath=sse -msse -fmessage-length=0 -m64 -fPIC"/>
\r
31 <fileset id="g++-files" dir="./">
\r
32 <exclude name="target/"/>
\r
33 <include name="**/*.cpp"/>
35 <exclude name="android/**"/>
36 <exclude name="iosgl/**"/>
40 <!-- define linker and options -->
\r
41 <property name="linker" value="${compilerPrefix}g++${compilerSuffix}"/>
\r
42 <property name="linker-opts" value="-shared -m64 -Wl,-wrap,memcpy"/>
\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="precompile">
\r
54 <condition property="compiler-found">
\r
57 <!-- Include both b/c Windows might be either -->
\r
58 <available file="${g++}" filepath="${env.PATH}"/>
\r
59 <available file="${g++}" filepath="${env.Path}"/>
\r
62 <!-- Include both b/c Windows might be either -->
\r
63 <available file="${gcc}" filepath="${env.PATH}"/>
\r
64 <available file="${gcc}" filepath="${env.Path}"/>
\r
68 <condition property="has-compiler">
\r
69 <equals arg1="${compiler-found}" arg2="true"/>
\r
74 <target name="create-build-dir" depends="precompile" if="has-compiler">
\r
75 <!-- FIXME this is pretty nasty :/ -->
\r
76 <copy todir="${buildDir}">
\r
77 <fileset refid="g++-files"/>
\r
78 <fileset refid="gcc-files"/>
\r
81 <fileset dir="${buildDir}">
\r
83 <exclude name="*.o"/>
\r
88 <!-- compiles all C and C++ files to object files in the build directory -->
\r
89 <target name="compile" depends="create-build-dir" if="has-compiler">
\r
90 <mkdir dir="${buildDir}"/>
\r
91 <apply failonerror="true" executable="${g++}" dest="${buildDir}" verbose="true">
\r
92 <arg line="${g++-opts}"/>
\r
93 <arg value="-Ijni-headers"/>
\r
94 <arg value="-Ijni-headers/${jniPlatform}"/>
\r
100 <fileset refid="g++-files"/>
\r
102 <mapper type="glob" from="*.cpp" to="*.o"/>
\r
103 <mapper type="glob" from="*.mm" to="*.o"/>
\r
106 <apply failonerror="true" executable="${gcc}" dest="${buildDir}" verbose="true">
\r
107 <arg line="${gcc-opts}"/>
\r
108 <arg value="-Ijni-headers"/>
\r
109 <arg value="-Ijni-headers/${jniPlatform}"/>
\r
115 <fileset refid="gcc-files"/>
\r
117 <mapper type="glob" from="*.c" to="*.o"/>
118 <mapper type="glob" from="*.m" to="*.o"/>
\r
123 <!-- links the shared library based on the previously compiled object files -->
\r
124 <target name="link" depends="compile" if="has-compiler">
\r
125 <fileset dir="${buildDir}" id="objFileSet">
\r
127 <include name="**/*.o" />
\r
130 <pathconvert pathsep=" " property="objFiles" refid="objFileSet" />
\r
131 <mkdir dir="${libsDir}" />
\r
132 <exec executable="${linker}" failonerror="true" dir="${buildDir}">
\r
133 <arg line="${linker-opts}" />
\r
135 <arg path="${libsDir}/${libName}" />
\r
136 <arg line="${objFiles}"/>
\r
137 <arg line="${libraries}" />
\r
141 <target name="postcompile" depends="link">
\r