summaryrefslogtreecommitdiffstats
path: root/make/build.xml
diff options
context:
space:
mode:
Diffstat (limited to 'make/build.xml')
-rwxr-xr-xmake/build.xml755
1 files changed, 755 insertions, 0 deletions
diff --git a/make/build.xml b/make/build.xml
new file mode 100755
index 0000000..e04f629
--- /dev/null
+++ b/make/build.xml
@@ -0,0 +1,755 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ - Ant build for JOAL. This build has been tested with ANT 1.6.2. The
+ - optional.jar that contains the optional ANT tasks must be in the ANT
+ - classpath (typically the ant/lib directory).
+ -
+ - A clean download of JOAL is required for this build.
+ -
+ - This build has no dependence on environment variables; the needed
+ - ones (e.g. java.home, ANT_HOME) are all set by the Ant wrapper shell
+ - script, by the virtual machine, or elsewhere. However, on all platforms,
+ - the C compiler and linker should be in the path. All other paths that
+ - need to be set are in host.properties.
+ -
+ - NOTE: because the GlueGen config files have their own relative paths
+ - which cannot be overridden by GlueGen, GlueGen MUST be run from
+ - the "make" directory. This also means that this build.xml MUST
+ - be run from the "make" directory.
+ -
+ - All targets do the following:
+ - Build the ancillary Ant tasks.
+ - Generate the Java and C files.
+ - Compile all sources.
+ - Create the joal.jar and platform library.
+ - Public targets:
+ - linux
+ - macosx
+ - solaris
+ - win32.vc6
+ - win32.vc7
+ - win32.mingw: build everything (jar, DSOs) for the current platform
+ - clean: clean all built
+ - javadoc: create the standard developer Javadoc
+ -
+ - Optional properties:
+ - -Djoal.cg=1 when combined with the build or javadoc targets will cause
+ - the experimental binding to NVidia's Cg language to be built.
+ -
+ - Thanks to Rob Grzywinski and Artur Biesiadowski for the bulk of the
+ - ANT build, including the GlueGen and StaticGLInfo tasks, the building of
+ - the Java generated sources, the first and second phase Java compiles, and
+ - the building of the jar file.
+ -->
+<project name="JOAL" basedir="." default="all">
+
+ <!-- ================================================================== -->
+ <!--
+ - Base initialization and detection of operating system.
+ -->
+ <target name="base.init">
+ <!-- Set the project root directory to be up one directory. -->
+ <property name="project.root" value=".." />
+
+ <!-- Set the configuration and build files to this directory. -->
+ <property name="make" value="." />
+
+ <!-- Detection of operating system. -->
+ <condition property="isOSX">
+ <and>
+ <os family="mac"/>
+ <os family="unix"/>
+ </and>
+ </condition>
+ <condition property="isUnix">
+ <and>
+ <os family="unix" />
+ <not>
+ <os family="mac" />
+ </not>
+ </and>
+ </condition>
+ <condition property="isLinux">
+ <os name="Linux" />
+ </condition>
+ <condition property="isSolaris">
+ <os name="SunOS" />
+ </condition>
+ <condition property="isWindows">
+ <os family="windows" />
+ </condition>
+ <condition property="isFreeBSD">
+ <os name="FreeBSD" />
+ </condition>
+ <condition property="isLinuxAMD64">
+ <and>
+ <istrue value="${isLinux}" />
+ <os arch="AMD64" />
+ </and>
+ </condition>
+ <condition property="isIA64">
+ <os arch="IA64" />
+ </condition>
+ <echo message="OS X=${isOSX}" />
+ <echo message="Windows=${isWindows}" />
+ <echo message="Unix=${isUnix}" />
+ <echo message="Linux=${isLinux}" />
+ <echo message="Solaris=${isSolaris}" />
+ <echo message="FreeBSD=${isFreeBSD}" />
+ <echo message="LinuxAMD64=${isLinuxAMD64}" />
+ <echo message="IA64=${isIA64}" />
+ </target>
+
+ <!-- ================================================================== -->
+ <!--
+ - Load user properties which override build defaults.
+ -->
+ <target name="load.user.properties" depends="base.init">
+ <!-- Load the user specified properties file that defines various host
+ - specific paths. The user will be notified if this is does not
+ - exist. -->
+ <property name="user.properties.file" value="${user.home}/joal.properties" />
+ <property file="${user.properties.file}" />
+ <echo message="Loaded ${user.properties.file}." />
+ <echo message="antlr.jar=${antlr.jar}" />
+ <fail message="antlr.jar was not specified in joal.properties. Please see README.txt for instructions" unless="antlr.jar"/>
+ <fail message="joal.lib.dir was not specified in joal.properties. Please see README.txt for instructions" unless="joal.lib.dir"/>
+ <condition property="isVC6">
+ <and>
+ <istrue value="${isWindows}" />
+ <equals arg1="${win32.c.compiler}" arg2="vc6" />
+ </and>
+ </condition>
+ <condition property="isVC7">
+ <and>
+ <istrue value="${isWindows}" />
+ <equals arg1="${win32.c.compiler}" arg2="vc7" />
+ </and>
+ </condition>
+ <condition property="isMingw">
+ <and>
+ <istrue value="${isWindows}" />
+ <equals arg1="${win32.c.compiler}" arg2="mingw" />
+ </and>
+ </condition>
+ <echo message="VC6=${isVC6}" />
+ <echo message="VC7=${isVC7}" />
+ <echo message="MingW=${isMingw}" />
+ </target>
+
+ <!-- ================================================================== -->
+ <!--
+ - Set up java.home.dir appropriately on all platforms.
+ -->
+ <target name="setup.java.home.dir.nonmacosx" depends="load.user.properties" unless="isOSX">
+ <!-- java home dir is up one directory as java.home points to '<java-install-dir>/jre' -->
+ <property name="java.home.dir" value="${java.home}/.." />
+ </target>
+ <target name="setup.java.home.dir.macosx" depends="load.user.properties" if="isOSX">
+ <property name="java.home.dir" value="/System/Library/Frameworks/JavaVM.framework/Home" />
+ </target>
+ <target name="setup.java.home.dir" depends="setup.java.home.dir.nonmacosx,setup.java.home.dir.macosx"/>
+
+ <!-- ================================================================== -->
+ <!--
+ - Declare all paths and user defined variables.
+ -->
+ <target name="declare.common" description="Declare properties" depends="base.init">
+ <!-- Shorthand for file.separator -->
+ <property name="sep" value="${file.separator}" />
+
+ <!-- The location and name of the configuration ANT file that will
+ - validate to ensure that all user-define variables are set. -->
+ <property name="validate.user.properties" value="${make}/validate-properties.xml" />
+
+ <!-- Properties pointing to root of the workspace containing GlueGen.
+ This build.xml expects that GlueGen has already been built and that its
+ classes are in the build/classes subdirectory of this other workspace.
+ Currently we expect that it is contained in the JOGL project. -->
+ <property name="jogl.root" value="../../jogl" />
+ <property name="gluegen.classes" value="${jogl.root}/build/classes" />
+
+ <!-- Names of directories relative to the project root.
+ Some of these are used in FileMappers later for dependence information
+ and need exact string matching, which is why they use file.separator
+ instead of "/". -->
+ <property name="rootrel.src" value="src" />
+ <property name="rootrel.src.java" value="${rootrel.src}${sep}java" />
+ <property name="rootrel.src.c" value="${rootrel.src}${sep}native" />
+ <property name="rootrel.build" value="build" />
+ <property name="rootrel.src.generated" value="${rootrel.build}${sep}gensrc" />
+ <property name="rootrel.generated.java" value="${rootrel.src.generated}${sep}classes" />
+ <property name="rootrel.generated.c.joal" value="${rootrel.src.generated}${sep}native${sep}joal" />
+ <property name="rootrel.obj" value="${rootrel.build}${sep}obj" />
+ <property name="rootrel.obj.joal" value="${rootrel.obj}${sep}joal" />
+
+ <!-- The source directories. -->
+ <property name="src" value="${project.root}/${rootrel.src}" />
+ <property name="src.c" value="${project.root}/${rootrel.src.c}" />
+ <property name="src.java" value="${project.root}/${rootrel.src.java}" />
+ <property name="build" value="${project.root}/${rootrel.build}" />
+
+ <!-- The generated source directories. -->
+ <property name="src.generated" value="${build}/gensrc" />
+ <property name="src.generated.java" value="${src.generated}/classes" />
+ <property name="src.generated.c" value="${src.generated}/native/joal" />
+
+ <!-- The compiler output directories. -->
+ <property name="classes" value="${build}/classes" />
+ <property name="obj" value="${project.root}/${rootrel.obj}" />
+ <property name="obj.joal" value="${project.root}/${rootrel.obj.joal}" />
+
+ <!-- The headers from which Java files are generated -->
+ <property name="config" value="${project.root}/make" />
+ <property name="stub.includes" value="${config}/stub_includes" />
+ <property name="stub.includes.dir" value="stub_includes" /> <!-- NOTE: this MUST be relative for FileSet -->
+ <property name="stub.includes.openal" value="${stub.includes}/openal" />
+ <dirset id="stub.includes.fileset.all" dir=".">
+ <include name="${stub.includes.dir}/openal/**" />
+ </dirset>
+ <fileset id="stub.includes.dependencies.fileset" dir=".">
+ <include name="${stub.includes.dir}/openal/**" />
+ <include name="*.cfg" />
+ <include name="*.java" />
+ <include name="*.c" />
+ </fileset>
+
+ <property name="java.includes.dir" value="${java.home.dir}/include" /> <!-- NOTE: this MUST be relative for FileSet -->
+ <property name="java.includes.dir.win32" value="${java.includes.dir}/win32" />
+ <property name="java.includes.dir.linux" value="${java.includes.dir}/linux" />
+ <property name="java.includes.dir.solaris" value="${java.includes.dir}/solaris" />
+ <property name="java.includes.dir.macosx" value="/System/Library/Frameworks/JavaVM.framework/Versions/CurrentJDK/Headers" />
+
+ <!-- Create the classpath that includes ANTLR and any already
+ - compiled classes. This requires the user-defined "antlr.jar"
+ - property. -->
+ <path id="antlr.classpath">
+ <pathelement path="${classpath}" />
+ <pathelement location="${gluegen.classes}" />
+ <pathelement location="${classes}" />
+ <pathelement location="${antlr.jar}" />
+ </path>
+
+ <!-- The resulting joal.jar. -->
+ <property name="joal.jar" value="${build}/joal.jar" />
+
+ <!-- The javadoc dirs. -->
+ <property name="javadoc" value="${project.root}/javadoc_public" />
+ <property name="javadoc.dev" value="${project.root}/javadoc_joal_dev" />
+ <property name="javadoc.link" value="http://java.sun.com/j2se/1.4.2/docs/api/" />
+ <property name="javadoc.packagenames" value="net.java.games.joal,net.java.games.joal.util" />
+ <property name="javadoc.dev.packagenames" value="${javadoc.packagenames},net.java.games.joal.impl" />
+
+ <!-- Names of configuration files used during glue code generation. -->
+ <property name="joal.cfg" value="${config}/joal.cfg" />
+ <property name="joal.constants.cfg" value="${config}/joal-constants.cfg" />
+ <property name="joal.alc.cfg" value="${config}/joal-alc.cfg" />
+ <property name="joal.alc.constants.cfg" value="${config}/joal-alc-constants.cfg" />
+ </target>
+
+ <!-- ================================================================== -->
+ <!--
+ - Platform specific declares.
+ -->
+ <target name="declare.win32.vc6" if="isVC6">
+ <echo message="Win32.VC6" />
+ <property name="c.compiler.include.root" value="${vc6.root}" />
+ <property name="c.linker.lib.root" value="${vc6.root}" />
+
+ <property name="compiler.cfg.id" value="compiler.cfg.win32.msvc" />
+ <property name="linker.cfg.id" value="linker.cfg.win32.msvc" />
+ </target>
+
+ <target name="declare.win32.vc7" if="isVC7">
+ <echo message="Win32.VC7" />
+ <property name="c.compiler.include.root" value="${vc7.root}" />
+ <property name="c.linker.lib.root" value="${vc7.root}" />
+
+ <property name="compiler.cfg.id" value="compiler.cfg.win32.msvc" />
+ <property name="linker.cfg.id" value="linker.cfg.win32.msvc" />
+ </target>
+
+ <target name="declare.win32.mingw" if="isMingw">
+ <echo message="Win32.MingW" />
+ <property name="compiler.cfg.id" value="compiler.cfg.win32.mingw" />
+ <property name="linker.cfg.id" value="linker.cfg.win32.mingw" />
+ </target>
+
+ <target name="declare.win32" depends="declare.win32.vc6,declare.win32.vc7,declare.win32.mingw" if="isWindows">
+ <property name="java.includes.dir.platform" value="${java.includes.dir.win32}" />
+ <property name="java.lib.dir.platform" value="${java.lib.dir.win32}" />
+ </target>
+
+ <target name="declare.linux.x86" if="isLinux" unless="isLinuxAMD64">
+ <echo message="Linux.x86" />
+ <property name="java.includes.dir.platform" value="${java.includes.dir.linux}" />
+ <property name="java.lib.dir.platform" value="${java.lib.dir.linux}" />
+
+ <property name="compiler.cfg.id" value="compiler.cfg.linux" />
+ <property name="linker.cfg.id" value="linker.cfg.linux" />
+ </target>
+
+ <target name="declare.linux.amd64" if="isLinuxAMD64">
+ <echo message="Linux.AMD64" />
+ <property name="java.includes.dir.platform" value="${java.includes.dir.linux}" />
+ <property name="java.lib.dir.platform" value="${java.lib.dir.linux.amd64}" />
+
+ <property name="compiler.cfg.id" value="compiler.cfg.linux.amd64" />
+ <property name="linker.cfg.id" value="linker.cfg.linux.amd64" />
+ </target>
+
+ <target name="declare.linux" depends="declare.linux.x86,declare.linux.amd64" if="isLinux" />
+
+ <target name="declare.solaris" if="isSolaris">
+ <echo message="Solaris" />
+ <property name="java.includes.dir.platform" value="${java.includes.dir.solaris}" />
+ <property name="java.lib.dir.platform" value="${java.lib.dir.solaris}" />
+
+ <property name="compiler.cfg.id" value="compiler.cfg.solaris" />
+ <property name="linker.cfg.id" value="linker.cfg.solaris" />
+ </target>
+
+ <target name="declare.macosx" if="isOSX">
+ <echo message="MacOSX" />
+ <property name="java.includes.dir.platform" value="${java.includes.dir.macosx}" />
+ <property name="java.lib.dir.platform" value="${java.lib.dir.macosx}" />
+
+ <property name="compiler.cfg.id" value="compiler.cfg.macosx" />
+ <property name="linker.cfg.id" value="linker.cfg.macosx" />
+ </target>
+
+ <target name="declare.freebsd" if="isFreeBSD">
+ <echo message="FreeBSD" />
+ <property name="java.includes.dir.platform" value="${java.includes.dir.freebsd}" />
+ <property name="java.lib.dir.platform" value="${java.lib.dir.linux}" />
+
+ <property name="compiler.cfg.id" value="compiler.cfg.freebsd" />
+ <property name="linker.cfg.id" value="linker.cfg.linux" />
+ </target>
+
+ <!-- ================================================================== -->
+ <!--
+ - Initialize all parameters required for the build and create any
+ - required directories.
+ -->
+ <target name="init" depends="declare.common">
+ <!-- Call the external config validator script to make sure the config is ok and consistent -->
+ <ant antfile="${validate.user.properties}" inheritall="true"/>
+
+ <!-- Create the required output directories. -->
+ <mkdir dir="${src.generated.java}" />
+ <mkdir dir="${src.generated.c}" />
+ <mkdir dir="${classes}" />
+ <mkdir dir="${obj}" />
+ <mkdir dir="${obj.joal}" />
+ </target>
+
+ <target name="declare" depends="init,declare.win32,declare.linux,declare.solaris,declare.macosx,declare.freebsd" />
+
+ <!-- ================================================================== -->
+ <!-- Java file generation -->
+ <!--
+ - Check to see whether we need to rebuild the generated sources.
+ -->
+
+ <target name="java.generate.check">
+ <!-- Blow away all target files if any dependencies are violated
+ (the uptodate task doesn't allow arbitrary source and target filesets but should) -->
+ <dependset>
+ <srcfileset refid="stub.includes.dependencies.fileset" />
+ <srcfileset dir=".">
+ <include name="${classes}/net/java/games/gluegen/**/*.class" />
+ </srcfileset>
+ <targetfileset dir=".">
+ <include name="${src.generated.java}/**/*.java" />
+ <include name="${src.generated.c}/**/*.c" />
+ </targetfileset>
+ </dependset>
+
+ <!-- Now check for the presence of one well-known file -->
+ <uptodate property="java.generate.skip">
+ <srcfiles refid="stub.includes.dependencies.fileset" />
+ <mapper type="merge" to="${src.generated.java}/net/java/games/joal/AL.java" />
+ </uptodate>
+ </target>
+
+ <!--
+ - Setup the generating ANT tasks and use it to generate the Java files
+ - from the C GL headers. This involves setting the taskdef and creating
+ - the classpath reference id then running the task on each header.
+ -->
+ <target name="java.generate" depends="java.generate.check" unless="java.generate.skip">
+ <!-- Add the GlueGen task to ANT -->
+ <taskdef name="gluegen" classname="com.sun.gluegen.ant.GlueGenTask"
+ classpathref="antlr.classpath" />
+
+ <!-- Use the GlueGen task to generate the Java files -->
+
+ <!-- Generate the AL interface class and implementation -->
+ <gluegen src="${stub.includes.openal}/al.h"
+ config="${joal.cfg}"
+ includeRefid="stub.includes.fileset.all"
+ emitter="com.sun.gluegen.procaddress.ProcAddressEmitter">
+ <classpath refid="antlr.classpath" />
+ </gluegen>
+
+ <!-- Generate the ALConstants interface class -->
+ <gluegen src="${stub.includes.openal}/al.h"
+ config="${joal.constants.cfg}"
+ includeRefid="stub.includes.fileset.all"
+ emitter="com.sun.gluegen.JavaEmitter">
+ <classpath refid="antlr.classpath" />
+ </gluegen>
+
+ <!-- Generate the ALC interface class and implementation -->
+ <gluegen src="${stub.includes.openal}/alc.h"
+ config="${joal.alc.cfg}"
+ includeRefid="stub.includes.fileset.all"
+ emitter="com.sun.gluegen.procaddress.ProcAddressEmitter">
+ <classpath refid="antlr.classpath" />
+ </gluegen>
+
+ <!-- Generate the ALCConstants interface class -->
+ <gluegen src="${stub.includes.openal}/alc.h"
+ config="${joal.alc.constants.cfg}"
+ includeRefid="stub.includes.fileset.all"
+ emitter="com.sun.gluegen.JavaEmitter">
+ <classpath refid="antlr.classpath" />
+ </gluegen>
+
+ <!-- Inform the user that the generators have successfully created
+ - the necessary Java files -->
+ <echo message="" />
+ <echo message="GlueGen has successfully generated files." />
+
+ </target>
+
+ <!-- ================================================================== -->
+ <!--
+ - Compile the original and generated source.
+ -->
+ <target name="java.compile" depends="java.generate">
+ <javac destdir="${classes}" source="1.4" debug="true" debuglevel="source,lines">
+ <src path="${src.java}" />
+ <src path="${src.generated.java}" />
+ <classpath refid="antlr.classpath" />
+ </javac>
+ </target>
+
+ <!-- ================================================================== -->
+ <!--
+ - Compile the native C code for JOAL.
+ -->
+
+ <target name="c.configure">
+
+ <!-- import cpptasks -->
+ <typedef resource="net/sf/antcontrib/cpptasks/antlib.xml" classpath="${jogl.root}/make/lib/cpptasks.jar"/>
+ <!--typedef resource="net/sf/antcontrib/cpptasks/antlib.xml"/-->
+
+ <!-- compiler configuration -->
+ <compiler id="compiler.cfg.linux" name="gcc" />
+
+ <compiler id="compiler.cfg.linux.amd64" name="gcc">
+ <compilerarg value="-fPIC"/>
+ </compiler>
+
+ <compiler id="compiler.cfg.solaris" name="suncc">
+ </compiler>
+
+ <compiler id="compiler.cfg.win32.mingw" name="gcc">
+ <defineset>
+ <define name="_DEBUG" if="c.compiler.use-debug"/>
+ <define name="DEBUG" if="c.compiler.use-debug"/>
+ <define name="NDEBUG" unless="c.compiler.use-debug"/>
+
+ <define name="DBUILD_DLL" />
+ <define name="_WINGDI_" />
+ <define name="_STRICT_ANSI" />
+ <define name="_JNI_IMPLEMENTATION_" />
+ </defineset>
+ </compiler>
+
+ <compiler id="compiler.cfg.win32.msvc" name="msvc">
+ <compilerarg value="/W3"/> <!-- set warning level -->
+ <compilerarg value="/Ob1"/> <!-- inline only functions marked inline -->
+ <compilerarg value="/GF"/> <!-- enable string pooling -->
+ <compilerarg value="/Gy"/> <!-- enable function level linking -->
+ <compilerarg value="/GS" if="isVC7"/> <!-- buffer security checks -->
+ <compilerarg value="/Wp64" if="isVC7"/> <!-- detect 64-bit port problems -->
+ <compilerarg value="/RTCcsu" if="isVC7"/> <!-- various runtime checks -->
+ <!-- Note: previous compiler options for VC7 were:
+ Debug: /MDd /Yd /GS /RTCs /RTCu /RTCc /W3 /Od /GF /EHsc /Zi /GS /Gy /Wp64 /Zi /D &quot;_DEBUG&quot;
+ Optimized: /MD /W3 /O2 /Ob1 /GF /EHsc /GS /Gy /Wp64 /D &quot;NDEBUG&quot; -->
+
+ <sysincludepath path="${c.compiler.include.root}/PlatformSDK/Include"/>
+ <sysincludepath path="${c.compiler.include.root}/include"/>
+
+ <defineset>
+ <define name="_DEBUG" if="c.compiler.use-debug"/>
+ <define name="DEBUG" if="c.compiler.use-debug"/>
+ <define name="NDEBUG" unless="c.compiler.use-debug"/>
+ </defineset>
+ </compiler>
+
+ <compiler id="compiler.cfg.macosx" name="gcc">
+ <compilerarg value="-arch" if="macosxfat"/>
+ <compilerarg value="ppc" if="macosxfat"/>
+ <compilerarg value="-arch" if="macosxfat"/>
+ <compilerarg value="i386" if="macosxfat"/>
+ <compilerarg value="-Wmost" />
+ <compilerarg value="-ObjC" />
+ <defineset>
+ <define name="macosx" />
+ </defineset>
+ </compiler>
+
+ <compiler id="compiler.cfg.freebsd" name="gcc">
+ <includepath path="/usr/X11R6/include" />
+ </compiler>
+
+ <!-- linker configuration -->
+
+ <linker id="linker.cfg.linux" name="gcc">
+ <syslibset dir="${joal.lib.dir}" libs="openal"/>
+ </linker>
+
+ <linker id="linker.cfg.linux.amd64" name="gcc">
+ <syslibset dir="${joal.lib.dir}" libs="openal"/>
+ </linker>
+
+ <linker id="linker.cfg.solaris" name="suncc">
+ <syslibset dir="${joal.lib.dir}" libs="openal"/>
+ </linker>
+
+ <linker id="linker.cfg.win32.mingw" name="gcc" incremental="false">
+ <linkerarg value="-Wl,--kill-at" /> <!-- remove @ from function names -->
+ <syslibset dir="${joal.lib.dir}" libs="openal32, kernel32"/>
+ </linker>
+
+ <linker id="linker.cfg.win32.msvc" name="msvc" incremental="false">
+ <linkerarg value="/OPT:REF,ICF" /> <!-- enable link-time optimisations -->
+ <linkerarg value="/SUBSYSTEM:WINDOWS" /> <!-- output is not a console app as uses WinMain entry point -->
+ <linkerarg value="/MACHINE:IX86" /> <!-- explicity set target platform -->
+
+ <syslibset dir="${joal.lib.dir}" libs="openal32" />
+ <syslibset dir="${c.linker.lib.root}/lib" libs="kernel32" unless="isVC7"/>
+ <syslibset dir="${c.linker.lib.root}/PlatformSDK/lib" libs="kernel32" if="isVC7"/>
+ </linker>
+
+ <linker id="linker.cfg.macosx" name="gcc">
+ <linkerarg value="-arch" if="macosxfat"/>
+ <linkerarg value="ppc" if="macosxfat"/>
+ <linkerarg value="-arch" if="macosxfat"/>
+ <linkerarg value="i386" if="macosxfat"/>
+ <linkerarg value="-framework" />
+ <linkerarg value="Cocoa" />
+ <linkerarg value="-framework" />
+ <linkerarg value="OpenGL" />
+ <linkerarg value="-framework" if="c.compiler.use-cglib" />
+ <linkerarg value="Cg" if="c.compiler.use-cglib" />
+ </linker>
+
+ <patternset id="c.src.files.joal">
+ <include name="${rootrel.src.c}/*.c"/>
+ <include name="${rootrel.generated.c.joal}/*.c"/>
+ </patternset>
+
+ </target>
+
+ <target name="c.build" depends="c.configure">
+ <fail message="Requires '${c.compiler.src.files}'" unless="c.compiler.src.files"/>
+ <fail message="Requires '${compiler.cfg.id}'" unless="compiler.cfg.id"/>
+ <fail message="Requires '${linker.cfg.id}'" unless="linker.cfg.id"/>
+ <fail message="Requires '${output.lib.name}'" unless="output.lib.name"/>
+
+ <echo message="Output lib name = ${output.lib.name}" />
+
+ <!-- NOTE: the value of the debug and optimise attributes will not be overridden if already set externally -->
+ <property name="c.compiler.debug" value="false" />
+ <!-- Optimise flags one of { none, size, speed, minimal, full, aggressive, extreme, unsafe } -->
+ <property name="c.compiler.optimise" value="none" />
+
+ <condition property="c.compiler.use-debug"><istrue value="${c.compiler.debug}"/></condition>
+
+ <cc outtype="shared"
+ objdir="${obj.joal}"
+ outfile="${obj}/${output.lib.name}"
+ optimize="${c.compiler.optimise}"
+ debug="${c.compiler.debug}"
+ multithreaded="true"
+ exceptions="false"
+ rtti="false">
+
+ <!-- TODO: versioninfo companyname="java.net"
+ legalcopyright="Copyright"
+ productname="JOAL"
+ productversion="x.y.z"
+ description="Description"
+ fileversion="x.y.z"
+ filecomments="File Comment" /-->
+
+ <fileset dir="${project.root}"><patternset refid="${c.compiler.src.files}"/></fileset>
+
+ <compiler extends="${compiler.cfg.id}" >
+ <sysincludepath path="${java.includes.dir}"/>
+ <sysincludepath path="${java.includes.dir.platform}"/>
+ <includepath path="stub_includes/openal"/>
+ </compiler>
+
+ <linker extends="${linker.cfg.id}" />
+ </cc>
+ </target>
+
+ <target name="c.rename.joal.lib.mingw" if="isMingw">
+ <!-- FIXME: this is a hack; the cpptask should have an option to change the
+ suffix or at least understand the override from .so to .dll -->
+ <move file="${obj}/libjoal.so" tofile="${obj}/joal.dll" failonerror="false" />
+ </target>
+
+ <target name="c.rename.joal.lib.macosx" if="isOSX">
+ <!-- FIXME: this is a hack; the cpptask should have an option to change the
+ suffix or at least understand the override from dylib to jnilib -->
+ <move file="${obj}/libjoal.dylib" tofile="${obj}/libjoal.jnilib" />
+ </target>
+
+ <target name="c.build.joal">
+ <antcall target="c.build" inheritRefs="true">
+ <param name="c.compiler.src.files" value="c.src.files.joal"/>
+ <param name="output.lib.name" value="joal_native"/>
+ </antcall>
+ <antcall target="c.rename.joal.lib.mingw" inheritRefs="true" />
+ <antcall target="c.rename.joal.lib.macosx" inheritRefs="true" />
+ </target>
+
+ <!-- ================================================================== -->
+ <!--
+ - Build the joal.jar file.
+ -->
+ <target name="jar" depends="java.compile">
+ <!-- Build the jar excluding any build specific classes. -->
+ <jar destfile="${joal.jar}">
+ <fileset dir="${classes}">
+ <include name="net/java/games/**" />
+ </fileset>
+ <fileset dir="${gluegen.classes}">
+ <include name="com/sun/gluegen/runtime/**" />
+ </fileset>
+ </jar>
+
+ </target>
+
+ <!-- ================================================================== -->
+ <!--
+ - Build the Javadocs for the sources.
+ - NOTE: these are not entirely correct as the javadocs targets depend
+ - on the platform specific build targets. To circumvent any
+ - errors, ensure that the source is built first.
+ -->
+ <target name="javadoc" depends="setup.java.home.dir,init">
+ <javadoc packagenames="${javadoc.packagenames}"
+ sourcepath="${src.java};${src.generated.java}"
+ classpath="${gluegen.classes}"
+ destdir="${javadoc}" windowtitle="JOAL API"
+ source="1.4"
+ link="${javadoc.link}" />
+ </target>
+
+ <target name="javadoc.dev" depends="init">
+ <!-- Build the internal developer Javadoc -->
+ <javadoc packagenames="${javadoc.dev.packagenames},${javadoc.dev.packagenames.platform}"
+ sourcepath="${src.java};${src.generated.java}"
+ destdir="${javadoc.dev}" windowtitle="JOAL API"
+ source="1.4"
+ link="${javadoc.link}" />
+ </target>
+
+ <!-- ================================================================== -->
+ <!--
+ - Build the platform-independent distribution out of jars built for
+ - Windows, Linux and Mac OS X; the Java sources for Joal can't be
+ - fully cross-compiled at this time. To run this target, you need to
+ - specify the property joal.dist.dir as a System property (i.e.,
+ - "ant -Djoal.dist.dir=../dist dist"); directories named joal-linux,
+ - joal-win32, and joal-macosx need to be inside that directory and each
+ - of those directories needs to contain both the joal.jar for that
+ - platform as well as the native code (libjoal.so, joal.dll, or
+ - libjoal.jnilib). Also builds jars containing the native code for
+ - Windows, Linux, Mac OS X, Solaris/SPARC and Solaris/x86.
+ -->
+ <target name="dist.check" unless="joal.dist.dir">
+ <fail>
+
+ ******************************************************************
+ ** To build the Joal distribution out of the platform-specific **
+ ** component jars and native code, the property joal.dist.dir **
+ ** needs to be specified on the command line. Please read the **
+ ** comments associated with the "dist" target in the build.xml. **
+ ******************************************************************
+ </fail>
+ </target>
+
+ <target name="dist" depends="dist.check">
+ <delete file="${joal.dist.dir}/joal.jar" />
+ <delete>
+ <fileset dir="${joal.dist.dir}" includes="joal-natives-*.jar" />
+ </delete>
+ <jar destfile="${joal.dist.dir}/joal.jar" duplicate="preserve">
+ <zipgroupfileset dir="${joal.dist.dir}"
+ includes="joal-win32/*.jar, joal-linux/*.jar, joal-macosx/*.jar" />
+ </jar>
+ <jar destfile="${joal.dist.dir}/joal-natives-win32.jar"
+ basedir="${joal.dist.dir}/joal-win32"
+ includes="joal.dll" />
+ <jar destfile="${joal.dist.dir}/joal-natives-linux.jar"
+ basedir="${joal.dist.dir}/joal-linux"
+ includes="libjoal.so" />
+ <jar destfile="${joal.dist.dir}/joal-natives-macosx.jar"
+ basedir="${joal.dist.dir}/joal-macosx"
+ includes="libjoal.jnilib" />
+ <jar destfile="${joal.dist.dir}/joal-natives-solsparc.jar"
+ basedir="${joal.dist.dir}/joal-solsparc"
+ includes="libjoal.so" />
+ <!-- Note: Solaris/x86 elided for now as it requires Mesa to
+ be installed -->
+ <!-- jar destfile="${joal.dist.dir}/joal-natives-solx86.jar"
+ basedir="${joal.dist.dir}/joal-solx86"
+ includes="libjoal.so" -->
+ </target>
+
+ <!-- ================================================================== -->
+ <!--
+ - Clean up all that is built.
+ -->
+ <target name="clean" depends="declare.common">
+ <delete includeEmptyDirs="true" quiet="true">
+ <fileset dir="${build}" />
+ <fileset dir="${javadoc}" />
+ <fileset dir="${javadoc.dev}" />
+ </delete>
+ <ant dir="../unit_tests" target="clean"/>
+ </target>
+
+ <!-- ================================================================== -->
+ <!--
+ - Build everything.
+ -->
+ <target name="all" depends="setup.java.home.dir,init,declare">
+ <!-- Generate, compile, and build the jar for the Java sources. -->
+ <antcall target="jar" inheritRefs="true" />
+
+ <!-- Compile the native C sources . -->
+ <antcall target="c.build.joal" inheritRefs="true" />
+ </target>
+
+ <!-- ================================================================== -->
+ <!--
+ - Build and run tests.
+ -->
+
+ <target name="runtests" depends="all">
+ <ant dir="../unit_tests" target="compile"/>
+ <ant dir="../unit_tests" target="runOpenALTest"/>
+ <ant dir="../unit_tests" target="runSound3DTest"/>
+ </target>
+</project>