<?xml version="1.0" encoding="UTF-8"?> <!-- - Ant build for JOGL. This build has been tested with ANT 1.5.3. The - optional.jar that contains the optional ANT tasks must be in the ANT - classpath (typically the ant/lib directory). - - A clean download of JOGL 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 jogl.jar and platform library. - Public targets: - linux - macosx - macosxfat (ppc & i386 - requires Intel Transition Development Kit or fat Mac OS X) - 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 - javadoc.dev.win32: - javadoc.dev.x11: - javadoc.dev.macosx: create the internal developer Javadoc. This includes the - Java and C file generators. Note that it is only supported - to create the Javadoc for the platform on which you are - currently running. - - Optional properties: - -Djogl.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. Thanks to Alex Radeski for the bulk of the - port to the ant-contrib CPPTask framework. --> <project name="JOGL" basedir="." default="all"> <!-- ================================================================== --> <!-- - Base initialization. --> <target name="base.init" > <condition property="os.isMacOSX"><os name="Mac OS X"/></condition> <!-- Set the project root directory to be up one directory. --> <property name="project.root" value="${basedir}/.." /> <!-- Set the configuration and build files to this directory. --> <property name="make" value="${basedir}" /> </target> <!-- ================================================================== --> <!-- - Load user properties which override build defaults. --> <target name="load.user.properties" depends="base.init" unless="user.properties.file"> <!-- 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}/jogl.properties" /> <property file="${user.properties.file}" /> <echo message="Loaded ${user.properties.file}." /> <echo message="antlr.jar=${antlr.jar}" /> </target> <target name="load.user.properties.macosx" depends="base.init" unless="user.properties.file"> <!-- 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}/jogl.properties" /> <property file="${user.properties.file}" /> <echo message="Loaded ${user.properties.file}." /> <echo message="antlr.jar=${antlr.jar}" /> </target> <!-- ================================================================== --> <!-- - Set up java.home.dir appropriately on all platforms. --> <target name="setup.java.home.dir.nonmacosx" depends="load.user.properties" unless="os.isMacOSX"> <!-- 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.macosx" if="os.isMacOSX"> <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" description="Declare properties" depends="setup.java.home.dir, 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" /> <!-- The GlueGen and BuildStaticGLInfo build files. --> <property name="gluegen.build.xml" value="${make}/build-gluegen.xml" /> <property name="static.gl.build.xml" value="${make}/build-staticglgen.xml" /> <!-- 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.java" value="src${sep}classes" /> <property name="rootrel.src.c.jogl" value="src${sep}native${sep}jogl" /> <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.jogl" value="${rootrel.src.generated}${sep}native${sep}jogl" /> <property name="rootrel.generated.c.cg" value="${rootrel.src.generated}${sep}native${sep}jogl_cg" /> <property name="rootrel.obj" value="${rootrel.build}${sep}obj" /> <property name="rootrel.obj.jogl" value="${rootrel.obj}${sep}jogl" /> <property name="rootrel.obj.cg" value="${rootrel.obj}${sep}jogl_cg" /> <!-- The source directories. --> <property name="src.java" value="${project.root}/${rootrel.src.java}" /> <property name="src.c" value="${project.root}/${rootrel.src.c}" /> <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.java.cg" value="${src.generated}/classes/com/sun/opengl/cg" /> <property name="src.generated.c" value="${src.generated}/native/jogl" /> <property name="src.generated.c.cg" value="${src.generated}/native/jogl_cg" /> <!-- The composable pipeline source files --> <property name="src.generated.java.pipeline" value="javax/media/opengl/DebugGL.java,javax/media/opengl/TraceGL.java" /> <!-- The compiler output directories. --> <property name="classes" value="${build}/classes" /> <property name="obj" value="${project.root}/${rootrel.obj}" /> <property name="obj.jogl" value="${project.root}/${rootrel.obj.jogl}" /> <property name="obj.cg" value="${project.root}/${rootrel.obj.cg}" /> <!-- The GL 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.x11" value="${stub.includes}/x11" /> <property name="stub.includes.opengl" value="${stub.includes}/opengl" /> <property name="stub.includes.common" value="${stub.includes}/common" /> <dirset id="stub.includes.fileset.all" dir="."> <include name="${stub.includes.dir}/opengl/**" /> <include name="${stub.includes.dir}/macosx/**" /> <include name="${stub.includes.dir}/win32/**" /> <include name="${stub.includes.dir}/x11/**" /> <include name="${stub.includes.dir}/common/**" /> </dirset> <fileset id="stub.includes.dependencies.fileset" dir="."> <include name="${stub.includes.dir}/opengl/**" /> <include name="${stub.includes.dir}/macosx/**" /> <include name="${stub.includes.dir}/win32/**" /> <include name="${stub.includes.dir}/x11/**" /> <include name="${stub.includes.dir}/common/**" /> <include name="*.cfg" /> <include name="gl*.java" /> <include name="*.c" /> <exclude name="cg-common.cfg" /> </fileset> <dirset id="stub.includes.cg.fileset.all" dir="."> <include name="${stub.includes.dir}/opengl/**" /> <include name="${stub.includes.dir}/cg/**" /> <include name="${stub.includes.dir}/macosx/**" /> <include name="${stub.includes.dir}/win32/**" /> <include name="${stub.includes.dir}/x11/**" /> <include name="${stub.includes.dir}/common/**" /> </dirset> <fileset id="stub.includes.cg.dependencies.fileset" dir="."> <include name="${stub.includes.dir}/cg/**" /> <include name="cg-common.cfg" /> <include name="cg-common-CustomJavaCode.java" /> </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" /> <property name="java.includes.dir.freebsd" value="${java.includes.dir}/freebsd" /> <property name="java.lib.dir.win32" value="${java.home.dir}/lib" /> <property name="java.lib.dir.linux" value="${java.home.dir}/jre/lib/i386" /> <property name="java.lib.dir.linux.amd64" value="${java.home.dir}/jre/lib/amd64" /> <property name="java.lib.dir.linux.ia64" value="${java.home.dir}/jre/lib/ia64" /> <condition property="cpu" value="sparc"> <os name="SunOS" arch="sparc" /> </condition> <condition property="cpu" value="i386"> <os name="SunOS" arch="x86" /> </condition> <property name="java.lib.dir.solaris" value="${java.home.dir}/jre/lib/${cpu}" /> <property name="java.lib.dir.macosx" value="/System/Library/Frameworks/JavaVM.framework/Libraries" /> <property name="gl.headers" value="${stub.includes.dir}/opengl/**/*.h" /> <!-- NOTE: this MUST be relative for FileSet --> <!-- CHECK: this may need to be pruned for each platform --> <!-- Java files to exclude based on platform (relative to "src.java") --> <property name="java.excludes.win32" value="com/sun/opengl/impl/x11/**, com/sun/opengl/impl/macosx/**" /> <property name="java.excludes.x11" value="com/sun/opengl/impl/windows/**, com/sun/opengl/impl/macosx/**" /> <property name="java.excludes.macosx" value="com/sun/opengl/impl/x11/**, com/sun/opengl/impl/windows/**" /> <!-- Create the classpath for that includes ANTLR and any already - compiled classes. This requires the user-defined "antlr.jar" - property. --> <path id="antlr.classpath"> <pathelement path="${classpath}" /> <pathelement path="${classes}" /> <pathelement location="${antlr.jar}" /> </path> <!-- The resulting jogl.jar. --> <property name="jogl.jar" value="${build}/jogl.jar" /> <!-- The javadoc dirs. --> <property name="javadoc" value="${project.root}/javadoc_public" /> <property name="javadoc.dev" value="${project.root}/javadoc_jogl_dev" /> <property name="javadoc.link" value="http://java.sun.com/j2se/1.4.2/docs/api/" /> <property name="javadoc.windowtitle" value="JOGL API -- JSR-231 Early Draft Review Specification" /> <property name="javadoc.packagenames" value="javax.media.opengl,javax.media.opengl.glu,com.sun.opengl.utils" /> <property name="javadoc.dev.packagenames.win32" value="com.sun.opengl.impl.windows" /> <property name="javadoc.dev.packagenames.x11" value="com.sun.opengl.impl.x11" /> <property name="javadoc.dev.packagenames.macosx" value="com.sun.opengl.impl.macosx" /> <property name="javadoc.dev.packagenames" value="javax.media.opengl,javax.media.opengl.glu,com.sun.opengl.impl,com.sun.opengl.utils,com.sun.gluegen,com.sun.gluegen.runtime" /> </target> <!-- ================================================================== --> <!-- - Platform specific declares. --> <target name="declare.win32" depends="init"> <!-- Set platform configuration files. --> <property name="gl.cfg" value="${config}/gl-win32.cfg" /> <property name="glext.platform.cfg" value="${config}/wglext.cfg" /> <property name="glu.cfg" value="${config}/glu-win32.cfg" /> <property name="jawt.cfg" value="${config}/jawt-win32.cfg" /> <property name="window.cfg" value="${config}/wingdi-win32.cfg" /> <!-- Set platform headers. --> <property name="glext.platform.header" value="${stub.includes.dir}/win32/wglext.c" /> <!-- Set platform directories. --> <property name="stub.includes.platform" value="${stub.includes}/win32" /> <property name="java.includes.dir.platform" value="${java.includes.dir.win32}" /> <property name="java.lib.dir.platform" value="${java.lib.dir.win32}" /> <property name="java.excludes.platform" value="${java.excludes.win32}" /> <property name="stub.includes.fileset.platform.params" value="${stub.includes.dir}/win32/** ${stub.includes.dir}/common/** ${stub.includes.dir}/opengl/**" /> <!-- Set Javadoc properties. --> <property name="javadoc.dev.packagenames.platform" value="${javadoc.dev.packagenames.win32}" /> </target> <target name="declare.win32.vc6" depends="declare.win32"> <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" depends="declare.win32"> <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" depends="declare.win32"> <property name="compiler.cfg.id" value="compiler.cfg.win32.mingw" /> <property name="linker.cfg.id" value="linker.cfg.win32.mingw" /> </target> <target name="declare.x11" depends="init"> <!-- Set platform configuration files. --> <property name="gl.cfg" value="${config}/gl-x11.cfg" /> <property name="glext.platform.cfg" value="${config}/glxext.cfg" /> <property name="glu.cfg" value="${config}/glu-x11.cfg" /> <property name="jawt.cfg" value="${config}/jawt-x11.cfg" /> <property name="window.cfg" value="${config}/glx-x11.cfg" /> <!-- Set platform headers. --> <property name="glext.platform.header" value="${stub.includes.dir}/x11/glxext.c" /> <!-- Set platform directories. --> <property name="stub.includes.platform" value="${stub.includes.x11}" /> <property name="java.excludes.platform" value="${java.excludes.x11}" /> <property name="stub.includes.fileset.platform.params" value="${stub.includes.dir}/opengl/** ${stub.includes.dir}/x11/** ${stub.includes.dir}/common/**" /> <!-- Set Javadoc properties. --> <property name="javadoc.dev.packagenames.platform" value="${javadoc.dev.packagenames.x11}" /> </target> <target name="declare.linux" depends="declare.x11"> <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" depends="declare.x11"> <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.ia64" depends="declare.x11"> <property name="java.includes.dir.platform" value="${java.includes.dir.linux}" /> <property name="java.lib.dir.platform" value="${java.lib.dir.linux.ia64}" /> <property name="compiler.cfg.id" value="compiler.cfg.linux" /> <property name="linker.cfg.id" value="linker.cfg.linux" /> </target> <target name="declare.freebsd" depends="declare.x11"> <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> <target name="declare.solaris" depends="declare.x11"> <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" depends="init"> <!-- Set platform configuration files. --> <property name="gl.cfg" value="${config}/gl-macosx.cfg" /> <property name="glext.platform.cfg" value="${config}/cglext.cfg" /> <property name="glu.cfg" value="${config}/glu-macosx.cfg" /> <property name="jawt.cfg" value="${config}/jawt-macosx.cfg" /> <property name="window.cfg" value="${config}/cgl-macosx.cfg" /> <!-- Set platform headers. --> <property name="glext.platform.header" value="${stub.includes.dir}/macosx/cglext.c" /> <!-- Set platform directories. --> <property name="stub.includes.platform" value="${stub.includes}/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="java.excludes.platform" value="${java.excludes.macosx}" /> <property name="stub.includes.fileset.platform.params" value="${stub.includes.dir}/macosx/** ${stub.includes.dir}/common/** ${stub.includes.dir}/opengl/**" /> <!-- Set Javadoc properties. --> <property name="javadoc.dev.packagenames.platform" value="${javadoc.dev.packagenames.macosx}" /> <property name="compiler.cfg.id" value="compiler.cfg.macosx" /> <property name="linker.cfg.id" value="linker.cfg.macosx" /> </target> <!-- ================================================================== --> <!-- - Initialize all parameters required for the build and create any - required directories. --> <target name="init" depends="declare"> <!-- 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.jogl}" /> <mkdir dir="${obj.cg}" /> </target> <!-- ================================================================== --> <!-- GlueGen and BuildStaticGLInfo creation, task setup and Java file generation --> <!-- - Build GlueGen --> <target name="build.gluegen" depends="init"> <!-- Run the GlueGen build to ensure that the GlueGen ANT task - has been built. --> <ant antfile="${gluegen.build.xml}" target="all" inheritAll="true" /> </target> <!-- - Build BuildStaticGLInfo --> <target name="build.static.gl" depends="init"> <!-- Run the BuildStaticGLInfo build to ensure that the BuildStaticGLInfo - ANT task has been built. --> <ant antfile="${static.gl.build.xml}" target="all" inheritAll="true" /> </target> <!-- - 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}/com/sun/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}/javax/media/opengl/GL.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="build.gluegen, build.static.gl, java.generate.check" unless="java.generate.skip"> <!-- Create the classpath for the ANT tasks. This requires - the user-defined "antlr.jar" property (as GlueGen depends on - ANTLR at runtime).--> <path id="gen.classpath"> <pathelement path="${classpath}" /> <pathelement location="${classes}" /> <pathelement location="${antlr.jar}" /> </path> <!-- Add the GlueGen and BuildStaticGLInfo tasks to ANT --> <taskdef name="gluegen" classname="com.sun.gluegen.ant.GlueGenTask" classpathref="gen.classpath" /> <taskdef name="staticglgen" classname="com.sun.gluegen.ant.StaticGLGenTask" classpathref="gen.classpath" /> <!-- Use the GlueGen and BuildStaticGLInfo tasks to generate the - Java files --> <!-- Generate GL interface and implementation --> <echo message="Generating GL interface and implementation" /> <gluegen src="${stub.includes.common}/gl.c" config="${gl.cfg}" includeRefid="stub.includes.fileset.all" emitter="com.sun.gluegen.opengl.GLEmitter"> <classpath refid="gen.classpath" /> </gluegen> <!-- Generate platform-specific extension class (WGLExt, GLXExt, etc.) --> <echo message="Generating platform-specific OpenGL extension class" /> <gluegen src="${glext.platform.header}" config="${glext.platform.cfg}" includeRefid="stub.includes.fileset.all" emitter="com.sun.gluegen.opengl.GLEmitter"> <classpath refid="gen.classpath" /> </gluegen> <!-- Generate JAWT class --> <!-- NOTE: the "literalInclude" in this GlueGen call is simply to - get around the fact that neither FileSet nor DirSet can - handle different drives in an effective manner. --> <echo message="Generating JAWT interface class" /> <echo message="java.home.dir=${java.home.dir}" /> <dirset id="stub.includes.fileset.platform" dir="." includes="${stub.includes.fileset.platform.params}" /> <gluegen src="${java.includes.dir.platform}/jawt_md.h" config="${jawt.cfg}" literalInclude="${java.includes.dir}" includeRefid="stub.includes.fileset.platform" emitter="com.sun.gluegen.JavaEmitter"> <classpath refid="gen.classpath" /> </gluegen> <!-- Generate WGL/GLX/CGL implementation class --> <echo message="Generating WGL/GLX/CGL implementation class" /> <gluegen src="${stub.includes.platform}/window-system.c" config="${window.cfg}" includeRefid="stub.includes.fileset.platform" emitter="com.sun.gluegen.opengl.GLEmitter"> <classpath refid="gen.classpath" /> </gluegen> <!-- Generate StaticGLInfo class --> <echo message="Generating StaticGLInfo class" /> <staticglgen package="com.sun.opengl.impl" headers="${gl.headers}" outputdir="${src.generated.java}/com/sun/opengl/impl"> <classpath refid="gen.classpath" /> </staticglgen> <!-- Generate GLU class --> <echo message="Generating GLU class" /> <gluegen src="${stub.includes.common}/glu.c" config="${glu.cfg}" includeRefid="stub.includes.fileset.all" emitter="com.sun.gluegen.opengl.GLEmitter"> <classpath refid="gen.classpath" /> </gluegen> <!-- Inform the user that the generators have successfully created - the necessary Java files --> <echo message="" /> <echo message="GlueGen and BuildStaticGLInfo have successfully generated files." /> </target> <target name="java.generate.cg.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.cg.dependencies.fileset" /> <targetfileset dir="."> <include name="${src.generated.java.cg}/**/*.java" /> <include name="${src.generated.c.cg}/**/*.c" /> </targetfileset> </dependset> <!-- Now check for the presence of one well-known file --> <uptodate property="java.generate.cg.skip"> <srcfiles refid="stub.includes.cg.dependencies.fileset" /> <mapper type="merge" to="${src.generated.java}/com/sun/opengl/cg/CgGL.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.cg" depends="java.generate.cg.check" if="jogl.cg" unless="java.generate.cg.skip"> <!-- Create the classpath for the ANT tasks. This requires - the user-defined "antlr.jar" property (as GlueGen depends on - ANTLR at runtime).--> <path id="gen.classpath"> <pathelement path="${classpath}" /> <pathelement location="${classes}" /> <pathelement location="${antlr.jar}" /> </path> <!-- Add the GlueGen and BuildStaticGLInfo tasks to ANT --> <taskdef name="gluegen" classname="com.sun.gluegen.ant.GlueGenTask" classpathref="gen.classpath" /> <taskdef name="staticglgen" classname="com.sun.gluegen.ant.StaticGLGenTask" classpathref="gen.classpath" /> <!-- Generate CgGL interface class --> <gluegen src="${stub.includes.common}/cg.c" config="cg-common.cfg" includeRefid="stub.includes.cg.fileset.all" emitter="com.sun.gluegen.JavaEmitter"> <classpath refid="gen.classpath" /> </gluegen> </target> <!-- ================================================================== --> <!-- - Build and dependency rules for the composable pipeline --> <target name="java.compile.composable.pipeline.check"> <!-- Blow away the DebugGL.java and TraceGL.java sources if GL.class has changed (the uptodate element doesn't support arbitrary source and destination files) --> <dependset> <srcfilelist dir="${classes}/javax/media/opengl" files="GL.class" /> <srcfilelist dir="${classes}/com/sun/gluegen/opengl" files="BuildComposablePipeline.class" /> <targetfileset dir="${src.generated.java}/javax/media/opengl" includes="DebugGL.java,TraceGL.java" /> </dependset> <!-- Now choose one of the two to test to see if we have to regenerate --> <uptodate property="java.compile.composable.pipeline.skip" srcfile="${classes}/javax/media/opengl/GL.class" targetfile="${src.generated.java}/javax/media/opengl/DebugGL.java" /> </target> <target name="java.compile.composable.pipeline" depends="java.compile.composable.pipeline.check" unless="java.compile.composable.pipeline.skip"> <java classname="com.sun.gluegen.opengl.BuildComposablePipeline" fork="yes"> <arg value="javax.media.opengl.GL" /> <arg value="${src.generated.java}/javax/media/opengl" /> <classpath refid="antlr.classpath" /> </java> <!-- Perform the second pass Java compile which compiles the composable pipelines. --> <javac destdir="${classes}" includes="${src.generated.java.pipeline}" 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 original and generated source. The composable pipelines - will be generated. --> <target name="java.compile" depends="java.generate,java.generate.cg"> <!-- Perform the first pass Java compile. --> <javac destdir="${classes}" excludes="${java.excludes.platform},com/sun/opengl/impl/nurbs/**" source="1.4" debug="true" debuglevel="source,lines"> <src path="${src.java}" /> <src path="${src.generated.java}" /> <classpath refid="antlr.classpath" /> </javac> <!-- Generate and build the composable pipeline Java source. --> <antcall target="java.compile.composable.pipeline" inheritRefs="true" /> </target> <!-- ================================================================== --> <!-- - Compile the native C code for JOGL (and optionally the Cg binding). --> <!-- import cpptasks --> <typedef resource="net/sf/antcontrib/cpptasks/antlib.xml" classpath="${basedir}/lib/cpptasks.jar"/> <!--typedef resource="net/sf/antcontrib/cpptasks/antlib.xml"/--> <target name="c.configure"> <!-- 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="c.compiler.use-msvc7"/> <!-- buffer security checks --> <compilerarg value="/Wp64" if="c.compiler.use-msvc7"/> <!-- detect 64-bit port problems --> <compilerarg value="/RTCcsu" if="c.compiler.use-msvc7"/> <!-- 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 "_DEBUG" Optimized: /MD /W3 /O2 /Ob1 /GF /EHsc /GS /Gy /Wp64 /D "NDEBUG" --> <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="/usr/X11R6/lib" libs="GL, GLU, X11"/> <syslibset dir="${x11.cg.lib}" libs="Cg, CgGL" if="c.compiler.use-cglib"/> </linker> <linker id="linker.cfg.linux.amd64" name="gcc"> <syslibset dir="/usr/X11R6/lib64" libs="GL, GLU, X11"/> <syslibset dir="${x11.cg.lib}" libs="Cg, CgGL" if="c.compiler.use-cglib"/> </linker> <linker id="linker.cfg.solaris" name="suncc"> <syslibset libs="GL, GLU, X11"/> </linker> <linker id="linker.cfg.win32.mingw" name="gcc" incremental="false"> <linkerarg value="-Wl,--kill-at" /> <!-- remove @ from function names --> <syslibset libs="opengl32, glu32, gdi32, kernel32"/> <syslibset dir="${windows.cg.lib}" libs="cg, cgGL" if="c.compiler.use-cglib"/> </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="${c.linker.lib.root}/lib" libs="opengl32, glu32, gdi32, user32, kernel32" unless="c.compiler.use-msvc7"/> <syslibset dir="${c.linker.lib.root}/PlatformSDK/lib" libs="opengl32, glu32, gdi32, user32, kernel32" if="c.compiler.use-msvc7"/> <syslibset dir="${windows.cg.lib}" libs="cg, cgGL" if="c.compiler.use-cglib"/> </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.jogl"> <include name="${rootrel.src.c.jogl}/*.c"/> <include name="${rootrel.src.c.jogl}/*.m" if="os.isMacOSX"/> <include name="${rootrel.generated.c.jogl}/*.c"/> </patternset> <patternset id="c.src.files.cg"> <include name="${rootrel.generated.c.cg}/*.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.jogl}" 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="JOGL" 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/opengl"/> <includepath path="stub_includes/cg" if="c.compiler.use-cglib"/> </compiler> <linker extends="${linker.cfg.id}"> <syslibset dir="${java.lib.dir.platform}" libs="jawt"/> </linker> </cc> </target> <target name="c.rename.jogl.libs.mingw"> <!-- 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}/libjogl.so" tofile="${obj}/jogl.dll" /> <move file="${obj}/libjogl_cg.so" tofile="${obj}/jogl_cg.dll" failonerror="false" /> </target> <target name="c.rename.jogl.lib.macosx" if="os.isMacOSX"> <!-- 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}/libjogl.dylib" tofile="${obj}/libjogl.jnilib" /> </target> <target name="c.rename.jogl_cg.lib.macosx" if="os.isMacOSX"> <!-- 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}/libjogl_cg.dylib" tofile="${obj}/libjogl_cg.jnilib" /> </target> <target name="c.build.jogl"> <antcall target="c.build" inheritRefs="true"> <param name="c.compiler.src.files" value="c.src.files.jogl"/> <param name="output.lib.name" value="jogl"/> </antcall> <antcall target="c.rename.jogl.lib.macosx" inheritRefs="true" /> </target> <target name="c.build.cg" if="jogl.cg"> <antcall target="c.build" inheritRefs="true"> <param name="c.compiler.src.files" value="c.src.files.cg"/> <param name="c.compiler.use-cglib" value="XXX"/> <param name="output.lib.name" value="jogl_cg"/> </antcall> <antcall target="c.rename.jogl_cg.lib.macosx" inheritRefs="true" /> </target> <target name="c.compile.jogl.win32.vc6" depends="declare.win32.vc6, c.build.jogl, c.build.cg" > </target> <target name="c.compile.jogl.win32.vc7" depends="declare.win32.vc7, c.build.jogl, c.build.cg"> <property name="c.compiler.use-msvc7" value="true"/> </target> <target name="c.compile.jogl.win32.mingw" depends="declare.win32.mingw, c.build.jogl, c.build.cg"> <antcall target="c.rename.jogl.libs.mingw" inheritrefs="true" /> </target> <target name="c.compile.jogl.linux" depends="declare.linux, c.build.jogl, c.build.cg" > </target> <target name="c.compile.jogl.linux.amd64" depends="declare.linux.amd64, c.build.jogl, c.build.cg" > </target> <target name="c.compile.jogl.linux.ia64" depends="declare.linux.ia64, c.build.jogl, c.build.cg" > </target> <target name="c.compile.jogl.solaris" depends="declare.solaris, c.build.jogl"> </target> <target name="c.compile.jogl.macosx" depends="declare.macosx, c.build.jogl, c.build.cg"> </target> <target name="c.compile.jogl.freebsd" depends="declare.freebsd, c.build.jogl, c.build.cg" > </target> <!-- ================================================================== --> <!-- - Build the jogl.jar file. --> <target name="jar" depends="java.compile"> <!-- Build the jar excluding any build specific classes. --> <jar destfile="${jogl.jar}"> <fileset dir="${classes}"> <include name="javax/media/opengl/**" /> <include name="com/sun/gluegen/runtime/**" /> <include name="com/sun/opengl/impl/**" /> <include name="com/sun/opengl/utils/**" /> <include name="com/sun/opengl/cg/**" /> </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.nocg" depends="setup.java.home.dir,init" unless="jogl.cg"> <!-- Build the general Javadoc --> <javadoc packagenames="${javadoc.packagenames}" sourcepath="${src.java};${src.generated.java}" destdir="${javadoc}" windowtitle="${javadoc.windowtitle}" source="1.4" linkoffline="${javadoc.link} 142-packages" /> </target> <!-- Same as above but with Cg directories added --> <target name="javadoc.cg" depends="setup.java.home.dir,init" if="jogl.cg"> <!-- Build the general Javadoc --> <javadoc packagenames="${javadoc.packagenames},com.sun.opengl.cg" sourcepath="${src.java};${src.generated.java}" destdir="${javadoc}" windowtitle="${javadoc.windowtitle}" source="1.4" linkoffline="${javadoc.link} 142-packages" /> </target> <target name="javadoc" depends="javadoc.nocg,javadoc.cg" /> <target name="javadoc.dev.nocg" depends="init" unless="jogl.cg"> <!-- Build the internal developer Javadoc --> <javadoc packagenames="${javadoc.dev.packagenames},${javadoc.dev.packagenames.platform}" sourcepath="${src.java};${src.generated.java}" destdir="${javadoc.dev}" windowtitle="${javadoc.windowtitle}" source="1.4" linkoffline="${javadoc.link} 142-packages" /> </target> <!-- Same as above but with Cg directories added --> <target name="javadoc.dev.cg" depends="init" if="jogl.cg"> <!-- Build the internal developer Javadoc --> <javadoc packagenames="${javadoc.dev.packagenames},${javadoc.dev.packagenames.platform},com.sun.opengl.cg" sourcepath="${src.java};${src.generated.java}" destdir="${javadoc.dev}" windowtitle="${javadoc.windowtitle}" source="1.4" linkoffline="${javadoc.link} 142-packages" /> </target> <target name="javadoc.dev.win32" depends="setup.java.home.dir,declare.win32,javadoc.dev.nocg,javadoc.dev.cg" /> <target name="javadoc.dev.x11" depends="setup.java.home.dir,declare.x11,javadoc.dev.nocg,javadoc.dev.cg" /> <target name="javadoc.dev.macosx" depends="setup.java.home.dir,declare.macosx,javadoc.dev.nocg,javadoc.dev.cg" /> <!-- ================================================================== --> <!-- - Build the platform-independent distribution out of jars built for - Windows, Linux and Mac OS X; the Java sources for Jogl can't be - fully cross-compiled at this time. To run this target, you need to - specify the property jogl.dist.dir as a System property (i.e., - "ant -Djogl.dist.dir=../dist dist"); directories named jogl-linux, - jogl-win32, and jogl-macosx need to be inside that directory and each - of those directories needs to contain both the jogl.jar for that - platform as well as the native code (libjogl.so, jogl.dll, or - libjogl.jnilib). Also builds jars containing the native code for - Windows, Linux, Mac OS X, Solaris/SPARC and Solaris/x86. --> <target name="dist.check" unless="jogl.dist.dir"> <fail> ****************************************************************** ** To build the Jogl distribution out of the platform-specific ** ** component jars and native code, the property jogl.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="${jogl.dist.dir}/jogl.jar" /> <delete> <fileset dir="${jogl.dist.dir}" includes="jogl-natives-*.jar" /> </delete> <delete file="${jogl.dist.dir}/jogl-src.zip" /> <jar destfile="${jogl.dist.dir}/jogl.jar" duplicate="preserve"> <zipgroupfileset dir="${jogl.dist.dir}" includes="jogl-win32/*.jar, jogl-linux/*.jar, jogl-macosx/*.jar" /> </jar> <jar destfile="${jogl.dist.dir}/jogl-natives-win32.jar" basedir="${jogl.dist.dir}/jogl-win32" includes="jogl.dll,jogl_cg.dll" /> <jar destfile="${jogl.dist.dir}/jogl-natives-linux.jar" basedir="${jogl.dist.dir}/jogl-linux" includes="libjogl.so,libjogl_cg.so" /> <jar destfile="${jogl.dist.dir}/jogl-natives-macosx.jar" basedir="${jogl.dist.dir}/jogl-macosx" includes="libjogl.jnilib,libjogl_cg.jnilib" /> <jar destfile="${jogl.dist.dir}/jogl-natives-solsparc.jar" basedir="${jogl.dist.dir}/jogl-solsparc" includes="libjogl.so" /> <jar destfile="${jogl.dist.dir}/jogl-natives-solx86.jar" basedir="${jogl.dist.dir}/jogl-solx86" includes="libjogl.so" /> <!-- Build a source archive as well --> <zip destfile="${jogl.dist.dir}/jogl-src.zip" basedir="../.." includes="jogl/doc/**,jogl/make/**,jogl/src/**" excludes="**/*.class,**/*~" /> </target> <!-- ================================================================== --> <!-- - Clean up all that is built. --> <target name="clean" depends="declare"> <!-- Let GlueGen clean itself up. --> <ant antfile="${gluegen.build.xml}" target="clean" inheritAll="true" /> <delete includeEmptyDirs="true" quiet="true"> <fileset dir="${build}" /> <fileset dir="${javadoc}" /> <fileset dir="${javadoc.dev}" /> </delete> </target> <!-- ================================================================== --> <!-- - Inform the user that one of the platform targets should be used. --> <target name="all"> <fail> Use a platform specific target: linux, linux.amd64, linux.ia64, macosx, macosxfat (ppc and i386), solaris, win32.vc6, win32.vc7, win32.mingw </fail> </target> <!-- - Win32 with MS VC6 --> <target name="win32.vc6" depends="setup.java.home.dir, declare.win32"> <!-- Generate, compile, and build the jar for the Java sources. --> <antcall target="jar" inheritRefs="true" /> <!-- Compile the native C sources and build the jogl.dll. --> <antcall target="c.compile.jogl.win32.vc6" /> </target> <!-- - Win32 with MS VC7 --> <target name="win32.vc7" depends="setup.java.home.dir, declare.win32"> <!-- Generate, compile, and build the jar for the Java sources. --> <antcall target="jar" inheritRefs="true" /> <!-- Compile the native C sources and build the jogl.dll. --> <antcall target="c.compile.jogl.win32.vc7" /> </target> <!-- - Win32 with mingw32 --> <target name="win32.mingw" depends="setup.java.home.dir, declare.win32"> <!-- Generate, compile, and build the jar for the Java sources. --> <antcall target="jar" inheritRefs="true" /> <!-- Compile the native C sources and build the jogl.dll. --> <antcall target="c.compile.jogl.win32.mingw" /> </target> <!-- - Linux (assuming GCC) --> <target name="linux" depends="declare.linux"> <!-- Generate, compile, and build the jar for the Java sources. --> <antcall target="jar" inheritRefs="true" /> <!-- Compile the native C sources and build the jogl lib. --> <antcall target="c.compile.jogl.linux" /> </target> <!-- - Linux on AMD64 (assuming GCC) --> <target name="linux.amd64" depends="setup.java.home.dir.nonmacosx, declare.linux.amd64"> <!-- Generate, compile, and build the jar for the Java sources. --> <antcall target="jar" inheritRefs="true" /> <!-- Compile the native C sources and build the jogl lib. --> <antcall target="c.compile.jogl.linux.amd64" /> </target> <!-- - Linux on IA64 (assuming GCC) --> <target name="linux.ia64" depends="setup.java.home.dir.nonmacosx, declare.linux.ia64"> <!-- Generate, compile, and build the jar for the Java sources. --> <antcall target="jar" inheritRefs="true" /> <!-- Compile the native C sources and build the jogl lib. --> <antcall target="c.compile.jogl.linux.ia64" /> </target> <!-- - Solaris (assuming Solaris CC) --> <target name="solaris" depends="setup.java.home.dir, declare.solaris"> <!-- Generate, compile, and build the jar for the Java sources. --> <antcall target="jar" inheritRefs="true" /> <!-- Compile the native C sources and build the jogl lib. --> <antcall target="c.compile.jogl.solaris" /> </target> <!-- - Mac OSX --> <target name="macosx" depends="setup.java.home.dir, declare.macosx"> <!-- Generate, compile, and build the jar for the Java sources. --> <antcall target="jar" inheritRefs="true" /> <!-- Compile the native C sources and build the jogl lib. --> <antcall target="c.compile.jogl.macosx" /> </target> <target name="macosxfat" depends="macosx"> <property name="macosxfat" value="true" /> <antcall target="macosx" inheritRefs="true" /> </target> <!-- - FreeBSD (assuming GCC) --> <target name="freebsd" depends="declare.freebsd"> <!-- Generate, compile, and build the jar for the Java sources. --> <antcall target="jar" inheritRefs="true" /> <!-- Compile the native C sources and build the jogl lib. --> <antcall target="c.compile.jogl.freebsd" /> </target> </project>