Skip to content

Commit

Permalink
[added] new build files.
Browse files Browse the repository at this point in the history
  • Loading branch information
badlogicgames committed Dec 27, 2011
1 parent 6b42e89 commit e45bf7f
Show file tree
Hide file tree
Showing 2 changed files with 162 additions and 0 deletions.
71 changes: 71 additions & 0 deletions build-new.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
<project name="gdx" default="all" basedir=".">
<description>libgdx distribution build file</description>
<property environment="env" />

<!-- define distribution/output directory -->
<property name="distDir" value="${basedir}/dist"/>

<!-- clean distribution/output directory -->
<target name="clean">
<delete dir="${distDir}"/>
</target>

<!-- gdx core -->
<target name="gdx-core">
<ant antfile="../build-template.xml" dir="gdx">
<property name="jar" value="gdx"/>
</ant>
</target>

<!-- gdx openal, for all desktop backends -->
<target name="gdx-openal" depends="gdx-core">
<path id="classpath">
<pathelement location="${distDir}/gdx.jar"/>
</path>
<ant antfile="../../build-template.xml" dir="backends/gdx-openal">
<property name="jar" value="gdx-openal"/>
<reference refid="classpath"/>
</ant>
</target>

<!-- gdx jogl backend -->
<target name="gdx-backend-jogl" depends="gdx-core,gdx-openal">
<path id="classpath">
<pathelement location="${distDir}/gdx.jar"/>
<pathelement location="${distDir}/gdx-openal.jar"/>
</path>
<zipfileset id="jarfiles" src="${distDir}/gdx-openal.jar"/>
<ant antfile="../../build-template.xml" dir="backends/gdx-backend-jogl">
<property name="jar" value="gdx-backend-jogl"/>
<reference refid="classpath"/>
<reference refid="jarfiles"/>
</ant>
</target>

<!-- gdx lwjgl backend -->
<target name="gdx-backend-lwjgl" depends="gdx-core,gdx-openal">
<path id="classpath">
<pathelement location="${distDir}/gdx.jar"/>
<pathelement location="${distDir}/gdx-openal.jar"/>
</path>
<zipfileset id="jarfiles" src="${distDir}/gdx-openal.jar"/>
<ant antfile="../../build-template.xml" dir="backends/gdx-backend-lwjgl">
<property name="jar" value="gdx-backend-lwjgl"/>
<reference refid="classpath"/>
<reference refid="jarfiles"/>
</ant>
</target>

<!-- gdx android backend -->
<target name="gdx-backend-android" depends="gdx-core">
<path id="classpath">
<pathelement location="${distDir}/gdx.jar"/>
</path>
<ant antfile="../../build-template.xml" dir="backends/gdx-backend-android">
<property name="jar" value="gdx-backend-android"/>
<reference refid="classpath"/>
</ant>
</target>

<target name="all" depends="clean,gdx-core,gdx-openal,gdx-backend-jogl,gdx-backend-lwjgl,gdx-backend-android"/>
</project>
91 changes: 91 additions & 0 deletions build-template.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
<!--
template Ant build file for all projects that should go into the distribution.
Fill out the properties at the beginning of the project definition.
The following things have to be set from the outside:
property name="jar" value="jar-name-without-suffix" -> the name of the resulting jar file
property name="distDir" value="dist-directory" -> the output directory for the resulting jar
path id="classpath" -> the filesets defining the classpath needed to compile the project
zipfileset id="jarfiles" -> the jar files to be merged with the project's classes
-->
<project name="template" default="all" basedir=".">
<property environment="env" />

<!-- default values -->
<property name="src" value="src"/>
<property name="jni" value="jni"/>
<property name="target" value="target" />
<property name="libs" value="libs" />
<path id="classpath"/>
<zipfileset id="jarfiles" dir="." excludes="**"/>

<!-- clean output directories -->
<target name="clean">
<delete dir="${target}" />
</target>

<!-- init task, creates all necessary directories -->
<target name="init" depends="clean">
<mkdir dir="${target}" />
<!-- need to copy the internal font to target if compiling the gdx core :/ -->
<copy failonerror="false" tofile="${target}/com/badlogic/gdx/utils/arial-15.png" file="src/com/badlogic/gdx/utils/arial-15.png" />
<copy failonerror="false" tofile="${target}/com/badlogic/gdx/utils/arial-15.fnt" file="src/com/badlogic/gdx/utils/arial-15.fnt" />
</target>

<!-- compiles the java code -->
<target name="compile" depends="init">
<javac debug="on" srcdir="${src}" destdir="${target}">
<classpath>
<path refid="classpath"/>
<fileset file="${libs}/*.jar">
<exclude name="*-natives.jar"/>
</fileset>
</classpath>
</javac>
</target>


<!-- compile native code if available -->
<target name="check-natives">
<available file="${jni}/build.xml" property="natives-present"/>
</target>
<target name="compile-natives" depends="init, check-natives" if="natives-present">
<ant antfile="build.xml" target="clean" dir="${jni}"/>
<ant antfile="build.xml" target="all" dir="${jni}"/>
</target>

<!-- create source and class jar -->
<target name="all" depends="compile,compile-natives">
<!-- source jar -->
<jar destfile="${distDir}/sources/${jar}-sources.jar" basedir="${src}" />

<!-- class jar -->
<jar destfile="${distDir}/${jar}.jar">
<fileset dir="${target}" />
<!-- merge dependencies found in libs/ folder, exclude native, debug and android jars -->
<zipgroupfileset file="${libs}/*.jar">
<exclude name="*-natives.jar"/>
<exclude name="*-debug.jar"/>
<exclude name="android-*.jar"/>
</zipgroupfileset>
<!-- merge dependencies specified in parent build.xml -->
<zipfileset refid="jarfiles"/>
</jar>

<!-- optional natives jar for desktop -->
<copy failonerror="false" file="${libs}/${jar}-natives.jar" tofile="${distDir}/${jar}-natives.jar"/>

<!-- optional shared libraries for android -->
<copy failonerror="false" todir="${distDir}/armeabi">
<fileset dir="${libs}/armeabi">
<include name="**/*.so"/>
</fileset>
</copy>
<copy failonerror="false" todir="${distDir}/armeabi-v7a">
<fileset dir="${libs}/armeabi-v7a">
<include name="**/*.so"/>
</fileset>
</copy>
</target>
</project>

0 comments on commit e45bf7f

Please sign in to comment.