blob: 9d3958d6616c62de9c787329e3fb0fcda99d2b8b [file] [log] [blame]
<project name="gdx-freetype-Windows-64" basedir="." default="postcompile">
<!-- include the environment -->
<property environment="env"/>
<!-- output directory for temporary object files -->
<property name="buildDir" value="target/windows64" />
<!-- output directory for the shared library -->
<property name="libsDir" value="../libs/windows64" />
<!-- the name of the shared library -->
<property name="libName" value="gdx-freetype64.dll"/>
<!-- the jni header jniPlatform to use -->
<property name="jniPlatform" value="win32"/>
<!-- the compilerPrefix for the C & C++ compilers -->
<property name="compilerPrefix" value="x86_64-w64-mingw32-"/>
<!-- the compilerSuffix for the C & C++ compilers -->
<property name="compilerSuffix" value="" />
<!-- define gcc compiler, options and files to compile -->
<property name="gcc" value="${compilerPrefix}gcc${compilerSuffix}"/>
<property name="gcc-opts" value="-c -Wall -O2 -mfpmath=sse -msse2 -fmessage-length=0 -m64 -std=c99 -DFT2_BUILD_LIBRARY"/>
<fileset id="gcc-files" dir="./">
<exclude name="target/"/>
<include name="memcpy_wrap.c"/>
<include name="freetype-2.6.2/src/base/ftsystem.c"/>
<include name="freetype-2.6.2/src/base/ftinit.c"/>
<include name="freetype-2.6.2/src/base/ftdebug.c"/>
<include name="freetype-2.6.2/src/base/ftbase.c"/>
<include name="freetype-2.6.2/src/base/ftbbox.c"/>
<include name="freetype-2.6.2/src/base/ftglyph.c"/>
<include name="freetype-2.6.2/src/base/ftbdf.c"/>
<include name="freetype-2.6.2/src/base/ftbitmap.c"/>
<include name="freetype-2.6.2/src/base/ftcid.c"/>
<include name="freetype-2.6.2/src/base/ftfstype.c"/>
<include name="freetype-2.6.2/src/base/ftgasp.c"/>
<include name="freetype-2.6.2/src/base/ftgxval.c"/>
<include name="freetype-2.6.2/src/base/ftlcdfil.c"/>
<include name="freetype-2.6.2/src/base/ftmm.c"/>
<include name="freetype-2.6.2/src/base/ftotval.c"/>
<include name="freetype-2.6.2/src/base/ftpatent.c"/>
<include name="freetype-2.6.2/src/base/ftpfr.c"/>
<include name="freetype-2.6.2/src/base/ftstroke.c"/>
<include name="freetype-2.6.2/src/base/ftsynth.c"/>
<include name="freetype-2.6.2/src/base/fttype1.c"/>
<include name="freetype-2.6.2/src/base/ftwinfnt.c"/>
<include name="freetype-2.6.2/src/base/ftxf86.c"/>
<include name="freetype-2.6.2/src/bdf/bdf.c"/>
<include name="freetype-2.6.2/src/cff/cff.c"/>
<include name="freetype-2.6.2/src/cid/type1cid.c"/>
<include name="freetype-2.6.2/src/pcf/pcf.c"/>
<include name="freetype-2.6.2/src/pfr/pfr.c"/>
<include name="freetype-2.6.2/src/sfnt/sfnt.c"/>
<include name="freetype-2.6.2/src/truetype/truetype.c"/>
<include name="freetype-2.6.2/src/type1/type1.c"/>
<include name="freetype-2.6.2/src/type42/type42.c"/>
<include name="freetype-2.6.2/src/winfonts/winfnt.c"/>
<include name="freetype-2.6.2/src/raster/raster.c"/>
<include name="freetype-2.6.2/src/smooth/smooth.c"/>
<include name="freetype-2.6.2/src/autofit/autofit.c"/>
<include name="freetype-2.6.2/src/cache/ftcache.c"/>
<include name="freetype-2.6.2/src/gzip/ftgzip.c"/>
<include name="freetype-2.6.2/src/lzw/ftlzw.c"/>
<include name="freetype-2.6.2/src/bzip2/ftbzip2.c"/>
<include name="freetype-2.6.2/src/gxvalid/gxvalid.c"/>
<include name="freetype-2.6.2/src/otvalid/otvalid.c"/>
<include name="freetype-2.6.2/src/psaux/psaux.c"/>
<include name="freetype-2.6.2/src/pshinter/pshinter.c"/>
<include name="freetype-2.6.2/src/psnames/psnames.c"/>
</fileset>
<!-- define g++ compiler, options and files to compile -->
<property name="g++" value="${compilerPrefix}g++${compilerSuffix}"/>
<property name="g++-opts" value="-c -Wall -O2 -mfpmath=sse -msse2 -fmessage-length=0 -m64 -std=c99 -DFT2_BUILD_LIBRARY"/>
<fileset id="g++-files" dir="./">
<exclude name="target/"/>
<include name="**/*.cpp"/>
</fileset>
<!-- define linker and options -->
<property name="linker" value="${compilerPrefix}g++${compilerSuffix}"/>
<property name="linker-opts" value="-Wl,--kill-at -shared -static -static-libgcc -static-libstdc++ -m64"/>
<property name="libraries" value=""/>
<!-- 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="precompile">
<condition property="compiler-found">
<and>
<or>
<!-- Include both b/c Windows might be either -->
<available file="${g++}" filepath="${env.PATH}"/>
<available file="${g++}" filepath="${env.Path}"/>
</or>
<or>
<!-- Include both b/c Windows might be either -->
<available file="${gcc}" filepath="${env.PATH}"/>
<available file="${gcc}" filepath="${env.Path}"/>
</or>
</and>
</condition>
<condition property="has-compiler">
<equals arg1="${compiler-found}" arg2="true"/>
</condition>
</target>
<target name="create-build-dir" depends="precompile" if="has-compiler">
<!-- 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 -->
<target name="compile" depends="create-build-dir" if="has-compiler">
<mkdir dir="${buildDir}"/>
<apply failonerror="true" executable="${g++}" dest="${buildDir}" verbose="true">
<arg line="${g++-opts}"/>
<arg value="-Ijni-headers"/>
<arg value="-Ijni-headers/${jniPlatform}"/>
<arg value="-I."/>
<arg value="-Ifreetype-2.6.2/include"/>
<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="${gcc-opts}"/>
<arg value="-Ijni-headers"/>
<arg value="-Ijni-headers/${jniPlatform}"/>
<arg value="-I."/>
<arg value="-Ifreetype-2.6.2/include"/>
<srcfile/>
<arg value="-o"/>
<targetfile/>
<fileset refid="gcc-files"/>
<compositemapper>
<mapper type="glob" from="*.c" to="*.o"/>
<mapper type="glob" from="*.m" to="*.o"/>
</compositemapper>
</apply>
</target>
<!-- links the shared library based on the previously compiled object files -->
<target name="link" depends="compile" if="has-compiler">
<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 value="-o" />
<arg path="${libsDir}/${libName}" />
<arg line="${objFiles}"/>
<arg line="${libraries}" />
</exec>
</target>
<target name="postcompile" depends="link">
</target>
</project>