Skip to content

Instantly share code, notes, and snippets.

@GoranM
Created June 8, 2014 16:50
Show Gist options
  • Save GoranM/ba4aae5ca81b18d4e2bb to your computer and use it in GitHub Desktop.
Save GoranM/ba4aae5ca81b18d4e2bb to your computer and use it in GitHub Desktop.
Ant build file for libgdx 1.x.x desktop projects.
<project name="project" default="run">
<property name="verbose" value="no" />
<!-- Set the package property to what it should be, for your project -->
<property name="package" value="com.orgname.projname" />
<!-- On Linux, and at this time, this is the right path, but you might have to modify this -->
<property name="modules" value="${user.home}/.gradle/caches/modules-2/files-2.1" />
<!-- Everything below should just work -->
<property name="lwjgl.libs.absolute.dir" location="${modules}/org.lwjgl.lwjgl" />
<property name="root.dir" value=".." />
<property name="core.dir" value="${root.dir}/core" />
<property name="core.src.dir" value="${core.dir}/src"/>
<property name="core.libs.dir" value="${core.dir}/libs"/>
<property name="core.libs.absolute.dir" location="${core.libs.dir}" />
<property name="assets.dir" value="${root.dir}/android/assets"/>
<property name="assets.absolute.dir" location="${assets.dir}"/>
<property name="src.dir" value="src" />
<property name="src.absolute.dir" location="${src.dir}" />
<property name="libs.dir" value="${modules}/com.badlogicgames.gdx" />
<property name="libs.absolute.dir" location="${libs.dir}" />
<property name="out.dir" value="bin_ant" />
<property name="out.absolute.dir" location="${out.dir}" />
<property name="out.classes.absolute.dir" location="${out.dir}/classes" />
<target name="clean">
<delete dir="${out.dir}" verbose="${verbose}" />
</target>
<target name="init-build">
<mkdir dir="${out.dir}" />
<mkdir dir="${out.classes.absolute.dir}" />
</target>
<target name="compile" depends="init-build">
<path id="javac.classpath">
<fileset dir="${libs.absolute.dir}">
<include name="gdx/**/*.jar" />
<include name="gdx-backend-lwjgl/**/*.jar" />
<include name="gdx-platform/**/*desktop.jar" />
</fileset>
<fileset dir="${lwjgl.libs.absolute.dir}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${core.libs.absolute.dir}">
<include name="**/*.jar" />
</fileset>
</path>
<javac
srcdir="${src.dir}"
destdir="${out.classes.absolute.dir}"
classpathref="javac.classpath"
includeantruntime="false"
debug="on"
verbose="${verbose}">
<src path="${core.src.dir}" />
<src path="${assets.absolute.dir}" />
</javac>
</target>
<target name="run" depends="compile">
<path id="java.classpath">
<fileset dir="${libs.absolute.dir}">
<include name="gdx/**/*.jar" />
<include name="gdx-backend-lwjgl/**/*.jar" />
<include name="gdx-platform/**/*desktop.jar" />
</fileset>
<fileset dir="${lwjgl.libs.absolute.dir}">
<include name="**/*.jar" />
</fileset>
<fileset dir="${core.libs.absolute.dir}">
<include name="**/*.jar" />
</fileset>
<pathelement location="${assets.absolute.dir}" />
</path>
<java
fork="true"
classname="${package}.desktop.DesktopLauncher"
classpath="${out.classes.absolute.dir}"
classpathref="java.classpath"/>
</target>
</project>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment