summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--make/Makefile27
-rw-r--r--make/build-gluegen.xml174
-rw-r--r--make/build-staticglgen.xml91
-rw-r--r--make/build.xml1038
-rw-r--r--make/cg-common.cfg1
-rw-r--r--make/host.properties49
-rw-r--r--make/stub_includes/common/cg.c26
-rw-r--r--make/stub_includes/common/gl-impl.c23
-rw-r--r--make/stub_includes/common/gl.c7
-rw-r--r--make/stub_includes/common/glu-impl.c3
-rw-r--r--make/stub_includes/common/glu.c2
-rw-r--r--make/validate-properties.xml65
-rw-r--r--src/net/java/games/gluegen/FunctionEmitter.java2
-rw-r--r--src/net/java/games/gluegen/JavaConfiguration.java6
-rw-r--r--src/net/java/games/gluegen/ant/GlueGenTask.java493
-rw-r--r--src/net/java/games/gluegen/ant/StaticGLGenTask.java303
-rw-r--r--src/net/java/games/gluegen/cgram/types/CompoundType.java2
-rw-r--r--src/net/java/games/gluegen/cgram/types/TypeDictionary.java2
-rw-r--r--src/net/java/games/jogl/impl/FunctionAvailabilityCache.java4
-rw-r--r--src/net/java/games/jogl/impl/GLContext.java2
-rw-r--r--src/net/java/games/jogl/impl/windows/WindowsGLContext.java2
21 files changed, 2285 insertions, 17 deletions
diff --git a/make/Makefile2 b/make/Makefile2
index 0c8f540ec..4fa84b2b0 100644
--- a/make/Makefile2
+++ b/make/Makefile2
@@ -301,7 +301,6 @@ DEFINES:=$(DEFINES)
INCLUDES=-I$(JOGL_STUB_INCLUDES_DIR_OPENGL) -I"$(JAVA_INCLUDE_PATH)" -I"$(JAVA_INCLUDE_PATH_PD)"
CFLAGS=$(OPTFLAGS) $(DEBUGFLAGS)
OBJ_FILE_EXT=o
-C_BUILD_OBJ_CMD=$(CC) -Dmacosx -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
DSO_PREFIX_PD=lib
DSO_EXTENSION_PD=jnilib
endif # macosx
@@ -353,7 +352,6 @@ INCLUDES=-I$(JOGL_STUB_INCLUDES_DIR_OPENGL) -I"$(JAVA_INCLUDE_PATH)" -I"$(JAVA_I
# -I$(INCLUDE_PATH_ROOT_PD)
CFLAGS=$(OPTFLAGS) $(DEBUGFLAGS)
OBJ_FILE_EXT=o
-C_BUILD_OBJ_CMD=$(CC) -c $(CFLAGS) $(INCLUDES) $(DEFINES) $< -o $@
DSO_PREFIX_PD=lib
DSO_EXTENSION_PD=so
endif # x11
@@ -458,8 +456,6 @@ JOGL_GENERATED_CFILES_MACOSX = \
# JOGL_CFG Name of the gl.cfg file
# JOGL_IMPL_CFG Name of the gl-impl.cfg file
# JOGL_JAWT_CFG Name of the jawt.cfg file
-# JOGL_WINDOW_SYSTEM_CFG Name of the e.g., gl-wgl-win32.cfg file which provides
-# WGL, GLX, etc. extensions to GL
# JOGL_WINDOW_SYSTEM_CFG Name of the e.g., wingdi.cfg file which provides internal
# access to core routines in WGL, glX, etc.
# JOGL_GENERATED_CFILES_PD Names of platform-dependent .c files
@@ -481,7 +477,6 @@ JOGL_CFG=gl-win32.cfg
JOGL_IMPL_CFG=gl-impl-win32.cfg
JOGL_GLU_CFG=glu.cfg
JOGL_GLU_IMPL_CFG=glu-impl-win32.cfg
-JOGL_WINDOW_SYSTEM_CFG=gl-wgl-win32.cfg
JOGL_JAWT_CFG=jawt-win32.cfg
JOGL_WINDOW_SYSTEM_CFG=wingdi-win32.cfg
JOGL_GENERATED_CFILES_PD=$(JOGL_GENERATED_CFILES_WINDOWS)
@@ -507,7 +502,6 @@ JOGL_CFG=gl-x11.cfg
JOGL_IMPL_CFG=gl-impl-x11.cfg
JOGL_GLU_CFG=glu.cfg
JOGL_GLU_IMPL_CFG=glu-impl-x11.cfg
-JOGL_WINDOW_SYSTEM_CFG=gl-glx-x11.cfg
JOGL_JAWT_CFG=jawt-x11.cfg
JOGL_WINDOW_SYSTEM_CFG=glx-x11.cfg
JOGL_GENERATED_CFILES_PD=$(JOGL_GENERATED_CFILES_X11)
@@ -533,7 +527,6 @@ JOGL_CFG=gl-macosx.cfg
JOGL_IMPL_CFG=gl-impl-macosx.cfg
JOGL_GLU_CFG=glu.cfg
JOGL_GLU_IMPL_CFG=glu-impl-macosx.cfg
-JOGL_WINDOW_SYSTEM_CFG=gl-cgl-macosx.cfg
JOGL_JAWT_CFG=jawt-macosx.cfg
JOGL_WINDOW_SYSTEM_CFG=cgl-macosx.cfg
JOGL_GENERATED_CFILES_PD=$(JOGL_GENERATED_CFILES_MACOSX)
diff --git a/make/build-gluegen.xml b/make/build-gluegen.xml
new file mode 100644
index 000000000..f0236811b
--- /dev/null
+++ b/make/build-gluegen.xml
@@ -0,0 +1,174 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ - Ant build for JOGL's GlueGen and corresponding ANT task. This build
+ - should not be called directly. It is invoked from the main "build.xml"
+ - file and relies on the properties set therein.
+ -
+ - The optional.jar that contains the optional ANT tasks must be in the ANT
+ - classpath (typically the ant/lib directory).
+ -
+ - This build has been tested with ANT 1.5.3 and JOGL 1.1.1.1.
+ -
+ - Public targets:
+ - all: clean and build GlueGen and GlueGen Ant task
+ - clean: clean all built
+ -->
+<project name="JOGL.GlueGen" default="all">
+ <!-- ================================================================== -->
+ <!--
+ - Declare all paths and user defined variables.
+ -->
+ <target name="declare" description="Declare properties">
+
+ <!-- Create the classpath for ANTLR. This requires the user-defined
+ - "antlr.jar" property. -->
+ <path id="antlr.classpath">
+ <pathelement location="${antlr.jar}" />
+ </path>
+
+ <!-- The location of the GlueGen source and the C grammar files. -->
+ <property name="gluegen" value="${src}/net/java/games/gluegen" />
+ <property name="c.grammar" value="${gluegen}/cgram" />
+
+ <!-- The resulting location of the generated Java files from the
+ - C grammar via ANTLR. -->
+ <property name="gluegen.build" value="${src.generated.java}/net/java/games/gluegen" />
+ <property name="generated.java.from.grammar" value="${gluegen.build}/cgram" />
+
+ </target>
+
+ <!-- ================================================================== -->
+ <!--
+ - Build GlueGen.
+ -->
+ <target name="build.gluegen" depends="declare">
+ <!-- Generate the Java files from the C grammar using ANTLR. -->
+ <antcall target="generate.c.grammar">
+ <param name="target" value="${c.grammar}/StdCParser.g" />
+ <param name="output.dir" value="${generated.java.from.grammar}" />
+ </antcall>
+ <antcall target="generate.c.grammar.glib">
+ <param name="target" value="${c.grammar}/GnuCParser.g" />
+ <param name="glib" value="${c.grammar}/StdCParser.g" />
+ <param name="output.dir" value="${generated.java.from.grammar}" />
+ </antcall>
+ <antcall target="generate.c.grammar">
+ <param name="target" value="${c.grammar}/GnuCTreeParser.g" />
+ <param name="output.dir" value="${generated.java.from.grammar}" />
+ </antcall>
+ <antcall target="generate.c.grammar.glib">
+ <param name="target" value="${c.grammar}/GnuCEmitter.g" />
+ <param name="glib" value="${c.grammar}/GnuCTreeParser.g" />
+ <param name="output.dir" value="${generated.java.from.grammar}" />
+ </antcall>
+ <antcall target="generate.c.grammar.glib">
+ <param name="target" value="${c.grammar}/HeaderParser.g" />
+ <param name="glib" value="${c.grammar}/GnuCTreeParser.g" />
+ <param name="output.dir" value="${generated.java.from.grammar}" />
+ </antcall>
+
+ <!-- Ensure that the output classes directory exists. -->
+ <mkdir dir="${classes}" />
+
+ <!-- Build GlueGen using the generated Java files along with the
+ - original source.
+ - NOTE: GlueGenTask is NOT built at this time. It is done in
+ - a separate task. -->
+ <javac destdir="${classes}" includes="**/gluegen/**" excludes="**/GlueGenTask.java"
+ source="1.4">
+ <src path="${src}" />
+ <src path="${src.generated.java}" />
+ <classpath refid="antlr.classpath" />
+ </javac>
+
+ <!-- Inform the user that GlueGen has been successfully built. -->
+ <echo message="" />
+ <echo message="GlueGen has been built successfully." />
+ </target>
+
+ <!--
+ - Using ANTLR generate the specified Java files.
+ -
+ - @param target the grammar file to process
+ - @param output.dir the directory to write the generated files to. If
+ - the directory does not exist, it will be created.
+ -->
+ <target name="generate.c.grammar" depends="declare">
+ <!-- Ensure that the output directory exists.
+ - NOTE: this will ignore silently if the directory already exists. -->
+ <mkdir dir="${output.dir}" />
+
+ <!-- Generate the Java files -->
+ <antlr target="${target}" outputdirectory="${output.dir}">
+ <classpath refid="antlr.classpath" />
+ </antlr>
+ </target>
+
+ <!--
+ - Using ANTLR generate the specified Java files with an overridden
+ - grammar file.
+ -
+ - @param target the grammar file to process
+ - @param glib the overridding grammar file
+ - @param output.dir the directory to write the generated files to. If
+ - the directory does not exist, it will be created.
+ -->
+ <target name="generate.c.grammar.glib" depends="declare">
+ <!-- Ensure that the output directory exists.
+ - NOTE: this will ignore silently if the directory already exists. -->
+ <mkdir dir="${output.dir}" />
+
+ <!-- Generate the Java files -->
+ <antlr target="${target}" glib="${glib}" outputdirectory="${output.dir}">
+ <classpath refid="antlr.classpath" />
+ </antlr>
+ </target>
+
+ <!-- ================================================================== -->
+ <!--
+ - Build the GlueGen ANT task.
+ -->
+ <target name="build.gluegen.task" depends="declare">
+ <!-- Ensure that the output classes directory exists. -->
+ <mkdir dir="${classes}" />
+
+ <!-- Build the GlueGen ANT task.
+ - NOTE: ONLY the GlueGenTask is built at this time. GlueGen
+ - itself is built in a separate task. -->
+ <javac destdir="${classes}" includes="**/GlueGenTask.java" source="1.4">
+ <src path="${src}" />
+ <classpath refid="antlr.classpath" />
+ </javac>
+
+ <!-- Inform the user that the GlueGen ANT task has been successfully
+ built. -->
+ <echo message="" />
+ <echo message="GlueGen ANT task has been built successfully." />
+ </target>
+
+ <!-- ================================================================== -->
+ <!--
+ - Clean up all that is built.
+ - NOTE: this is a bit heavy-handed as it may delete more than just
+ - what is built with this build.
+ -->
+ <target name="clean" depends="declare">
+ <delete includeEmptyDirs="true" quiet="true">
+ <fileset dir="${src.generated.java}" />
+ <fileset dir="${classes}" />
+ </delete>
+ </target>
+
+ <!-- ================================================================== -->
+ <!--
+ - Build GlueGen and the GlueGen ANT task.
+ -->
+ <target name="all" depends="declare">
+ <!-- Build GlueGen -->
+ <antcall target="build.gluegen" />
+
+ <!-- Build the GlueGen ANT task -->
+ <antcall target="build.gluegen.task" />
+ </target>
+
+</project> \ No newline at end of file
diff --git a/make/build-staticglgen.xml b/make/build-staticglgen.xml
new file mode 100644
index 000000000..d054abbb0
--- /dev/null
+++ b/make/build-staticglgen.xml
@@ -0,0 +1,91 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ - Ant build for JOGL's BuildStaticGLInfo and corresponding ANT task. This
+ - build should not be called directly. It is invoked from the main
+ - "build.xml" file and relies on the properties set therein.
+ -
+ - This build has been tested with ANT 1.5.3 and JOGL 1.1.1.1.
+ -
+ - Public targets:
+ - all: clean and build BuildStaticGLInfo and StaticGLGen Ant task
+ - clean: clean all built
+ -->
+<project name="JOGL.BuildStaticGLInfo" default="all">
+ <!-- ================================================================== -->
+ <!--
+ - Declare all paths and user defined variables.
+ -->
+ <target name="declare" description="Declare properties">
+ <!-- The location of the BuildStaticGLInfo source. -->
+ <property name="static.gl.src" value="${src}/net/java/games/gluegen/opengl" />
+ </target>
+
+ <!-- ================================================================== -->
+ <!--
+ - Build BuildStaticGLInfo.
+ -->
+ <target name="build.static.gl" depends="declare">
+ <!-- Ensure that the output classes directory exists. -->
+ <mkdir dir="${classes}" />
+
+ <!-- Compile BuildStaticGLInfo -->
+ <javac srcdir="${src}" destdir="${classes}" includes="**/BuildStaticGLInfo.java" source="1.4">
+ <classpath refid="antlr.classpath" />
+ </javac>
+
+ <!-- Inform the user that BuildStaticGLInfo has been successfully built. -->
+ <echo message="" />
+ <echo message="BuildStaticGLInfo has been built successfully." />
+ </target>
+
+ <!-- ================================================================== -->
+ <!--
+ - Build the StaticGLGen ANT task.
+ -->
+ <target name="build.static.gl.task" depends="declare">
+ <!-- Ensure that the output classes directory exists. -->
+ <mkdir dir="${classes}" />
+
+ <!-- Build the BuildStaticGLInfo ANT task.
+ - NOTE: ONLY the StaticGLGen is built at this time. BuildStaticGLInfo
+ - itself is built in a separate task. -->
+ <javac destdir="${classes}" includes="**/StaticGLGenTask.java" source="1.4">
+ <src path="${src}" />
+ <classpath refid="classpath" />
+ </javac>
+
+ <!-- Inform the user that the BuildStaticGLInfo ANT task has been
+ - successfully built. -->
+ <echo message="" />
+ <echo message="StaticGLGen ANT task has been built successfully." />
+ </target>
+
+ <!-- ================================================================== -->
+ <!--
+ - Clean up all that is built.
+ - NOTE: this is a bit heavy-handed as it may delete more than just
+ - what is built with this build.
+ -->
+ <target name="clean" depends="declare">
+ <!-- Create the directory before attempting to delete it. Deleting
+ - non-existant dirs will cause an error. -->
+ <mkdir dir="${classes}" />
+
+ <delete includeEmptyDirs="true">
+ <fileset dir="${classes}" />
+ </delete>
+ </target>
+
+ <!-- ================================================================== -->
+ <!--
+ - Build BuildStaticGLInfo and the BuildStaticGLInfo ANT task.
+ -->
+ <target name="all" depends="declare">
+ <!-- Build BuildStaticGLInfo -->
+ <antcall target="build.static.gl" />
+
+ <!-- Build the BuildStaticGLInfo ANT task -->
+ <antcall target="build.static.gl.task" />
+ </target>
+
+</project> \ No newline at end of file
diff --git a/make/build.xml b/make/build.xml
new file mode 100644
index 000000000..3b225737e
--- /dev/null
+++ b/make/build.xml
@@ -0,0 +1,1038 @@
+<?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
+ - 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.
+ -->
+<project name="JOGL" basedir="." default="all">
+
+ <!-- ================================================================== -->
+ <!--
+ - Base initialization.
+ -->
+ <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="." />
+ </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="${make}/host.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="java.home.dir">
+ <property name="java.home.dir" value="${java.home}/.." />
+ </target>
+ <target name="setup.java.home.dir.macosx" depends="load.user.properties" unless="java.home.dir">
+ <property name="java.home.dir" value="/System/Library/Frameworks/JavaVM.framework/Home" />
+ </target>
+
+
+ <!-- ================================================================== -->
+ <!--
+ - Declare all paths and user defined variables.
+ -->
+ <target name="declare" 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" />
+
+ <!-- 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" value="src" />
+ <property name="rootrel.src.c" value="${rootrel.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" value="${project.root}/${rootrel.src}" />
+ <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/net/java/games/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="net/java/games/jogl/DebugGL.java,net/java/games/jogl/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/**" />
+ </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="*.cfg" />
+ <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/**" />
+ </dirset>
+ <fileset id="stub.includes.cg.dependencies.fileset" dir=".">
+ <include name="${stub.includes.dir}/cg/**" />
+ <include name="cg-common.cfg" />
+ </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.lib.dir.win32" value="${java.home.dir}/lib" />
+ <property name="java.lib.dir.linux" value="${java.home.dir}/lib/i386" />
+ <property name="java.lib.dir.solaris" value="${java.home.dir}/${os.arch}" />
+ <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") -->
+ <property name="java.excludes.win32" value="net/java/games/jogl/impl/x11/**, net/java/games/jogl/impl/macosx/**" />
+ <property name="java.excludes.x11" value="net/java/games/jogl/impl/windows/**, net/java/games/jogl/impl/macosx/**" />
+ <property name="java.excludes.macosx" value="net/java/games/jogl/impl/x11/**, net/java/games/jogl/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 ANT specific Makefile for building the native sources. -->
+ <property name="makefile" value="${config}/MakefileAnt" />
+
+ <!-- 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.packagenames" value="net.java.games.jogl,net.java.games.gluegen.runtime,net.java.games.jogl.util" />
+ <property name="javadoc.dev.packagenames.win32" value="net.java.games.jogl.impl.windows" />
+ <property name="javadoc.dev.packagenames.x11" value="net.java.games.jogl.impl.x11" />
+ <property name="javadoc.dev.packagenames.macosx" value="net.java.games.jogl.impl.macosx" />
+ <property name="javadoc.dev.packagenames" value="net.java.games.jogl,net.java.games.jogl.impl,net.java.games.jogl.util,net.java.games.gluegen.*" />
+
+ </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="gl.impl.cfg" value="${config}/gl-impl-win32.cfg" />
+ <property name="glu.cfg" value="${config}/glu.cfg" />
+ <property name="glu.impl.cfg" value="${config}/glu-impl-win32.cfg" />
+ <property name="jawt.cfg" value="${config}/jawt-win32.cfg" />
+ <property name="window.cfg" value="${config}/wingdi-win32.cfg" />
+
+ <!-- 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}" />
+ <dirset id="stub.includes.fileset.platform" dir=".">
+ <include name="${stub.includes.dir}/win32/**" />
+ </dirset>
+
+ <!-- Set Javadoc properties. -->
+ <property name="javadoc.dev.packagenames.platform" value="${javadoc.dev.packagenames.win32}" />
+ </target>
+
+ <target name="declare.win32.vc.common">
+ <property name="c.compiler" value="cl.exe" />
+ <property name="c.compiler.flags" value="${c.compiler.optflags} /nologo /TC /c" />
+ <property name="c.compiler.obj.suffix" value="obj" />
+ <property name="c.compiler.jogl.outputfile.expr" value="/Fo${rootrel.obj.jogl}/*.${c.compiler.obj.suffix}" />
+ <property name="c.compiler.includes" value="/I&quot;make/stub_includes/opengl&quot; /I&quot;${c.compiler.include.root}/PlatformSDK/Include&quot; /I&quot;${c.compiler.include.root}/include&quot; /I&quot;${java.includes.dir}&quot; /I&quot;${java.includes.dir.platform}&quot; /I&quot;make/stub_includes/cg&quot;" />
+ <property name="c.linker" value="link.exe" />
+ <property name="c.linker.flags" value="/DLL /LIBPATH:&quot;${c.linker.lib.root}/PlatformSDK/lib&quot; /LIBPATH:&quot;${c.linker.lib.root}/lib&quot; /LIBPATH:&quot;${java.lib.dir.platform}&quot; /INCREMENTAL:NO /NOLOGO /MACHINE:IX86 /OPT:REF /OPT:ICF /SUBSYSTEM:WINDOWS" />
+ <property name="c.linker.jogl.libs" value="opengl32.lib glu32.lib jawt.lib gdi32.lib kernel32.lib" />
+ <property name="rootrel.c.linker.jogl.dso" value="${rootrel.obj}/jogl.dll" />
+ <property name="c.linker.jogl.dso" value="${project.root}/${rootrel.c.linker.jogl.dso}" />
+ <property name="c.linker.jogl.flags" value="/OUT:&quot;${c.linker.jogl.dso}&quot;" />
+ <!-- Cg declarations -->
+ <property name="c.compiler.cg.outputfile.expr" value="/Fo${rootrel.obj.cg}/*.${c.compiler.obj.suffix}" />
+ <property name="c.linker.cg.libs" value="opengl32.lib cg.lib cgGL.lib /LIBPATH:&quot;${windows.cg.lib}&quot;" />
+ <property name="rootrel.c.linker.cg.dso" value="${rootrel.obj}/jogl_cg.dll" />
+ <property name="c.linker.cg.dso" value="${project.root}/${rootrel.c.linker.cg.dso}" />
+ <property name="c.linker.cg.flags" value="/OUT:&quot;${c.linker.cg.dso}&quot;" />
+ </target>
+
+ <target name="declare.win32.vc6.debug" if="debug">
+ <!-- FIXME: put in debug flags -->
+ <property name="c.compiler.optflags" value="/MD /W3 /O2 /Ob1 /GF /Gy" />
+ </target>
+ <target name="declare.win32.vc6.optimized" unless="debug">
+ <property name="c.compiler.optflags" value="/MD /W3 /O2 /Ob1 /GF /Gy" />
+ </target>
+
+ <target name="declare.win32.vc6.pre" depends="declare.win32,declare.win32.vc6.debug,declare.win32.vc6.optimized">
+ <property name="c.compiler.include.root" value="${vc6.root}" />
+ <property name="c.linker.lib.root" value="${vc6.root}" />
+ </target>
+
+ <target name="declare.win32.vc6" depends="declare.win32.vc6.pre, declare.win32.vc.common" />
+
+ <target name="declare.win32.vc7.debug" if="debug">
+ <property name="c.compiler.optflags" value="/MDd /Yd /GS /RTCs /RTCu /RTCc /W3 /Od /GF /EHsc /Zi /GS /Gy /Wp64 /Zi /D &quot;_DEBUG&quot;" />
+ </target>
+ <target name="declare.win32.vc7.optimized" unless="debug">
+ <property name="c.compiler.optflags" value="/MD /W3 /O2 /Ob1 /GF /EHsc /GS /Gy /Wp64 /D &quot;NDEBUG&quot;" />
+ </target>
+
+ <target name="declare.win32.vc7.pre" depends="declare.win32,declare.win32.vc7.debug,declare.win32.vc7.optimized">
+ <property name="c.compiler.include.root" value="${vc7.root}" />
+ <property name="c.linker.lib.root" value="${vc7.root}" />
+ </target>
+
+ <target name="declare.win32.vc7" depends="declare.win32.vc7.pre, declare.win32.vc.common" />
+
+ <target name="declare.win32.mingw" depends="declare.win32">
+ <property name="c.compiler" value="gcc.exe" />
+ <property name="c.compiler.optflags" value="-O3" />
+ <property name="c.compiler.flags" value="${c.compiler.optflags} -c -DBUILD_DLL -D_WINGDI_ -D_STRICT_ANSI -D_JNI_IMPLEMENTATION_ -o" />
+ <property name="c.compiler.obj.suffix" value="o" />
+ <property name="c.compiler.jogl.outputfile.expr" value="${rootrel.obj.jogl}/*.${c.compiler.obj.suffix}" />
+ <property name="c.compiler.includes" value="-I&quot;make/stub_includes/opengl&quot; -I&quot;${java.includes.dir}&quot; -I&quot;${java.includes.dir.platform}&quot; -I&quot;make/stub_includes/cg&quot;" />
+ <property name="c.linker" value="gcc.exe" />
+ <property name="c.linker.flags" value="-shared" />
+ <property name="c.linker.jogl.libs" value="-Wl,--kill-at -L&quot;${java.lib.dir.platform}&quot; -lopengl32 -lglu32 -ljawt -lgdi32" />
+ <property name="rootrel.c.linker.jogl.dso" value="${rootrel.obj}/jogl.dll" />
+ <property name="c.linker.jogl.dso" value="${project.root}/${rootrel.c.linker.jogl.dso}" />
+ <property name="c.linker.jogl.flags" value="-o ${c.linker.jogl.dso}" />
+ <!-- Cg declarations -->
+ <property name="c.compiler.cg.outputfile.expr" value="${rootrel.obj.cg}/*.${c.compiler.obj.suffix}" />
+ <property name="c.linker.cg.libs" value="-Wl,--kill-at -L&quot;${windows.cg.lib}&quot; -lopengl32 -lcg -lcgGL" />
+ <property name="rootrel.c.linker.cg.dso" value="${rootrel.obj}/jogl_cg.dll" />
+ <property name="c.linker.cg.dso" value="${project.root}/${rootrel.c.linker.cg.dso}" />
+ <property name="c.linker.cg.flags" value="-o ${c.linker.cg.dso}" />
+ </target>
+
+ <target name="declare.x11" depends="init">
+ <!-- Set platform configuration files. -->
+ <property name="gl.cfg" value="${config}/gl-x11.cfg" />
+ <property name="gl.impl.cfg" value="${config}/gl-impl-x11.cfg" />
+ <property name="glu.cfg" value="${config}/glu.cfg" />
+ <property name="glu.impl.cfg" value="${config}/glu-impl-x11.cfg" />
+ <property name="jawt.cfg" value="${config}/jawt-x11.cfg" />
+ <property name="window.cfg" value="${config}/glx-x11.cfg" />
+
+ <!-- Set platform directories. -->
+ <property name="stub.includes.platform" value="${stub.includes.x11}" />
+ <property name="java.excludes.platform" value="${java.excludes.x11}" />
+ <dirset id="stub.includes.fileset.platform" dir=".">
+ <include name="${stub.includes.dir}/opengl/**" />
+ <include name="${stub.includes.dir}/x11/**" />
+ </dirset>
+
+ <!-- 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}" />
+
+ <!-- Set up gcc -->
+ <property name="c.compiler" value="gcc" />
+ <property name="c.compiler.optflags" value="-O2" />
+ <property name="c.compiler.flags" value="${c.compiler.optflags} -c -o" />
+ <property name="c.compiler.obj.suffix" value="o" />
+ <property name="c.compiler.jogl.outputfile.expr" value="${rootrel.obj.jogl}/*.${c.compiler.obj.suffix}" />
+ <property name="c.compiler.includes" value="-I&quot;make/stub_includes/opengl&quot; -I&quot;${java.includes.dir}&quot; -I&quot;${java.includes.dir.platform}&quot; -I&quot;make/stub_includes/cg&quot;" />
+ <property name="c.linker" value="gcc" />
+ <property name="c.linker.flags" value="-shared" />
+ <property name="c.linker.jogl.libs" value="-L&quot;${java.lib.dir.platform}&quot; -ljawt -lGL -lGLU" />
+ <property name="rootrel.c.linker.jogl.dso" value="${rootrel.obj}/libjogl.so" />
+ <property name="c.linker.jogl.dso" value="${project.root}/${rootrel.c.linker.jogl.dso}" />
+ <property name="c.linker.jogl.flags" value="-o ${c.linker.jogl.dso}" />
+ <!-- Cg declarations -->
+ <property name="c.compiler.cg.outputfile.expr" value="${rootrel.obj.cg}/*.${c.compiler.obj.suffix}" />
+ <property name="c.linker.cg.libs" value="-L&quot;${x11.cg.lib}&quot; -lcg -lcgGL -lGL" />
+ <property name="rootrel.c.linker.cg.dso" value="${rootrel.obj}/libjogl_cg.so" />
+ <property name="c.linker.cg.dso" value="${project.root}/${rootrel.c.linker.cg.dso}" />
+ <property name="c.linker.cg.flags" value="-o ${c.linker.cg.dso}" />
+ </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}" />
+
+ <!-- Set up Solaris CC -->
+ <property name="c.compiler" value="cc" />
+ <property name="c.compiler.optflags" value="-xO0 -KPIC" />
+ <property name="c.compiler.flags" value="${c.compiler.optflags} -c -o" />
+ <property name="c.compiler.obj.suffix" value="o" />
+ <property name="c.compiler.jogl.outputfile.expr" value="${rootrel.obj.jogl}/*.${c.compiler.obj.suffix}" />
+ <property name="c.compiler.includes" value="-I&quot;make/stub_includes/opengl&quot; -I&quot;${java.includes.dir}&quot; -I&quot;${java.includes.dir.platform}&quot;" />
+ <property name="c.linker" value="cc" />
+ <property name="c.linker.flags" value="-G" />
+ <property name="c.linker.jogl.libs" value="-L&quot;${java.lib.dir.platform}&quot; -ljawt -lGL -lGLU" />
+ <property name="rootrel.c.linker.jogl.dso" value="${rootrel.obj}/libjogl.so" />
+ <property name="c.linker.jogl.dso" value="${project.root}/${rootrel.c.linker.jogl.dso}" />
+ <property name="c.linker.jogl.flags" value="-o ${c.linker.jogl.dso}" />
+ </target>
+
+ <target name="declare.macosx" depends="init">
+ <!-- Set platform configuration files. -->
+ <property name="gl.cfg" value="${config}/gl-macosx.cfg" />
+ <property name="gl.impl.cfg" value="${config}/gl-impl-macosx.cfg" />
+ <property name="glu.cfg" value="${config}/glu.cfg" />
+ <property name="glu.impl.cfg" value="${config}/glu-impl-macosx.cfg" />
+ <property name="jawt.cfg" value="${config}/jawt-macosx.cfg" />
+ <property name="window.cfg" value="${config}/glx-macosx.cfg" />
+ <property name="is.macosx" value="true" />
+
+ <!-- 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}" />
+ <dirset id="stub.includes.fileset.platform" dir=".">
+ <include name="${stub.includes.dir}/macosx/**" />
+ </dirset>
+
+ <!-- Set Javadoc properties. -->
+ <property name="javadoc.dev.packagenames.platform" value="${javadoc.dev.packagenames.macosx}" />
+
+ <!-- Set up gcc -->
+ <property name="c.compiler" value="gcc" />
+ <property name="c.compiler.optflags" value="-O2 -Dmacosx" />
+ <property name="c.compiler.flags" value="${c.compiler.optflags} -c -o" />
+ <property name="c.compiler.obj.suffix" value="o" />
+ <property name="c.compiler.jogl.outputfile.expr" value="${rootrel.obj.jogl}/*.${c.compiler.obj.suffix}" />
+ <property name="c.compiler.includes" value="-I&quot;make/stub_includes/opengl&quot; -I&quot;${java.includes.dir}&quot; -I&quot;${java.includes.dir.platform}&quot; -I&quot;make/stub_includes/cg&quot;" />
+ <property name="c.linker" value="gcc" />
+ <property name="c.linker.flags" value="-bundle" />
+ <property name="c.linker.jogl.libs" value="-framework Cocoa -framework OpenGL -ljawt" />
+ <property name="rootrel.c.linker.jogl.dso" value="${rootrel.obj}/libjogl.jnilib" />
+ <property name="c.linker.jogl.dso" value="${project.root}/${rootrel.c.linker.jogl.dso}" />
+ <property name="c.linker.jogl.flags" value="-o ${c.linker.jogl.dso}" />
+ <!-- Cg declarations -->
+ <property name="c.compiler.cg.outputfile.expr" value="${rootrel.obj.cg}/*.${c.compiler.obj.suffix}" />
+ <property name="c.linker.cg.libs" value="-framework OpenGL -lcg -lcgGL" />
+ <property name="rootrel.c.linker.cg.dso" value="${rootrel.obj}/libjogl_cg.jnilib" />
+ <property name="c.linker.cg.dso" value="${project.root}/${rootrel.c.linker.cg.dso}" />
+ <property name="c.linker.cg.flags" value="-o ${c.linker.cg.dso}" />
+ </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" />
+ <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/jogl/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="net.java.games.gluegen.ant.GlueGenTask"
+ classpathref="gen.classpath" />
+ <taskdef name="staticglgen" classname="net.java.games.gluegen.ant.StaticGLGenTask"
+ classpathref="gen.classpath" />
+
+ <!-- Use the GlueGen and BuildStaticGLInfo tasks to generate the
+ - Java files -->
+
+ <!-- Generate GL interface class -->
+ <gluegen src="${stub.includes.common}/gl.c"
+ config="${gl.cfg}"
+ includeRefid="stub.includes.fileset.all"
+ emitter="net.java.games.gluegen.opengl.GLEmitter">
+ <classpath refid="gen.classpath" />
+ </gluegen>
+
+ <!-- Generate GL implementation class -->
+ <gluegen src="${stub.includes.common}/gl-impl.c"
+ config="${gl.impl.cfg}"
+ includeRefid="stub.includes.fileset.all"
+ emitter="net.java.games.gluegen.opengl.GLEmitter">
+ <classpath refid="gen.classpath" />
+ </gluegen>
+
+ <!-- Generate WGL interface class -->
+ <gluegen src="${stub.includes.dir}/win32/gl-impl.c"
+ config="${config}/gl-wgl-win32.cfg"
+ includeRefid="stub.includes.fileset.all"
+ emitter="net.java.games.gluegen.opengl.GLEmitter">
+ <classpath refid="gen.classpath" />
+ </gluegen>
+
+ <!-- Generate GLX interface class -->
+ <gluegen src="${stub.includes.dir}/x11/gl-impl.c"
+ config="${config}/gl-glx-x11.cfg"
+ includeRefid="stub.includes.fileset.all"
+ emitter="net.java.games.gluegen.opengl.GLEmitter">
+ <classpath refid="gen.classpath" />
+ </gluegen>
+
+ <!-- Generate CGL interface class -->
+ <gluegen src="${stub.includes.dir}/macosx/gl-impl.c"
+ config="${config}/gl-cgl-macosx.cfg"
+ includeRefid="stub.includes.fileset.all"
+ emitter="net.java.games.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. -->
+ <gluegen src="${java.includes.dir.platform}/jawt_md.h"
+ config="${jawt.cfg}"
+ literalInclude="${java.includes.dir}"
+ includeRefid="stub.includes.fileset.platform"
+ emitter="net.java.games.gluegen.JavaEmitter">
+ <classpath refid="gen.classpath" />
+ </gluegen>
+
+ <!-- Generate WGL/GLX/CGL implementation class -->
+ <gluegen src="${stub.includes.platform}/window-system.c"
+ config="${window.cfg}"
+ includeRefid="stub.includes.fileset.platform"
+ emitter="net.java.games.gluegen.JavaEmitter">
+ <classpath refid="gen.classpath" />
+ </gluegen>
+
+ <!-- Generate StaticGLInfo class -->
+ <staticglgen package="net.java.games.jogl.impl"
+ headers="${gl.headers}"
+ outputdir="${src.generated.java}/net/java/games/jogl/impl">
+ <classpath refid="gen.classpath" />
+ </staticglgen>
+
+ <!-- Generate GLU interface class -->
+ <gluegen src="${stub.includes.common}/glu.c"
+ config="${glu.cfg}"
+ includeRefid="stub.includes.fileset.all"
+ emitter="net.java.games.gluegen.opengl.GLEmitter">
+ <classpath refid="gen.classpath" />
+ </gluegen>
+
+ <!-- Generate GLU implementation class -->
+ <gluegen src="${stub.includes.common}/glu-impl.c"
+ config="${glu.impl.cfg}"
+ includeRefid="stub.includes.fileset.all"
+ emitter="net.java.games.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}/net/java/games/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="net.java.games.gluegen.ant.GlueGenTask"
+ classpathref="gen.classpath" />
+ <taskdef name="staticglgen" classname="net.java.games.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="net.java.games.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}/net/java/games/jogl" files="GL.class" />
+ <targetfileset dir="${src.generated.java}/net/java/games/jogl"
+ 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}/net/java/games/jogl/GL.class"
+ targetfile="${src.generated.java}/net/java/games/jogl/DebugGL.java" />
+ </target>
+
+ <target name="java.compile.composable.pipeline" depends="java.compile.composable.pipeline.check" unless="java.compile.composable.pipeline.skip">
+ <java classname="net.java.games.gluegen.opengl.BuildComposablePipeline" fork="yes">
+ <arg value="net.java.games.jogl.GL" />
+ <arg value="${src.generated.java}/net/java/games/jogl" />
+ <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">
+ <src path="${src}" />
+ <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}" source="1.4">
+ <src path="${src}" />
+ <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).
+ -->
+
+ <!--
+ - Check dependencies to see whether we need to recompile .c or .m files
+ -->
+ <target name="c.compile.jogl.check.nonmacosx" unless="is.macosx">
+ <condition property="c.compile.jogl.skip">
+ <and>
+ <uptodate id="uptodate.c">
+ <srcfiles dir="${project.root}" includes="${rootrel.src.c}/*.c" />
+ <mapper type="glob" from="${rootrel.src.c}${sep}*.c" to="${rootrel.obj.jogl}${sep}*.${c.compiler.obj.suffix}" />
+ </uptodate>
+ <uptodate id="uptodate.generated.c">
+ <srcfiles dir="${project.root}" includes="${rootrel.generated.c.jogl}/*.c" />
+ <mapper type="glob" from="${rootrel.generated.c.jogl}${sep}*.c" to="${rootrel.obj.jogl}${sep}*.${c.compiler.obj.suffix}" />
+ </uptodate>
+ </and>
+ </condition>
+ </target>
+
+ <target name="c.compile.jogl.check.macosx" if="is.macosx">
+ <condition property="c.compile.jogl.skip">
+ <and>
+ <uptodate refid="uptodate.c" />
+ <uptodate refid="uptodate.generated.c" />
+ <uptodate>
+ <srcfiles dir="${project.root}" includes="${rootrel.src.c}/*.m" />
+ <mapper type="glob" from="${rootrel.src.c}${sep}*.m" to="${rootrel.obj.jogl}${sep}*.${c.compiler.obj.suffix}" />
+ </uptodate>
+ </and>
+ </condition>
+ </target>
+
+ <target name="c.compile.jogl.check" depends="c.compile.jogl.check.nonmacosx,c.compile.jogl.check.macosx">
+ </target>
+
+ <!--
+ - Compile source files
+ -->
+ <target name="c.compile.jogl.macosx.objs" if="is.macosx">
+ <apply executable="${c.compiler}" dest="${rootrel.obj.jogl}" dir="${project.root}" relative="true" failonerror="true">
+ <arg line="${c.compiler.includes}" />
+ <arg line="${c.compiler.flags}" />
+ <fileset dir="${project.root}">
+ <include name="${rootrel.src.c}/*.m"/>
+ </fileset>
+ <targetfile />
+ <srcfile />
+ <mapper type="glob" from="${rootrel.src.c}${sep}*.m" to="${c.compiler.jogl.outputfile.expr}" />
+ </apply>
+ </target>
+
+ <target name="c.compile.jogl" depends="c.compile.jogl.check" unless="c.compile.jogl.skip">
+ <apply executable="${c.compiler}" dest="${rootrel.obj.jogl}" dir="${project.root}" relative="true" failonerror="true">
+ <arg line="${c.compiler.includes}" />
+ <arg line="${c.compiler.flags}" />
+ <fileset dir="${project.root}">
+ <include name="${rootrel.src.c}/*.c"/>
+ </fileset>
+ <targetfile />
+ <srcfile />
+ <mapper type="glob" from="${rootrel.src.c}${sep}*.c" to="${c.compiler.jogl.outputfile.expr}" />
+ </apply>
+ <apply executable="${c.compiler}" dest="${rootrel.obj.jogl}" dir="${project.root}" relative="true" failonerror="true">
+ <arg line="${c.compiler.includes}" />
+ <arg line="${c.compiler.flags}" />
+ <fileset dir="${project.root}">
+ <include name="${rootrel.generated.c.jogl}/*.c"/>
+ </fileset>
+ <targetfile />
+ <srcfile />
+ <mapper type="glob" from="${rootrel.generated.c.jogl}${sep}*.c" to="${c.compiler.jogl.outputfile.expr}" />
+ </apply>
+ <antcall target="c.compile.jogl.macosx.objs" inheritRefs="true" />
+ </target>
+
+
+ <target name="c.compile.cg.check">
+ <uptodate property="c.compile.cg.skip">
+ <srcfiles dir="${project.root}" includes="${rootrel.generated.c.cg}/*.c" />
+ <mapper type="glob" from="${rootrel.generated.c.cg}${sep}*.c" to="${rootrel.obj.cg}${sep}*.${c.compiler.obj.suffix}" />
+ </uptodate>
+ </target>
+
+ <target name="c.compile.cg" depends="c.compile.cg.check" if="jogl.cg" unless="c.compile.cg.skip">
+ <apply executable="${c.compiler}" dest="${rootrel.obj.cg}" dir="${project.root}" relative="true" failonerror="true">
+ <arg line="${c.compiler.includes}" />
+ <arg line="${c.compiler.flags}" />
+ <fileset dir="${project.root}">
+ <include name="${rootrel.generated.c.cg}/*.c"/>
+ </fileset>
+ <targetfile />
+ <srcfile />
+ <mapper type="glob" from="${rootrel.generated.c.cg}${sep}*.c" to="${c.compiler.cg.outputfile.expr}" />
+ </apply>
+ </target>
+
+ <!--
+ - Link object files
+ -->
+ <target name="c.link.jogl.check">
+ <!-- Check object files against resulting DSO/DLL -->
+ <uptodate property="c.link.jogl.skip">
+ <srcfiles id="c.link.jogl.obj.fileset" dir="${project.root}" includes="${rootrel.obj.jogl}/*.${c.compiler.obj.suffix}" />
+ <mapper type="merge" to="${rootrel.c.linker.jogl.dso}" />
+ </uptodate>
+ </target>
+
+ <target name="c.link.jogl" depends="c.link.jogl.check" unless="c.link.jogl.skip">
+ <pathconvert pathsep=" " property="c.link.jogl.obj.files" refid="c.link.jogl.obj.fileset" />
+ <exec dir="." executable="${c.linker}" failonerror="true">
+ <arg line="${c.linker.jogl.flags}" />
+ <arg line="${c.linker.flags}" />
+ <arg line="${c.link.jogl.obj.files}" />
+ <arg line="${c.linker.jogl.libs}" />
+ </exec>
+ </target>
+
+ <target name="c.link.cg.check">
+ <!-- Check object files against resulting DSO/DLL -->
+ <uptodate property="c.link.cg.skip">
+ <srcfiles id="c.link.cg.obj.fileset" dir="${project.root}" includes="${rootrel.obj.cg}/*.${c.compiler.obj.suffix}" />
+ <mapper type="merge" to="${rootrel.c.linker.cg.dso}" />
+ </uptodate>
+ </target>
+
+ <target name="c.link.cg" depends="c.link.cg.check" if="jogl.cg" unless="c.link.cg.skip">
+ <pathconvert pathsep=" " property="c.link.cg.obj.files" refid="c.link.cg.obj.fileset" />
+ <exec dir="." executable="${c.linker}" failonerror="true">
+ <arg line="${c.linker.cg.flags}" />
+ <arg line="${c.linker.flags}" />
+ <arg line="${c.link.cg.obj.files}" />
+ <arg line="${c.linker.cg.libs}" />
+ </exec>
+ </target>
+
+ <target name="c.compile.jogl.win32.vc6" depends="declare.win32.vc6">
+ <antcall target="c.compile.jogl" inheritRefs="true" />
+ <antcall target="c.link.jogl" inheritRefs="true" />
+ <antcall target="c.compile.cg" inheritRefs="true" />
+ <antcall target="c.link.cg" inheritRefs="true" />
+ </target>
+
+ <target name="c.compile.jogl.win32.vc7" depends="declare.win32.vc7">
+ <antcall target="c.compile.jogl" inheritRefs="true" />
+ <antcall target="c.link.jogl" inheritRefs="true" />
+ <antcall target="c.compile.cg" inheritRefs="true" />
+ <antcall target="c.link.cg" inheritRefs="true" />
+ </target>
+
+ <target name="c.compile.jogl.win32.mingw" depends="declare.win32.mingw">
+ <antcall target="c.compile.jogl" inheritRefs="true" />
+ <antcall target="c.link.jogl" inheritRefs="true" />
+ <antcall target="c.compile.cg" inheritRefs="true" />
+ <antcall target="c.link.cg" inheritRefs="true" />
+ </target>
+
+ <target name="c.compile.jogl.linux" depends="declare.linux">
+ <antcall target="c.compile.jogl" inheritRefs="true" />
+ <antcall target="c.link.jogl" inheritRefs="true" />
+ <antcall target="c.compile.cg" inheritRefs="true" />
+ <antcall target="c.link.cg" inheritRefs="true" />
+ </target>
+
+ <target name="c.compile.jogl.solaris" depends="declare.solaris">
+ <antcall target="c.compile.jogl" inheritRefs="true" />
+ <antcall target="c.link.jogl" inheritRefs="true" />
+ </target>
+
+ <target name="c.compile.jogl.macosx" depends="declare.macosx">
+ <antcall target="c.compile.jogl" inheritRefs="true" />
+ <antcall target="c.link.jogl" inheritRefs="true" />
+ <antcall target="c.compile.cg" inheritRefs="true" />
+ <antcall target="c.link.cg" inheritRefs="true" />
+ </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="net/java/games/jogl/**" />
+ <include name="net/java/games/gluegen/runtime/**" />
+ <include name="net/java/games/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="init" unless="jogl.cg">
+ <!-- Build the general Javadoc -->
+ <javadoc packagenames="${javadoc.packagenames}"
+ sourcepath="${src};${src.generated.java}"
+ destdir="${javadoc}" windowtitle="JOGL API"
+ source="1.4"
+ link="${javadoc.link}" />
+ </target>
+
+ <!-- Same as above but with Cg directories added -->
+ <target name="javadoc.cg" depends="init" if="jogl.cg">
+ <!-- Build the general Javadoc -->
+ <javadoc packagenames="${javadoc.packagenames},net.java.games.cg"
+ sourcepath="${src};${src.generated.java}"
+ destdir="${javadoc}" windowtitle="JOGL API"
+ source="1.4"
+ link="${javadoc.link}" />
+ </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};${src.generated.java}"
+ destdir="${javadoc.dev}" windowtitle="JOGL API"
+ source="1.4"
+ link="${javadoc.link}" />
+ </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},net.java.games.cg"
+ sourcepath="${src};${src.generated.java}"
+ destdir="${javadoc.dev}" windowtitle="JOGL API"
+ source="1.4"
+ link="${javadoc.link}" />
+ </target>
+
+ <target name="javadoc.dev.win32" depends="setup.java.home.dir.nonmacosx,declare.win32,javadoc.dev.nocg,javadoc.dev.cg" />
+ <target name="javadoc.dev.x11" depends="setup.java.home.dir.nonmacosx,declare.x11,javadoc.dev.nocg,javadoc.dev.cg" />
+ <target name="javadoc.dev.macosx" depends="setup.java.home.dir.macosx,declare.macosx,javadoc.dev.nocg,javadoc.dev.cg" />
+
+ <!-- ================================================================== -->
+ <!--
+ - 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" depends="init">
+ <fail>
+
+Use a platform specific target: win32.vc6, win32.vc7, win32.mingw, linux, macosx
+ </fail>
+ </target>
+
+ <!--
+ - Win32 with MS VC6
+ -->
+ <target name="win32.vc6" depends="setup.java.home.dir.nonmacosx, 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.nonmacosx, 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.nonmacosx, 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="setup.java.home.dir.nonmacosx, 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>
+
+ <!--
+ - Solaris (assuming Solaris CC)
+ -->
+ <target name="solaris" depends="setup.java.home.dir.nonmacosx, 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.solaris" />
+ </target>
+
+ <!--
+ - Mac OSX
+ -->
+ <target name="macosx" depends="setup.java.home.dir.macosx, 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>
+</project>
diff --git a/make/cg-common.cfg b/make/cg-common.cfg
index d866ed860..f83ef37b8 100644
--- a/make/cg-common.cfg
+++ b/make/cg-common.cfg
@@ -56,6 +56,7 @@ RuntimeExceptionType CgException
# generated C code
#
+CustomCCode #include <stdlib.h>
CustomCCode #include <CG/CgGL.h>
ArgumentIsString fooString 0
diff --git a/make/host.properties b/make/host.properties
new file mode 100644
index 000000000..81316c556
--- /dev/null
+++ b/make/host.properties
@@ -0,0 +1,49 @@
+###############################################################################
+#
+# The host specific properties. The build will inform you of required
+# properties.
+###############################################################################
+#
+# java.home.dir is usually inferred from the java.home variable.
+# If it appears the build is failing because of an inability to
+# find e.g. JAWT or JNI headers, override this to point to the
+# root directory of your JDK.
+#
+# java.home.dir=C:/jdk1.4.2
+
+#
+# The required antlr.jar property that is the full path to the antlr.jar
+# including the name of the jar
+#
+antlr.jar=C:/Users/kbr/ANTLR/antlr-2.7.2/antlr.jar
+
+#
+# Force the use of jikes in +E (emacs) mode
+# NOTE: this is optional
+#
+#build.compiler=jikes
+#build.compiler.emacs=true
+
+#
+# If you are building on Windows with Visual C++ 6.0 and have installed
+# the compiler in somewhere other than the default location, modify this
+# to point to the absolute path of the VC98 directory
+#
+vc6.root=C:/Program Files/Microsoft Visual Studio/VC98
+
+#
+# If you are building on Windows with Visual C++ 7.0 and have installed
+# the compiler in somewhere other than the default location, modify this
+# to point to the absolute path of the VC98 directory
+#
+vc7.root=C:/Program Files/Microsoft Visual Studio .NET/Vc7
+
+#
+# If you are building the Cg binding (by specifying -Djogl.cg=1 to the
+# Ant build) and have installed the Cg SDK in somewhere other than the
+# default location, modify the appropriate variable to point to the
+# absolute path of the lib directory
+#
+windows.cg.lib=C:/Program Files/Nvidia Corporation/Cg/lib
+x11.cg.lib=FIXME: install Cg toolkit and enter default path
+macosx.cg.lib=FIXME: install Cg toolkit and enter default path
diff --git a/make/stub_includes/common/cg.c b/make/stub_includes/common/cg.c
new file mode 100644
index 000000000..98c824285
--- /dev/null
+++ b/make/stub_includes/common/cg.c
@@ -0,0 +1,26 @@
+// Define __gl_h_ so that GL/gl.h doesn't get bound as part of CgGL.java
+// because cgGL.h tries to include it
+#define __gl_h_
+
+// Define some types so that cgGL.h has the types it expected to get by
+// including GL/gl.h (which we disabled above)
+typedef unsigned int GLenum;
+typedef unsigned char GLboolean;
+typedef unsigned int GLbitfield;
+typedef void GLvoid;
+typedef signed char GLbyte; /* 1-byte signed */
+typedef short GLshort; /* 2-byte signed */
+typedef int GLint; /* 4-byte signed */
+typedef unsigned char GLubyte; /* 1-byte unsigned */
+typedef unsigned short GLushort; /* 2-byte unsigned */
+typedef unsigned int GLuint; /* 4-byte unsigned */
+typedef int GLsizei; /* 4-byte signed */
+typedef float GLfloat; /* single precision float */
+typedef float GLclampf; /* single precision float in [0,1] */
+typedef double GLdouble; /* double precision float */
+typedef double GLclampd; /* double precision float in [0,1] */
+
+#define CGDLL_API
+#include <CG/cgGL.h>
+
+
diff --git a/make/stub_includes/common/gl-impl.c b/make/stub_includes/common/gl-impl.c
new file mode 100644
index 000000000..53221a21a
--- /dev/null
+++ b/make/stub_includes/common/gl-impl.c
@@ -0,0 +1,23 @@
+#define GLAPI
+
+// Define GL_GLEXT_PROTOTYPES so that the OpenGL extension prototypes in
+// "glext.h" are parsed.
+#define GL_GLEXT_PROTOTYPES
+
+#include <GL/gl.h>
+
+// Define GLX_GLXEXT_PROTOTYPES so that the OpenGL GLX extension prototypes in
+// "glxext.h" are parsed.
+#define GLX_GLXEXT_PROTOTYPES
+#include <X11/Xlib.h>
+#include <X11/Xutil.h>
+#include <GL/glxext.h>
+
+// Bring in the wgl extensions
+#define WGL_WGLEXT_PROTOTYPES
+#define SKIP_WGL_HANDLE_DEFINITIONS
+#include <windows.h>
+#include <GL/wglext.h>
+
+// Bring in the Mac OS X cgl extensions
+#include <GL/cglext.h>
diff --git a/make/stub_includes/common/gl.c b/make/stub_includes/common/gl.c
new file mode 100644
index 000000000..e91ee95f3
--- /dev/null
+++ b/make/stub_includes/common/gl.c
@@ -0,0 +1,7 @@
+#define GLAPI
+
+// Define GL_GLEXT_PROTOTYPES so that the OpenGL extension prototypes in
+// "glext.h" are parsed.
+#define GL_GLEXT_PROTOTYPES
+
+#include <GL/gl.h>
diff --git a/make/stub_includes/common/glu-impl.c b/make/stub_includes/common/glu-impl.c
new file mode 100644
index 000000000..2328639d8
--- /dev/null
+++ b/make/stub_includes/common/glu-impl.c
@@ -0,0 +1,3 @@
+#include <GL/glu.h>
+
+
diff --git a/make/stub_includes/common/glu.c b/make/stub_includes/common/glu.c
new file mode 100644
index 000000000..91020e365
--- /dev/null
+++ b/make/stub_includes/common/glu.c
@@ -0,0 +1,2 @@
+#include <GL/glu.h>
+
diff --git a/make/validate-properties.xml b/make/validate-properties.xml
new file mode 100644
index 000000000..e5ed6889c
--- /dev/null
+++ b/make/validate-properties.xml
@@ -0,0 +1,65 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!--
+ - A validator for all of the user-defined properties. It will be called
+ - from build.xml in the "init" task.
+ -->
+<project name="Configuration validator" default="validate">
+
+ <!-- ================================================================== -->
+ <!--
+ - Ensure that "antlr.jar" is set.
+ -->
+ <target name="antlr.jar.validate" unless="antlr.jar">
+ <fail>
+
+ **************************************************************
+ ** The property &quot;antlr.jar&quot; was not set in host.properties. **
+ ** Please set &quot;antlr.jar&quot; to the full path of the ANTLR jar **
+ ** including the jar itself. **
+ **************************************************************
+ </fail>
+ </target>
+
+ <!--
+ - Ensure that "java.home.dir" is set.
+ - NOTE: "java.home" is an internal property for ANT that is not
+ - typically set to what the build needs it to be.
+ -->
+ <target name="java.home.dir.validate" unless="java.home.dir">
+ <fail>
+
+ ******************************************************************
+ ** The property &quot;java.home.dir&quot; was not set in host.properties. **
+ ** Please set &quot;java.home.dir&quot; to your JAVA_HOME directory. **
+ ******************************************************************
+ </fail>
+ </target>
+
+ <!--
+ - Make sure that jogl.jar is not on the CLASSPATH; this can cause
+ - builds to fail since if this Java process has the jar file open
+ - we can not overwrite it.
+ -->
+ <target name="test.for.jogl.jar">
+ <available property="jogl.jar.on.class.path" classname="net.java.games.jogl.GL" />
+ </target>
+ <target name="java.class.path.validate" depends="test.for.jogl.jar" if="jogl.jar.on.class.path">
+ <fail>
+
+ ******************************************************************
+ ** Your CLASSPATH environment variable appears to be set (some **
+ ** JOGL classes are currently visible to the build.) This can **
+ ** cause the build to fail. Please unset your CLASSPATH **
+ ** variable and restart the build. **
+ ******************************************************************
+ </fail>
+ </target>
+
+ <!-- ================================================================== -->
+ <!--
+ - Validate the required properties
+ -->
+ <target name="validate" depends="antlr.jar.validate, java.home.dir.validate, java.class.path.validate"
+ description="Validate required properties" />
+
+</project>
diff --git a/src/net/java/games/gluegen/FunctionEmitter.java b/src/net/java/games/gluegen/FunctionEmitter.java
index cb5ef4159..097d8d0be 100644
--- a/src/net/java/games/gluegen/FunctionEmitter.java
+++ b/src/net/java/games/gluegen/FunctionEmitter.java
@@ -101,7 +101,7 @@ public abstract class FunctionEmitter
emit(getDefaultOutput());
}
- /** Returns, as a String, whatever {@link emit()} would output. */
+ /** Returns, as a String, whatever {@link #emit} would output. */
public String toString()
{
StringWriter sw = new StringWriter(500);
diff --git a/src/net/java/games/gluegen/JavaConfiguration.java b/src/net/java/games/gluegen/JavaConfiguration.java
index 3950a7014..35586cb80 100644
--- a/src/net/java/games/gluegen/JavaConfiguration.java
+++ b/src/net/java/games/gluegen/JavaConfiguration.java
@@ -112,7 +112,7 @@ public class JavaConfiguration {
private Map/*<String,String>*/ javaTypeRenames = new HashMap();
/** Reads the configuration file.
- @param path to file that should be read
+ @param filename path to file that should be read
*/
public final void read(String filename) throws IOException {
read(filename, null);
@@ -120,7 +120,7 @@ public class JavaConfiguration {
/** Reads the specified file, treating each line as if it started with the
specified string.
- @param path to file that should be read
+ @param filename path to file that should be read
@param linePrefix if not null, treat each line read as if it were
prefixed with the specified string.
*/
@@ -345,7 +345,7 @@ public class JavaConfiguration {
/** Returns the package into which to place the glue code for
accessing the specified struct. Defaults to emitting into the
- regular package (i.e., the result of {@link getPackage}}. */
+ regular package (i.e., the result of {@link #packageName}). */
public String packageForStruct(String structName) {
String res = (String) structPackages.get(structName);
if (res == null) {
diff --git a/src/net/java/games/gluegen/ant/GlueGenTask.java b/src/net/java/games/gluegen/ant/GlueGenTask.java
new file mode 100644
index 000000000..531f1198e
--- /dev/null
+++ b/src/net/java/games/gluegen/ant/GlueGenTask.java
@@ -0,0 +1,493 @@
+package net.java.games.gluegen.ant;
+
+/*
+ * GlueGenTask.java
+ * Copyright (C) 2003 Rob Grzywinski ([email protected])
+ *
+ * Copying, distribution and use of this software in source and binary
+ * forms, with or without modification, is permitted provided that the
+ * following conditions are met:
+ *
+ * Distributions of source code must reproduce the copyright notice,
+ * this list of conditions and the following disclaimer in the source
+ * code header files; and Distributions of binary code must reproduce
+ * the copyright notice, this list of conditions and the following
+ * disclaimer in the documentation, Read me file, license file and/or
+ * other materials provided with the software distribution.
+ *
+ * The names of Sun Microsystems, Inc. ("Sun") and/or the copyright
+ * holder may not be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS," WITHOUT A WARRANTY OF ANY
+ * KIND. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND
+ * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, NON-INTERFERENCE, ACCURACY OF
+ * INFORMATIONAL CONTENT OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. THE
+ * COPYRIGHT HOLDER, SUN AND SUN'S LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL THE
+ * COPYRIGHT HOLDER, SUN OR SUN'S LICENSORS BE LIABLE FOR ANY LOST
+ * REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL,
+ * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND
+ * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR
+ * INABILITY TO USE THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGES. YOU ACKNOWLEDGE THAT THIS SOFTWARE IS NOT
+ * DESIGNED, LICENSED OR INTENDED FOR USE IN THE DESIGN, CONSTRUCTION,
+ * OPERATION OR MAINTENANCE OF ANY NUCLEAR FACILITY. THE COPYRIGHT
+ * HOLDER, SUN AND SUN'S LICENSORS DISCLAIM ANY EXPRESS OR IMPLIED
+ * WARRANTY OF FITNESS FOR SUCH USES.
+ */
+
+import java.io.IOException;
+import java.util.Iterator;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.Execute;
+import org.apache.tools.ant.taskdefs.LogStreamHandler;
+import org.apache.tools.ant.types.CommandlineJava;
+import org.apache.tools.ant.types.DirSet;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.PatternSet;
+import org.apache.tools.ant.types.Reference;
+import org.apache.tools.ant.util.JavaEnvUtils;
+
+/**
+ * <p>An <a href="http://ant.apache.org">ANT</a> {@link org.apache.tools.ant.Task}
+ * for using {@link net.java.games.gluegen.GlueGen}.</p>
+ *
+ * <p>Usage:</p>
+ * <pre>
+ &lt;gluegen src="[source C file]"
+ includes="[optional directory pattern of include files to include]"
+ excludes="[optional directory pattern of include files to exclude]"
+ includeRefid="[optional FileSet or DirSet for include files]"
+ literalInclude="[optional hack to get around FileSet / DirSet issues with different drives]"
+ emitter="[emitter class name]"
+ config="[configuration file]" /&gt;
+ * </pre>
+ *
+ * @author Rob Grzywinski <a href="mailto:[email protected]">[email protected]</a>
+ */
+// FIXME: blow out javadoc
+// NOTE: this has not been exhaustively tested
+public class GlueGenTask extends Task
+{
+ /**
+ * <p>The {@link net.java.games.gluegen.GlueGen} classname.</p>
+ */
+ private static final String GLUE_GEN = "net.java.games.gluegen.GlueGen";
+
+ // =========================================================================
+ /**
+ * <p>The {@link org.apache.tools.ant.types.CommandlineJava} that is used
+ * to execute {@link net.java.games.gluegen.GlueGen}.</p>
+ */
+ private CommandlineJava gluegenCommandline;
+
+ // =========================================================================
+ /**
+ * <p>The name of the emitter class.</p>
+ */
+ private String emitter;
+
+ /**
+ * <p>The configuration file name.</p>
+ */
+ private String configuration;
+
+ /**
+ * <p>The name of the source C file that is to be parsed.</p>
+ */
+ private String sourceFile;
+
+ /**
+ * <p>The {@link org.apache.tools.ant.types.FileSet} of includes.</p>
+ */
+ private FileSet includeSet = new FileSet();
+
+ /**
+ * <p>Because a {@link org.apache.tools.ant.types.FileSet} will include
+ * everything in its base directory if it is left untouched, the <code>includeSet</code>
+ * must only be added to the set of includes if it has been <i>explicitly</i>
+ * set.</p>
+ */
+ private boolean usedIncludeSet = false; // by default it is not used
+
+ /**
+ * <p>The set of include sets. This allows includes to be added in multiple
+ * fashions.</p>
+ */
+ // FIXME: rename to listXXXX
+ private List setOfIncludeSets = new LinkedList();
+
+ /**
+ * <p>A single literal directory to include. This is to get around the
+ * fact that neither {@link org.apache.tools.ant.types.FileSet} nor
+ * {@link org.apache.tools.ant.types.DirSet} can handle multiple drives in
+ * a sane manner. If <code>null</code> then it has not been specified.</p>
+ */
+ private String literalInclude;
+
+ // =========================================================================
+ /**
+ * <p>Create and add the VM and classname to {@link org.apache.tools.ant.types.CommandlineJava}.</p>
+ */
+ public GlueGenTask()
+ {
+ // create the CommandlineJava that will be used to call GlueGen
+ gluegenCommandline = new CommandlineJava();
+
+ // set the VM and classname in the commandline
+ gluegenCommandline.setVm(JavaEnvUtils.getJreExecutable("java"));
+ gluegenCommandline.setClassname(GLUE_GEN);
+ }
+
+ // =========================================================================
+ // ANT getters and setters
+ /**
+ * <p>Set the emitter class name. This is called by ANT.</p>
+ *
+ * @param emitter the name of the emitter class
+ */
+ public void setEmitter(String emitter)
+ {
+ log( ("Setting emitter class name to: " + emitter), Project.MSG_VERBOSE);
+ this.emitter = emitter;
+ }
+
+ /**
+ * <p>Set the configuration file name. This is called by ANT.</p>
+ *
+ * @param configuration the name of the configuration file
+ */
+ public void setConfig(String configuration)
+ {
+ log( ("Setting configuration file name to: " + configuration),
+ Project.MSG_VERBOSE);
+ this.configuration = configuration;
+ }
+
+ /**
+ * <p>Set the source C file that is to be parsed. This is called by ANT.</p>
+ *
+ * @param sourceFile the name of the source file
+ */
+ public void setSrc(String sourceFile)
+ {
+ log( ("Setting source file name to: " + sourceFile), Project.MSG_VERBOSE);
+ this.sourceFile = sourceFile;
+ }
+
+ /**
+ * <p>Set a single literal include directory. See the <code>literalInclude</code>
+ * javadoc for more information.</p>
+ *
+ * @param directory the directory to include
+ */
+ public void setLiteralInclude(String directory)
+ {
+ this.literalInclude = directory;
+ }
+
+ /**
+ * <p>Add an include file to the list. This is called by ANT for a nested
+ * element.</p>
+ *
+ * @return {@link org.apache.tools.ant.types.PatternSet.NameEntry}
+ */
+ public PatternSet.NameEntry createInclude()
+ {
+ usedIncludeSet = true;
+ return includeSet.createInclude();
+ }
+
+ /**
+ * <p>Add an include file to the list. This is called by ANT for a nested
+ * element.</p>
+ *
+ * @return {@link org.apache.tools.ant.types.PatternSet.NameEntry}
+ */
+ public PatternSet.NameEntry createIncludesFile()
+ {
+ usedIncludeSet = true;
+ return includeSet.createIncludesFile();
+ }
+
+ /**
+ * <p>Set the set of include patterns. Patterns may be separated by a comma
+ * or a space. This is called by ANT.</p>
+ *
+ * @param includes the string containing the include patterns
+ */
+ public void setIncludes(String includes)
+ {
+ usedIncludeSet = true;
+ includeSet.setIncludes(includes);
+ }
+
+ /**
+ * <p>Add an include file to the list that is to be exluded. This is called
+ * by ANT for a nested element.</p>
+ *
+ * @return {@link org.apache.tools.ant.types.PatternSet.NameEntry}
+ */
+ public PatternSet.NameEntry createExclude()
+ {
+ usedIncludeSet = true;
+ return includeSet.createExclude();
+ }
+
+ /**
+ * <p>Add an exclude file to the list. This is called by ANT for a nested
+ * element.</p>
+ *
+ * @return {@link org.apache.tools.ant.types.PatternSet.NameEntry}
+ */
+ public PatternSet.NameEntry createExcludesFile()
+ {
+ usedIncludeSet = true;
+ return includeSet.createExcludesFile();
+ }
+
+ /**
+ * <p>Set the set of exclude patterns. Patterns may be separated by a comma
+ * or a space. This is called by ANT.</p>
+ *
+ * @param includes the string containing the exclude patterns
+ */
+ public void setExcludes(String excludes)
+ {
+ usedIncludeSet = true;
+ includeSet.setExcludes(excludes);
+ }
+
+ /**
+ * <p>Set a {@link org.apache.tools.ant.types.Reference} to simplify adding
+ * of complex sets of files to include. This is called by ANT.</p>?
+ *
+ * @param reference a <code>Reference</code> to a {@link org.apache.tools.ant.types.FileSet}
+ * or {@link org.apache.tools.ant.types.DirSet}
+ * @throws BuildException if the specified <code>Reference</code> is not
+ * either a <code>FileSet</code> or <code>DirSet</code>
+ */
+ public void setIncludeRefid(Reference reference)
+ {
+ // ensure that the referenced object is either a FileSet or DirSet
+ final Object referencedObject = reference.getReferencedObject(getProject());
+ if( !( (referencedObject instanceof FileSet) ||
+ (referencedObject instanceof DirSet)) )
+ {
+ throw new BuildException("Only FileSets or DirSets are allowed as an include refid.");
+ }
+
+ // add the referenced object to the set of include sets
+ setOfIncludeSets.add(referencedObject);
+ }
+
+ /**
+ * <p>Add a nested {@link org.apache.tools.ant.types.DirSet} to specify
+ * the files to include. This is called by ANT.</p>
+ *
+ * @param dirset the <code>DirSet</code> to be added
+ */
+ public void addDirset(DirSet dirset)
+ {
+ setOfIncludeSets.add(dirset);
+ }
+
+ /**
+ * <p>Add an optional classpath that defines the location of {@link net.java.games.gluegen.GlueGen}
+ * and <code>GlueGen</code>'s dependencies.</p>
+ *
+ * @returns {@link org.apache.tools.ant.types.Path}
+ */
+ public Path createClasspath()
+ {
+ return gluegenCommandline.createClasspath(project).createPath();
+ }
+
+ // =========================================================================
+ /**
+ * <p>Run the task. This involves validating the set attributes, creating
+ * the command line to be executed and finally executing the command.</p>
+ *
+ * @see org.apache.tools.ant.Task#execute()
+ */
+ public void execute()
+ throws BuildException
+ {
+ // validate that all of the required attributes have been set
+ validateAttributes();
+
+ // TODO: add logic to determine if the generated file needs to be
+ // regenerated
+
+ // add the attributes to the CommandlineJava
+ addAttributes();
+
+ log(gluegenCommandline.describeCommand(), Project.MSG_VERBOSE);
+
+ // execute the command and throw on error
+ final int error = execute(gluegenCommandline.getCommandline());
+ if(error == 1)
+ throw new BuildException( ("GlueGen returned: " + error), location);
+ }
+
+ /**
+ * <p>Ensure that the user specified all required arguments.</p>
+ *
+ * @throws BuildException if there are required arguments that are not
+ * present or not valid
+ */
+ private void validateAttributes()
+ throws BuildException
+ {
+ // validate that the emitter class is set
+ if(!isValid(emitter))
+ throw new BuildException("Invalid emitter class name: " + emitter);
+
+ // validate that the configuration file is set
+ if(!isValid(configuration))
+ throw new BuildException("Invalid configuration file name: " + configuration);
+
+ // validate that the source file is set
+ if(!isValid(sourceFile))
+ throw new BuildException("Invalid source file name: " + sourceFile);
+
+ // CHECK: do there need to be includes to be valid?
+ }
+
+ /**
+ * <p>Is the specified string valid? A valid string is non-<code>null</code>
+ * and has a non-zero length.</p>
+ *
+ * @param string the string to be tested for validity
+ * @return <code>true</code> if the string is valid. <code>false</code>
+ * otherwise.
+ */
+ private boolean isValid(String string)
+ {
+ // check for null
+ if(string == null)
+ return false;
+
+ // ensure that the string has a non-zero length
+ // NOTE: must trim() to remove leading and trailing whitespace
+ if(string.trim().length() < 1)
+ return false;
+
+ // the string is valid
+ return true;
+ }
+
+ /**
+ * <p>Add all of the attributes to the command line. They have already
+ * been validated.</p>
+ */
+ private void addAttributes()
+ throws BuildException
+ {
+ // NOTE: GlueGen uses concatenated flag / value rather than two
+ // separate arguments
+
+ // add the emitter class name
+ gluegenCommandline.createArgument().setValue("-E" + emitter);
+
+ // add the configuration file name
+ gluegenCommandline.createArgument().setValue("-C" + configuration);
+
+ // add the includedSet to the setOfIncludeSets to simplify processing
+ // all types of include sets ONLY if it has been set.
+ // NOTE: see the usedIncludeSet member javadoc for more info
+ // NOTE: references and nested DirSets have already been added to the
+ // set of include sets
+ if(usedIncludeSet)
+ {
+ includeSet.setDir(getProject().getBaseDir()); // NOTE: the base dir must be set
+ setOfIncludeSets.add(includeSet);
+ }
+
+ // iterate over all include sets and add their directories to the
+ // list of included directories.
+ final List includedDirectories = new LinkedList();
+ for(Iterator includes=setOfIncludeSets.iterator(); includes.hasNext(); )
+ {
+ // get the included set and based on its type add the directories
+ // to includedDirectories
+ Object include = (Object)includes.next();
+ final String[] directoryDirs;
+ if(include instanceof FileSet)
+ {
+ final FileSet fileSet = (FileSet)include;
+ DirectoryScanner directoryScanner = fileSet.getDirectoryScanner(getProject());
+ directoryDirs = directoryScanner.getIncludedDirectories();
+ } else if(include instanceof DirSet)
+ {
+ final DirSet dirSet = (DirSet)include;
+ DirectoryScanner directoryScanner = dirSet.getDirectoryScanner(getProject());
+ directoryDirs = directoryScanner.getIncludedDirectories();
+ } else
+ {
+ // NOTE: this cannot occur as it is checked on setXXX() but
+ // just to be pedantic this is here
+ throw new BuildException("Invalid included construct.");
+ }
+
+ // add the directoryDirs to the includedDirectories
+ // TODO: exclude any directory that is already in the list
+ for(int i=0; i<directoryDirs.length; i++)
+ {
+ includedDirectories.add(directoryDirs[i]);
+ }
+ }
+
+ // if literalInclude is valid then add it to the list of included
+ // directories
+ if(isValid(literalInclude))
+ includedDirectories.add(literalInclude);
+
+ // add the included directories to the command
+ for(Iterator includes=includedDirectories.iterator(); includes.hasNext(); )
+ {
+ String directory = (String)includes.next();
+ gluegenCommandline.createArgument().setValue("-I" + directory);
+ }
+
+ // finally, add the source file
+ gluegenCommandline.createArgument().setValue(sourceFile);
+ }
+
+ /**
+ * <p>Execute {@link net.java.games.gluegen.GlueGen} in a forked JVM.</p>
+ *
+ * @throws BuildException
+ */
+ private int execute(String[] command)
+ throws BuildException
+ {
+ // create the object that will perform the command execution
+ Execute execute = new Execute(new LogStreamHandler(this, Project.MSG_INFO,
+ Project.MSG_WARN),
+ null);
+
+ // set the project and command line
+ execute.setAntRun(project);
+ execute.setCommandline(command);
+
+ // execute the command
+ try
+ {
+ return execute.execute();
+ } catch(IOException ioe)
+ {
+ throw new BuildException(ioe, location);
+ }
+ }
+}
diff --git a/src/net/java/games/gluegen/ant/StaticGLGenTask.java b/src/net/java/games/gluegen/ant/StaticGLGenTask.java
new file mode 100644
index 000000000..35ed2d504
--- /dev/null
+++ b/src/net/java/games/gluegen/ant/StaticGLGenTask.java
@@ -0,0 +1,303 @@
+package net.java.games.gluegen.ant;
+
+/*
+ * StaticGLGenTask.java
+ * Copyright (C) 2003 Rob Grzywinski ([email protected])
+ *
+ * Copying, distribution and use of this software in source and binary
+ * forms, with or without modification, is permitted provided that the
+ * following conditions are met:
+ *
+ * Distributions of source code must reproduce the copyright notice,
+ * this list of conditions and the following disclaimer in the source
+ * code header files; and Distributions of binary code must reproduce
+ * the copyright notice, this list of conditions and the following
+ * disclaimer in the documentation, Read me file, license file and/or
+ * other materials provided with the software distribution.
+ *
+ * The names of Sun Microsystems, Inc. ("Sun") and/or the copyright
+ * holder may not be used to endorse or promote products derived from
+ * this software without specific prior written permission.
+ *
+ * THIS SOFTWARE IS PROVIDED "AS IS," WITHOUT A WARRANTY OF ANY
+ * KIND. ALL EXPRESS OR IMPLIED CONDITIONS, REPRESENTATIONS AND
+ * WARRANTIES, INCLUDING ANY IMPLIED WARRANTY OF MERCHANTABILITY,
+ * FITNESS FOR A PARTICULAR PURPOSE, NON-INTERFERENCE, ACCURACY OF
+ * INFORMATIONAL CONTENT OR NON-INFRINGEMENT, ARE HEREBY EXCLUDED. THE
+ * COPYRIGHT HOLDER, SUN AND SUN'S LICENSORS SHALL NOT BE LIABLE FOR
+ * ANY DAMAGES SUFFERED BY LICENSEE AS A RESULT OF USING, MODIFYING OR
+ * DISTRIBUTING THIS SOFTWARE OR ITS DERIVATIVES. IN NO EVENT WILL THE
+ * COPYRIGHT HOLDER, SUN OR SUN'S LICENSORS BE LIABLE FOR ANY LOST
+ * REVENUE, PROFIT OR DATA, OR FOR DIRECT, INDIRECT, SPECIAL,
+ * CONSEQUENTIAL, INCIDENTAL OR PUNITIVE DAMAGES, HOWEVER CAUSED AND
+ * REGARDLESS OF THE THEORY OF LIABILITY, ARISING OUT OF THE USE OF OR
+ * INABILITY TO USE THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY
+ * OF SUCH DAMAGES. YOU ACKNOWLEDGE THAT THIS SOFTWARE IS NOT
+ * DESIGNED, LICENSED OR INTENDED FOR USE IN THE DESIGN, CONSTRUCTION,
+ * OPERATION OR MAINTENANCE OF ANY NUCLEAR FACILITY. THE COPYRIGHT
+ * HOLDER, SUN AND SUN'S LICENSORS DISCLAIM ANY EXPRESS OR IMPLIED
+ * WARRANTY OF FITNESS FOR SUCH USES.
+ */
+
+import java.io.IOException;
+
+import org.apache.tools.ant.BuildException;
+import org.apache.tools.ant.DirectoryScanner;
+import org.apache.tools.ant.Project;
+import org.apache.tools.ant.Task;
+import org.apache.tools.ant.taskdefs.Execute;
+import org.apache.tools.ant.taskdefs.LogStreamHandler;
+import org.apache.tools.ant.types.CommandlineJava;
+import org.apache.tools.ant.types.FileSet;
+import org.apache.tools.ant.types.Path;
+import org.apache.tools.ant.types.PatternSet;
+import org.apache.tools.ant.util.JavaEnvUtils;
+
+/**
+ * <p>An <a href="http://ant.apache.org">ANT</a> {@link org.apache.tools.ant.Task}
+ * for using {@link net.java.games.gluegen.opengl.BuildStaticGLInfo}.</p>
+ *
+ * <p>Usage:</p>
+ * <pre>
+ &lt;staticglgen package="[generated files package]"
+ headers="[file pattern of GL headers]"
+ outputdir="[directory to output the generated files]" /&gt;
+ * </pre>
+ *
+ * @author Rob Grzywinski <a href="mailto:[email protected]">[email protected]</a>
+ */
+// FIXME: blow out javadoc
+public class StaticGLGenTask extends Task
+{
+ /**
+ * <p>The {@link net.java.games.gluegen.opengl.BuildStaticGLInfo} classname.</p>
+ */
+ private static final String GL_GEN = "net.java.games.gluegen.opengl.BuildStaticGLInfo";
+
+ // =========================================================================
+ /**
+ * <p>The {@link org.apache.tools.ant.types.CommandlineJava} that is used
+ * to execute {@link net.java.games.gluegen.opengl.BuildStaticGLInfo}.</p>
+ */
+ private CommandlineJava glgenCommandline;
+
+ // =========================================================================
+ /**
+ * <p>The package name for the generated files.</p>
+ */
+ private String packageName;
+
+ /**
+ * <p>The output directory.</p>
+ */
+ private String outputDirectory;
+
+ /**
+ * <p>The {@link org.apache.tools.ant.types.FileSet} of GL headers.</p>
+ */
+ private FileSet headerSet = new FileSet();
+
+ // =========================================================================
+ /**
+ * <p>Create and add the VM and classname to {@link org.apache.tools.ant.types.CommandlineJava}.</p>
+ */
+ public StaticGLGenTask()
+ {
+ // create the CommandlineJava that will be used to call BuildStaticGLInfo
+ glgenCommandline = new CommandlineJava();
+
+ // set the VM and classname in the commandline
+ glgenCommandline.setVm(JavaEnvUtils.getJreExecutable("java"));
+ glgenCommandline.setClassname(GL_GEN);
+ }
+
+ // =========================================================================
+ // ANT getters and setters
+ /**
+ * <p>Set the package name for the generated files. This is called by ANT.</p>
+ *
+ * @param packageName the name of the package for the generated files
+ */
+ public void setPackage(String packageName)
+ {
+ log( ("Setting package name to: " + packageName), Project.MSG_VERBOSE);
+ this.packageName = packageName;
+ }
+
+ /**
+ * <p>Set the output directory. This is called by ANT.</p>
+ *
+ * @param directory the output directory
+ */
+ public void setOutputDir(String directory)
+ {
+ log( ("Setting output directory to: " + directory),
+ Project.MSG_VERBOSE);
+ this.outputDirectory = directory;
+ }
+
+ /**
+ * <p>Add a header file to the list. This is called by ANT for a nested
+ * element.</p>
+ *
+ * @return {@link org.apache.tools.ant.types.PatternSet.NameEntry}
+ */
+ public PatternSet.NameEntry createHeader()
+ {
+ return headerSet.createInclude();
+ }
+
+ /**
+ * <p>Add a header file to the list. This is called by ANT for a nested
+ * element.</p>
+ *
+ * @return {@link org.apache.tools.ant.types.PatternSet.NameEntry}
+ */
+ public PatternSet.NameEntry createHeadersFile()
+ {
+ return headerSet.createIncludesFile();
+ }
+
+ /**
+ * <p>Set the set of header patterns. Patterns may be separated by a comma
+ * or a space. This is called by ANT.</p>
+ *
+ * @param headers the string containing the header patterns
+ */
+ public void setHeaders(String headers)
+ {
+ headerSet.setIncludes(headers);
+ }
+
+ /**
+ * <p>Add an optional classpath that defines the location of {@link net.java.games.gluegen.opengl.BuildStaticGLInfo}
+ * and <code>BuildStaticGLInfo</code>'s dependencies.</p>
+ *
+ * @returns {@link org.apache.tools.ant.types.Path}
+ */
+ public Path createClasspath()
+ {
+ return glgenCommandline.createClasspath(project).createPath();
+ }
+
+ // =========================================================================
+ /**
+ * <p>Run the task. This involves validating the set attributes, creating
+ * the command line to be executed and finally executing the command.</p>
+ *
+ * @see org.apache.tools.ant.Task#execute()
+ */
+ public void execute()
+ throws BuildException
+ {
+ // validate that all of the required attributes have been set
+ validateAttributes();
+
+ // TODO: add logic to determine if the generated file needs to be
+ // regenerated
+
+ // add the attributes to the CommandlineJava
+ addAttributes();
+
+ log(glgenCommandline.describeCommand(), Project.MSG_VERBOSE);
+
+ // execute the command and throw on error
+ final int error = execute(glgenCommandline.getCommandline());
+ if(error == 1)
+ throw new BuildException( ("BuildStaticGLInfo returned: " + error), location);
+ }
+
+ /**
+ * <p>Ensure that the user specified all required arguments.</p>
+ *
+ * @throws BuildException if there are required arguments that are not
+ * present or not valid
+ */
+ private void validateAttributes()
+ throws BuildException
+ {
+ // validate that the package name is set
+ if(!isValid(packageName))
+ throw new BuildException("Invalid package name: " + packageName);
+
+ // validate that the output directory is set
+ // TODO: switch to file and ensure that it exists
+ if(!isValid(outputDirectory))
+ throw new BuildException("Invalid output directory name: " + outputDirectory);
+
+ // TODO: validate that there are headers set
+ }
+
+ /**
+ * <p>Is the specified string valid? A valid string is non-<code>null</code>
+ * and has a non-zero length.</p>
+ *
+ * @param string the string to be tested for validity
+ * @return <code>true</code> if the string is valid. <code>false</code>
+ * otherwise.
+ */
+ private boolean isValid(String string)
+ {
+ // check for null
+ if(string == null)
+ return false;
+
+ // ensure that the string has a non-zero length
+ // NOTE: must trim() to remove leading and trailing whitespace
+ if(string.trim().length() < 1)
+ return false;
+
+ // the string is valid
+ return true;
+ }
+
+ /**
+ * <p>Add all of the attributes to the command line. They have already
+ * been validated.</p>
+ */
+ private void addAttributes()
+ {
+ // add the package name
+ glgenCommandline.createArgument().setValue(packageName);
+
+ // add the output directory name
+ glgenCommandline.createArgument().setValue(outputDirectory);
+
+ // add the header -files- from the FileSet
+ headerSet.setDir(getProject().getBaseDir());
+ DirectoryScanner directoryScanner = headerSet.getDirectoryScanner(getProject());
+ String[] directoryFiles = directoryScanner.getIncludedFiles();
+ for(int i=0; i<directoryFiles.length; i++)
+ {
+ glgenCommandline.createArgument().setValue(directoryFiles[i]);
+ }
+ }
+
+ /**
+ * <p>Execute {@link net.java.games.gluegen.opengl.BuildStaticGLInfo} in a
+ * forked JVM.</p>
+ *
+ * @throws BuildException
+ */
+ private int execute(String[] command)
+ throws BuildException
+ {
+ // create the object that will perform the command execution
+ Execute execute = new Execute(new LogStreamHandler(this, Project.MSG_INFO,
+ Project.MSG_WARN),
+ null);
+
+ // set the project and command line
+ execute.setAntRun(project);
+ execute.setCommandline(command);
+
+ // execute the command
+ try
+ {
+ return execute.execute();
+ } catch(IOException ioe)
+ {
+ throw new BuildException(ioe, location);
+ }
+ }
+}
diff --git a/src/net/java/games/gluegen/cgram/types/CompoundType.java b/src/net/java/games/gluegen/cgram/types/CompoundType.java
index a08193a13..d86fa9148 100644
--- a/src/net/java/games/gluegen/cgram/types/CompoundType.java
+++ b/src/net/java/games/gluegen/cgram/types/CompoundType.java
@@ -134,7 +134,7 @@ public class CompoundType extends Type {
}
/** Indicates to this CompoundType that its body has been parsed and
- that no more {@link addField} operations will be made. */
+ that no more {@link #addField} operations will be made. */
public void setBodyParsed() {
bodyParsed = true;
}
diff --git a/src/net/java/games/gluegen/cgram/types/TypeDictionary.java b/src/net/java/games/gluegen/cgram/types/TypeDictionary.java
index bbf69b3c9..14b313fbc 100644
--- a/src/net/java/games/gluegen/cgram/types/TypeDictionary.java
+++ b/src/net/java/games/gluegen/cgram/types/TypeDictionary.java
@@ -91,7 +91,7 @@ public class TypeDictionary {
}
/** Get all the names that map to Types.
- * @returns a Set of Strings that are the typedef names that map to Types in the dictionary.
+ * @return a Set of Strings that are the typedef names that map to Types in the dictionary.
*/
public Set keySet() {
return map.keySet();
diff --git a/src/net/java/games/jogl/impl/FunctionAvailabilityCache.java b/src/net/java/games/jogl/impl/FunctionAvailabilityCache.java
index 74a3e888d..99fb36434 100644
--- a/src/net/java/games/jogl/impl/FunctionAvailabilityCache.java
+++ b/src/net/java/games/jogl/impl/FunctionAvailabilityCache.java
@@ -136,9 +136,9 @@ public final class FunctionAvailabilityCache {
* Returns true if the given OpenGL function is part of the OpenGL core
* that corresponds to the give OpenGL version string.
*
- * @param versionString must be of the form "X" or "X.Y" or "X.Y.Z", where
+ * @param glVersionString must be of the form "X" or "X.Y" or "X.Y.Z", where
* X, Y, and Z are integers
- @ @exception GLException if the glFunctionName passed in is
+ * @exception GLException if the glFunctionName passed in is
* not the name of any known OpenGL extension function.
*/
public static boolean isPartOfGLCore(String glVersionString, String glFunctionName)
diff --git a/src/net/java/games/jogl/impl/GLContext.java b/src/net/java/games/jogl/impl/GLContext.java
index db8842b39..3923ed307 100644
--- a/src/net/java/games/jogl/impl/GLContext.java
+++ b/src/net/java/games/jogl/impl/GLContext.java
@@ -309,7 +309,7 @@ public abstract class GLContext {
*
* @param glFunctionName the name of the OpenGL function (e.g., use
* "glPolygonOffsetEXT" to check if the {@link
- * net.java.games.jogl.glPolygonOffsetEXT(float,float)} is available).
+ * net.java.games.jogl.GL#glPolygonOffsetEXT(float,float)} is available).
*/
protected boolean isFunctionAvailable(String glFunctionName) {
return functionAvailability.isFunctionAvailable(mapToRealGLFunctionName(glFunctionName));
diff --git a/src/net/java/games/jogl/impl/windows/WindowsGLContext.java b/src/net/java/games/jogl/impl/windows/WindowsGLContext.java
index 44ff97ffc..bdda563b4 100644
--- a/src/net/java/games/jogl/impl/windows/WindowsGLContext.java
+++ b/src/net/java/games/jogl/impl/windows/WindowsGLContext.java
@@ -107,7 +107,7 @@ public abstract class WindowsGLContext extends GLContext {
/**
* Creates and initializes an appropriate OpenGL context. Should only be
- * called by {@link makeCurrent(Runnable)}.
+ * called by {@link #makeCurrent(Runnable)}.
*/
protected abstract void create();