lwjgl/build.xml

618 lines
22 KiB
XML

<project name="LWJGL" default="all" basedir=".">
<property name="build.sysclasspath" value="last" />
<import file="platform_build/build-definitions.xml"/>
<import file="platform_build/build-generator.xml"/>
<import file="platform_build/build-maven.xml"/>
<!-- ================================================================== -->
<!-- Everything below this line is targets. -->
<!-- Do not modify, unless you know what you're doing -->
<!-- ================================================================== -->
<!-- ================================================================== -->
<!-- Initialize build -->
<!-- ================================================================== -->
<target name="-initialize">
<mkdir dir="${lwjgl.target.bundle}" taskname="initialiazing bundle folder" />
<mkdir dir="${lwjgl.target.natives}" taskname="initialiazing native libs folder" />
<mkdir dir="${lwjgl.target.jars}" taskname="initialiazing java libs folder" />
</target>
<!-- Cleans up any files created during the execution of this script -->
<target name="clean" description="Cleans all directories controlled by this ant script">
<delete dir="${lwjgl.target}" quiet="true" failonerror="false" taskname="cleaning target folder" />
</target>
<!-- Creates a distribution of LWJGL -->
<target name="release" description="Creates a distribution of LWJGL using supplied native binaries">
<input
message="All data in the ${lwjgl.target} folder will be deleted. Continue? "
validargs="yes,no"
addproperty="do.delete"
/>
<condition property="do.abort">
<equals arg1="no" arg2="${do.delete}"/>
</condition>
<fail if="do.abort">Build aborted by user.</fail>
<!-- prepare -->
<antcall target="clean" />
<antcall target="-initialize" />
<!-- compile and create debug jars -->
<antcall target="generate-debug" />
<antcall target="compile" />
<antcall target="-createdebugjars" />
<!-- compile and create jars -->
<antcall target="generate-all" />
<antcall target="compile" />
<antcall target="-createjars" />
<antcall target="javadoc" />
<!-- copy resources to res folder -->
<copy todir="${lwjgl.target.staging}/res">
<fileset dir="res"/>
</copy>
<!-- copy docs -->
<copy todir="${lwjgl.target.staging}/doc">
<fileset dir="${lwjgl.target.doc}">
<patternset refid="lwjgl-docs.fileset" />
</fileset>
</copy>
<!-- create distribution from files in libs/ and temp/ -->
<antcall target="-distribution_javadoc" />
<antcall target="-distribution_source" />
<antcall target="-distribute" />
</target>
<target name="all" description="Creates the Java archives and the natives for the current platform">
<parallel>
<antcall target="jars" />
<antcall target="compile_native" />
</parallel>
</target>
<target name="jars+lwjgl+NoDeps" depends="-initialize">
<jar destfile="${lwjgl.target.jars}/lwjgl.jar" taskname="lwjgl.jar">
<fileset refid="lwjgl.fileset" />
<fileset refid="lwjgl.fileset.dependencies"/>
<manifest>
<attribute name="Sealed" value="true"/>
</manifest>
</jar>
</target>
<target name="jars+lwjgl_util+NoDeps" depends="-initialize">
<jar destfile="${lwjgl.target.jars}/lwjgl_util.jar" taskname="lwjgl_util.jar">
<fileset refid="lwjgl_util.fileset" />
</jar>
</target>
<target name="jars+lwjgl_test+NoDeps" depends="-initialize">
<jar destfile="${lwjgl.target.jars}/lwjgl_test.jar" taskname="lwjgl_test.jar">
<fileset refid="lwjgl_test.fileset" />
<fileset refid="lwjgl_test_extra.fileset" />
</jar>
</target>
<!-- Create ONLY the jar archives -->
<target name="jars+NoDeps" description="Creates the Java archives ONLY and places them in libs/" depends="-initialize">
<parallel>
<antcall target="jars+lwjgl+NoDeps" />
<antcall target="jars+lwjgl_util+NoDeps" />
<antcall target="jars+lwjgl_test+NoDeps" />
</parallel>
</target>
<target name="jars" description="Creates the Java archives ONLY and places them in libs/" depends="generate-all, compile, jars+NoDeps">
</target>
<!-- Create ONLY the jar archives for the ES build -->
<target name="jars_es" description="Creates the Java archives ONLY for the ES build and places them in libs/"
depends="-initialize, generate-all, compile, -createjars_es">
</target>
<!-- Packages the java files -->
<target name="-createdebugjars" depends="-initialize">
<!-- Create lwjgl.jar -->
<jar destfile="${lwjgl.target.staging}/jar/lwjgl-debug.jar" taskname="lwjgl-debug.jar">
<fileset refid="lwjgl.fileset" />
<fileset refid="lwjgl.fileset.dependencies"/>
<manifest>
<attribute name="Sealed" value="true"/>
</manifest>
</jar>
</target>
<!-- Packages the java files for the ES build -->
<target name="-createjars_es">
<!-- ================================================================== -->
<!-- Generate a list of the OpenGL extension classes -->
<!-- ================================================================== -->
<fileset id="opengl-template-fileset" dir="${lwjgl.target.gen.java}/org/lwjgl/opengl" includes="${opengl-template-pattern}"/>
<property name="opengl-template-files" refid="opengl-template-fileset"/>
<tempfile property="temp.file"/>
<echo file="${temp.file}" message="${opengl-template-files}" taskname=""/>
<loadfile srcfile="${temp.file}" property="opengl-template-classes">
<filterchain>
<tokenfilter delimoutput=",">
<stringtokenizer delims=";"/>
<replaceregex pattern="(.+)[.]java"
replace="org/lwjgl/opengl/\1.class"/>
</tokenfilter>
</filterchain>
</loadfile>
<delete file="${temp.file}" />
<!-- Create lwjgl.jar -->
<jar destfile="${lwjgl.target.staging}/jar/lwjgl.jar" taskname="lwjgl.jar">
<!-- Files to include in the lwjgl.jar file, for the ES build -->
<fileset dir="${lwjgl.target.gen.classes}" excludes="${opengl-template-classes}">
<patternset id="lwjgl_es.package.pattern">
<include name="org/**/*"/>
<exclude name="org/lwjgl/d3d/**"/>
<exclude name="org/lwjgl/test/**"/>
<exclude name="org/lwjgl/util/**"/>
<exclude name="org/lwjgl/examples/**"/>
</patternset>
</fileset>
<manifest>
<attribute name="Sealed" value="true"/>
</manifest>
</jar>
<!-- Create lwjgl_test.jar -->
<jar destfile="${lwjgl.target.staging}/jar/lwjgl_test.jar" taskname="lwjgl_test.jar">
<fileset refid="lwjgl_test_es.fileset"/>
</jar>
</target>
<!-- Generates the native headers from source files -->
<!--<target name="headers" description="invokes javah on java classes" depends="compile">
<javac
srcdir="${lwjgl.src.java}"
source="1.8"
target="1.8"
fork="true"
taskname="headers">
<compilerarg value="-s"/>
<compilerarg path="${lwjgl.src.java}"/>
<compilerarg value="-h"/>
<compilerarg value="${lwjgl.src.native}/linux"/>
<src>
<fileset dir="${lwjgl.src.java}">
<include name="org/lwjgl/LinuxSysImplementation.java"/>
<include name="org/lwjgl/opengl/LinuxEvent.java"/>
<include name="org/lwjgl/opengl/LinuxMouse.java"/>
<include name="org/lwjgl/opengl/LinuxKeyboard.java"/>
<include name="org/lwjgl/opengl/LinuxDisplay.java"/>
<include name="org/lwjgl/opengl/LinuxPeerInfo.java"/>
</fileset>
</src>
</javac>
<javac
srcdir="${lwjgl.src.java}"
source="1.8"
target="1.8"
fork="true"
taskname="headers">
<compilerarg value="-cp"/>
<compilerarg path="${lwjgl.target.gen.classes}"/>
<compilerarg value="-h"/>
<compilerarg value="${lwjgl.src.native}/linux/opengl"/>
<src>
<fileset dir="${lwjgl.src.java}">
<include name="org/lwjgl/opengl/LinuxPbufferPeerInfo.java"/>
<include name="org/lwjgl/opengl/LinuxDisplayPeerInfo.java"/>
<include name="org/lwjgl/opengl/LinuxAWTGLCanvasPeerInfo.java"/>
<include name="org/lwjgl/opengl/LinuxContextImplementation.java"/>
<include name="org/lwjgl/opengl/LinuxCanvasImplementation.java"/>
</fileset>
</src>
</javac>
<javac
srcdir="${lwjgl.src.java}"
source="1.8"
target="1.8"
fork="true"
taskname="headers">
<compilerarg value="-cp"/>
<compilerarg path="${lwjgl.target.gen.classes}"/>
<compilerarg value="-h"/>
<compilerarg value="${lwjgl.src.native}/windows"/>
<src>
<fileset dir="${lwjgl.src.java}">
<include name="org/lwjgl/WindowsSysImplementation.java"/>
<include name="org/lwjgl/opengl/WindowsKeyboard.java"/>
<include name="org/lwjgl/opengl/WindowsRegistry.java"/>
<include name="org/lwjgl/opengl/WindowsDisplay.java"/>
<include name="org/lwjgl/opengl/WindowsDisplayPeerInfo.java"/>
<include name="org/lwjgl/opengl/WindowsAWTGLCanvasPeerInfo.java"/>
</fileset>
</src>
</javac>
<javac
srcdir="${lwjgl.src.java}"
source="1.8"
target="1.8"
fork="true"
taskname="headers">
<compilerarg value="-cp"/>
<compilerarg path="${lwjgl.target.gen.classes}"/>
<compilerarg value="-h"/>
<compilerarg value="${lwjgl.src.native}/windows/opengl"/>
<src>
<fileset dir="${lwjgl.src.java}">
<include name="org/lwjgl/opengl/WindowsPbufferPeerInfo.java"/>
<include name="org/lwjgl/opengl/WindowsPeerInfo.java"/>
<include name="org/lwjgl/opengl/WindowsContextImplementation.java"/>
</fileset>
</src>
</javac>
<javac
srcdir="${lwjgl.src.java}"
source="1.8"
target="1.8"
fork="true"
taskname="headers">
<compilerarg value="-cp"/>
<compilerarg path="${lwjgl.target.gen.classes}"/>
<compilerarg value="-h"/>
<compilerarg value="${lwjgl.src.native}/windows/opengles"/>
<src>
<fileset dir="${lwjgl.src.java}">
<include name="org/lwjgl/opengl/WindowsPeerInfo.java"/>
</fileset>
</src>
</javac>
<javac
srcdir="${lwjgl.src.java}"
source="1.8"
target="1.8"
fork="true"
taskname="headers">
<compilerarg value="-cp"/>
<compilerarg path="${lwjgl.target.gen.classes}"/>
<compilerarg value="-h"/>
<compilerarg value="${lwjgl.src.native}/macosx"/>
<src>
<fileset dir="${lwjgl.src.java}">
<include name="org/lwjgl/MacOSXSysImplementation.java"/>
<include name="org/lwjgl/opengl/MacOSXCanvasPeerInfo.java"/>
<include name="org/lwjgl/opengl/MacOSXPeerInfo.java"/>
<include name="org/lwjgl/opengl/MacOSXPbufferPeerInfo.java"/>
<include name="org/lwjgl/opengl/MacOSXDisplay.java"/>
<include name="org/lwjgl/opengl/MacOSXContextImplementation.java"/>
<include name="org/lwjgl/opengl/MacOSXNativeKeyboard.java"/>
<include name="org/lwjgl/opengl/MacOSXNativeMouse.java"/>
<include name="org/lwjgl/opengl/MacOSXMouseEventQueue.java"/>
</fileset>
</src>
</javac>
<javac
srcdir="${lwjgl.src.java}"
source="1.8"
target="1.8"
fork="true"
taskname="headers">
<compilerarg value="-cp"/>
<compilerarg path="${lwjgl.target.gen.classes}"/>
<compilerarg value="-h"/>
<compilerarg value="${lwjgl.target.gen.headers}"/>
<src>
<fileset dir="${lwjgl.src.java}">
<include name="org/lwjgl/opengl/AWTSurfaceLock.java"/>
<include name="org/lwjgl/DefaultSysImplementation.java"/>
<include name="org/lwjgl/input/Cursor.java"/>
<include name="org/lwjgl/input/Keyboard.java"/>
<include name="org/lwjgl/input/Mouse.java"/>
<include name="org/lwjgl/openal/AL.java"/>
<include name="org/lwjgl/opencl/CL.java"/>
<include name="org/lwjgl/opencl/CallbackUtil.java"/>
<include name="org/lwjgl/BufferUtils.java"/>
</fileset>
</src>
</javac>
<javac
srcdir="${lwjgl.src.java}"
source="1.8"
target="1.8"
fork="true"
taskname="headers">
<compilerarg value="-cp"/>
<compilerarg path="${lwjgl.target.gen.classes}"/>
<compilerarg value="-h"/>
<compilerarg value="${lwjgl.target.gen.headers}/opengl"/>
<src>
<fileset dir="${lwjgl.src.java}">
<include name="org/lwjgl/opengl/GLContext.java"/>
<include name="org/lwjgl/opengl/Pbuffer.java"/>
<include name="org/lwjgl/opengl/CallbackUtil.java"/>
<include name="org/lwjgl/opengl/NVPresentVideoUtil.java"/>
<include name="org/lwjgl/opengl/NVVideoCaptureUtil.java"/>
</fileset>
</src>
</javac>
<javac
srcdir="${lwjgl.src.java}"
source="1.8"
target="1.8"
fork="true"
taskname="headers">
<compilerarg value="-cp"/>
<compilerarg path="${lwjgl.target.gen.classes}"/>
<compilerarg value="-h"/>
<compilerarg value="${lwjgl.target.gen.headers}/opengles"/>
<src>
<fileset dir="${lwjgl.src.java}">
<include name="org/lwjgl/opengles/EGL.java"/>
<include name="org/lwjgl/opengles/EGLKHRFenceSync.java"/>
<include name="org/lwjgl/opengles/EGLKHRReusableSync.java"/>
<include name="org/lwjgl/opengles/EGLNVSync.java"/>
<include name="org/lwjgl/opengles/GLContext.java"/>
<include name="org/lwjgl/opengles/CallbackUtil.java"/>
</fileset>
</src>
</javac>
</target>-->
<target name="version-mismatch">
<loadfile srcfile="${lwjgl.src}/java/org/lwjgl/WindowsSysImplementation.java" property="lwjgl.java.windows.version">
<filterchain>
<tokenfilter>
<containsstring contains="JNI_VERSION ="/>
</tokenfilter>
</filterchain>
</loadfile>
<loadfile srcfile="${lwjgl.src}/java/org/lwjgl/LinuxSysImplementation.java" property="lwjgl.java.linux.version">
<filterchain>
<tokenfilter>
<containsstring contains="JNI_VERSION ="/>
</tokenfilter>
</filterchain>
</loadfile>
<loadfile srcfile="${lwjgl.src}/java/org/lwjgl/MacOSXSysImplementation.java" property="lwjgl.java.macosx.version">
<filterchain>
<tokenfilter>
<containsstring contains="JNI_VERSION ="/>
</tokenfilter>
</filterchain>
</loadfile>
<loadfile srcfile="${lwjgl.target.gen.headers}/org_lwjgl_WindowsSysImplementation.h" property="lwjgl.native.windows.version">
<filterchain>
<tokenfilter>
<containsstring contains="#define org_lwjgl_WindowsSysImplementation_JNI_VERSION"/>
</tokenfilter>
</filterchain>
</loadfile>
<loadfile srcfile="${lwjgl.target.gen.headers}/org_lwjgl_LinuxSysImplementation.h" property="lwjgl.native.linux.version">
<filterchain>
<tokenfilter>
<containsstring contains="#define org_lwjgl_LinuxSysImplementation_JNI_VERSION"/>
</tokenfilter>
</filterchain>
</loadfile>
<loadfile srcfile="${lwjgl.target.gen.headers}/org_lwjgl_MacOSXSysImplementation.h" property="lwjgl.native.macosx.version">
<filterchain>
<tokenfilter>
<containsstring contains="#define org_lwjgl_MacOSXSysImplementation_JNI_VERSION"/>
</tokenfilter>
</filterchain>
</loadfile>
<echo>
lwjgl.java.windows.version = ${lwjgl.java.windows.version}
lwjgl.native.windows.version = ${lwjgl.native.windows.version}
lwjgl.java.linux.version = ${lwjgl.java.linux.version}
lwjgl.native.linux.version = ${lwjgl.native.linux.version}
lwjgl.java.freebsd.version = ${lwjgl.java.linux.version}
lwjgl.native.freebsd.version = ${lwjgl.native.linux.version}
lwjgl.java.openbsd.version = ${lwjgl.java.linux.version}
lwjgl.native.openbsd.version = ${lwjgl.native.linux.version}
lwjgl.java.macosx.version = ${lwjgl.java.macosx.version}
lwjgl.native.macosx.version = ${lwjgl.native.macosx.version}
</echo>
</target>
<!-- Compiles the Java source code -->
<target name="compile+NoGen" description="Compiles the java source code" depends="-initialize">
<javac debug="yes" destdir="${lwjgl.target.gen.classes}" nativeHeaderDir="${lwjgl.target.gen.headers}" source="1.8" target="1.8" classpath="${lwjgl.lib}/jinput.jar:${lwjgl.lib}/AppleJavaExtensions.jar:${lwjgl.lib}/asm-debug-all.jar" taskname="core">
<compilerarg value="-Xlint:deprecation"/>
<compilerarg value="-Xlint:unchecked"/>
<compilerarg value="-sourcepath"/>
<compilerarg value="${lwjgl.src.stubs}"/>
<src path="${lwjgl.src.java}"/>
<src path="${lwjgl.target.gen.java}"/>
<exclude name="org/lwjgl/util/generator/**"/>
</javac>
</target>
<target name="compile" description="Compiles the java source code" depends="generate-all, compile+NoGen"/>
<target name="compile_native+NoGen" depends="-initialize" description="Compiles the native files">
<condition property="lwjgl.platform.windows">
<os family="windows" />
</condition>
<antcall target="-compile_native_win32" />
<condition property="lwjgl.platform.linux">
<os name="Linux" />
</condition>
<antcall target="-compile_native_linux" />
<condition property="lwjgl.platform.freebsd">
<os name="FreeBSD" />
</condition>
<antcall target="-compile_native_freebsd" />
<condition property="lwjgl.platform.openbsd">
<os name="OpenBSD" />
</condition>
<antcall target="-compile_native_openbsd" />
<condition property="lwjgl.platform.solaris">
<os name="SunOS" />
</condition>
<antcall target="-compile_native_solaris" />
<condition property="lwjgl.platform.macosx">
<os name="Mac OS X" />
</condition>
<antcall target="-compile_native_macosx" />
</target>
<target name="compile_native" description="Compiles the java source code" depends="generate-all, version-mismatch, compile_native+NoGen"/>
<!-- Compiles LWJGL on Win32 platforms -->
<target name="-compile_native_win32" if="lwjgl.platform.windows">
<ant antfile="platform_build/windows_ant/build.xml"/>
</target>
<!-- Compiles LWJGL on Linux platforms -->
<target name="-compile_native_linux" if="lwjgl.platform.linux">
<ant antfile="platform_build/linux_ant/build.xml"/>
</target>
<!-- Compiles LWJGL on FreeBSD platforms -->
<target name="-compile_native_freebsd" if="lwjgl.platform.freebsd">
<ant antfile="platform_build/bsd_ant/build.xml"/>
</target>
<!-- Compiles LWJGL on OpenBSD platforms -->
<target name="-compile_native_openbsd" if="lwjgl.platform.openbsd">
<ant antfile="platform_build/bsd_ant/build.xml"/>
</target>
<!-- Compiles LWJGL on solaris platforms -->
<target name="-compile_native_solaris" if="lwjgl.platform.solaris">
<!-- Reusing the linux ant task, but copy the output to solaris -->
<ant antfile="platform_build/linux_ant/build.xml"/>
</target>
<!-- Compiles LWJGL on Mac platforms -->
<target name="-compile_native_macosx" if="lwjgl.platform.macosx">
<ant antfile="platform_build/macosx_ant/build.xml"/>
</target>
<target name="compile_native_es" depends="-initialize, generate-all, version-mismatch" description="Compiles the native files">
<condition property="lwjgl.platform.windows">
<os family="windows"/>
</condition>
<antcall target="-compile_native_win32_es"/>
<condition property="lwjgl.platform.linux">
<os name="Linux"/>
</condition>
<antcall target="-compile_native_linux_es"/>
</target>
<!-- Compiles LWJGL ES on Win32 platforms -->
<target name="-compile_native_win32_es" if="lwjgl.platform.windows">
<ant antfile="platform_build/windows_ant/build_es.xml"/>
</target>
<!-- Compiles LWJGL ES on Linux platforms -->
<target name="-compile_native_linux_es" if="lwjgl.platform.linux">
<ant antfile="platform_build/linux_ant/build_es.xml"/>
</target>
<target name="repack200" description="Pack200-repack a jar file">
<pack200 src="${input}" destfile="${output}" repack="true"/>
</target>
<target name="pack200" description="Pack200 a jar file">
<pack200 src="${input}" destfile="${output}"/>
</target>
<target name="lzma" description="LZMA compress a file">
<java fork="true" classname="SevenZip.LzmaAlone">
<classpath>
<pathelement location="platform_build/JLzma.jar"/>
</classpath>
<jvmarg value="-Xmx512m"/>
<arg value="e"/>
<arg value="${input}"/>
<arg value="${output}"/>
</java>
</target>
<target name="compress-sign-class">
<antcall target="repack200">
<param name="input" value="${dir}${jarfile}.jar"/>
<param name="output" value="${dir}${jarfile}-repack.jar"/>
</antcall>
<signjar jar="${dir}${jarfile}-repack.jar" alias="${alias}" keystore="${keystore}" storepass="${password}"/>
<antcall target="pack200">
<param name="input" value="${dir}${jarfile}-repack.jar"/>
<param name="output" value="${dir}${jarfile}.jar.pack"/>
</antcall>
<antcall target="lzma">
<param name="input" value="${dir}${jarfile}.jar.pack"/>
<param name="output" value="${outputdir}${jarfile}.jar.pack.lzma"/>
</antcall>
<!--delete file="${dir}${jarfile}-repack.jar"/-->
<delete file="${dir}${jarfile}.jar.pack"/>
<!--delete file="${dir}${jarfile}.jar"/-->
<rename src="${dir}${jarfile}-repack.jar" dest="${dir}${jarfile}.jar" replace="yes"/>
</target>
<target name="compress-resource">
<antcall target="lzma">
<param name="input" value="${input}"/>
<param name="output" value="${output}"/>
</antcall>
</target>
<target name="runtest">
<fail message="test.mainclass is not set. Use 'ant -Dtest.mainclass=&lt;main-class&gt; runtest'" unless="test.mainclass"/>
<condition property="native_path" value="${lwjgl.target.natives}">
<os family="windows" />
</condition>
<condition property="native_path" value="${lwjgl.target.natives}">
<or>
<os name="Linux" />
<os name="SunOS" />
</or>
</condition>
<condition property="native_path" value="${lwjgl.target.natives}">
<os name="Mac OS X" />
</condition>
<property name="native_path_expanded" location="${native_path}"/>
<java classname="${test.mainclass}" classpath="res:${lwjgl.target.jars}/lwjgl.jar:${lwjgl.target.jars}/lwjgl_util.jar:${lwjgl.target.jars}/lwjgl_test.jar:${lwjgl.lib}/jinput.jar" fork="true">
<sysproperty key="org.lwjgl.util.Debug" value="true"/>
<sysproperty key="java.library.path" value="${native_path_expanded}"/>
<arg line="${args}"/>
</java>
</target>
<!-- Creates the Javadoc -->
<target name="javadoc" description="Creates javadoc from java source code">
<javadoc destdir="${lwjgl.target.doc}/javadoc" classpath="${lwjgl.lib}/jinput.jar" author="true" version="true" use="true" source="1.8" windowtitle="LWJGL API" useexternalfile="true">
<fileset refid="lwjgl.javadoc.fileset" />
<doctitle><![CDATA[<h1>Lightweight Java Game Toolkit</h1>]]></doctitle>
<bottom><![CDATA[<i>Copyright &#169; 2002-2009 lwjgl.org. All Rights Reserved.</i>]]></bottom>
</javadoc>
</target>
</project>