From 16c530c791dbf17e66618233600d9e3387f18da7 Mon Sep 17 00:00:00 2001 From: kbr Date: Sun, 15 Jan 2006 03:24:43 +0000 Subject: Moved GlueGen out of the JOGL workspace and into its own project. Restructured JOGL and JOAL build processes to separately invoke GlueGen's main build.xml before using it to generate their code. Refactored OS/CPU detection code into gluegen-cpptasks.xml build file in GlueGen workspace, which is now imported by both the JOGL and JOAL build processes. Unfortunately it seems to be somewhat difficult to completely factor out the C compiler configuration into the GlueGen workspace so this has been left for a later date. Added missed ALProcAddressLookup file to JOAL workspace. Updated JOGL and JOAL build documentation. More documentation for the GlueGen workspace is forthcoming. git-svn-id: file:///home/mbien/NetBeansProjects/JOGAMP/joal-sync/git-svn/../svn-server-sync/joal/trunk@103 03bf7f67-59de-4072-a415-9a990d468a3f --- README.txt | 29 ++-- make/build.xml | 167 ++++++++------------- make/joal.properties | 13 -- .../java/games/joal/impl/ALProcAddressLookup.java | 92 ++++++++++++ 4 files changed, 168 insertions(+), 133 deletions(-) create mode 100755 src/java/net/java/games/joal/impl/ALProcAddressLookup.java diff --git a/README.txt b/README.txt index 608ff45..ab656ba 100644 --- a/README.txt +++ b/README.txt @@ -82,10 +82,9 @@ packages and tools have been used: -- OSX Developer Tools -- OpenAL1.0 SDK from Creative Labs (avaulable at http://developer.creative.com under "Gaming->Development Kits->Open AL") -The sources currently require a built JOGL source tree as a sibling -directory of your JOAL tree; this is to pick up the GlueGen tool, -which currently lives in the JOGL workspace. We plan to move this tool -into its own workspace and thereby break this dependence. +JOAL requires the GlueGen workspace to be checked out as a sibling +directory to the joal directory ("cvs co gluegen"). GlueGen will be +built automatially during the JOAL build process. Directory Organization: ======================= @@ -125,17 +124,21 @@ Preparations: JOAL Build Instructions: =================== -Copy the joal.properties file from the make/ subdirectory into your -home directory, or in particular where the Java system property -user.home points to (on Windows, this is C:\Documents and Settings\username\) +Download the current ANTLR jar file (http://www.antlr.org/). -Download the current ANTLR jar file (http://www.antlr.org/). Edit the -value of the antlr.jar property in this file to point to the full path -of this jar. ANTLR is used during the glue code generation process. +Copy the gluegen.properties file from the make/ subdirectory of the +GlueGen workspace into your home directory, or in particular where the +Java system property user.home points to (on Windows, this is +C:\Documents and Settings\username\). Edit the value of the antlr.jar +property this file to point to the full path of the ANTLR jar. ANTLR +is used during the glue code generation process. -Edit the joal.lib.dir property to point to the lib directory of your -current OpenAL installation. For Windows this might be "C:/Program -Files/OpenAL 1.1 SDK/libs/Win32". +Copy the joal.properties file from the make/ subdirectory into your +home directory, or in particular where the Java system property +user.home points to (on Windows, this is C:\Documents and +Settings\username\). Edit the joal.lib.dir property to point to the +lib directory of your current OpenAL installation. For Windows this +might be "C:/Program Files/OpenAL 1.1 SDK/libs/Win32". Under Linux set the property to the toplevel directory of your OpenAL CVS version. If OpenAl came with your distribution and the header files are in /usr/include/AL, diff --git a/make/build.xml b/make/build.xml index e04f629..9a63977 100755 --- a/make/build.xml +++ b/make/build.xml @@ -17,87 +17,34 @@ - the "make" directory. This also means that this build.xml MUST - be run from the "make" directory. - - - All targets do the following: - - Build the ancillary Ant tasks. - - Generate the Java and C files. - - Compile all sources. - - Create the joal.jar and platform library. - Public targets: - - linux - - macosx - - solaris - - win32.vc6 - - win32.vc7 - - win32.mingw: build everything (jar, DSOs) for the current platform + - all: (default; autodetects OS and chooses C compiler from joal.properties) - clean: clean all built - javadoc: create the standard developer Javadoc - - - Optional properties: - - -Djoal.cg=1 when combined with the build or javadoc targets will cause - - the experimental binding to NVidia's Cg language to be built. - - - Thanks to Rob Grzywinski and Artur Biesiadowski for the bulk of the - ANT build, including the GlueGen and StaticGLInfo tasks, the building of - the Java generated sources, the first and second phase Java compiles, and - - the building of the jar file. + - the building of the jar file. Thanks to Alex Radeski for the bulk of the + - port to the ant-contrib CPPTask framework. Thanks to Athomas Goldberg for + - the original OS detection code. --> + + + + - + - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - @@ -111,8 +58,10 @@ + + - + @@ -154,34 +103,40 @@ - - - - + - - - + + + + + + + + + + + + + - - + + - - - - - + + + + + @@ -220,16 +175,6 @@ - - - - - - - - @@ -346,6 +291,23 @@ + + + + + + + + + + + - + + classpathref="gluegen.classpath" /> @@ -390,7 +352,7 @@ config="${joal.cfg}" includeRefid="stub.includes.fileset.all" emitter="com.sun.gluegen.procaddress.ProcAddressEmitter"> - + @@ -398,7 +360,7 @@ config="${joal.constants.cfg}" includeRefid="stub.includes.fileset.all" emitter="com.sun.gluegen.JavaEmitter"> - + @@ -406,7 +368,7 @@ config="${joal.alc.cfg}" includeRefid="stub.includes.fileset.all" emitter="com.sun.gluegen.procaddress.ProcAddressEmitter"> - + @@ -414,7 +376,7 @@ config="${joal.alc.constants.cfg}" includeRefid="stub.includes.fileset.all" emitter="com.sun.gluegen.JavaEmitter"> - + - - - @@ -533,8 +490,7 @@ - - + @@ -631,8 +587,6 @@ - - @@ -649,7 +603,6 @@ @@ -734,7 +687,7 @@ - + diff --git a/make/joal.properties b/make/joal.properties index 436dc9f..635d975 100755 --- a/make/joal.properties +++ b/make/joal.properties @@ -11,19 +11,6 @@ # # 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 -# -# Windows -antlr.jar=C:/Users/kbr/ANTLR/antlr-2.7.2/antlr.jar -# Linux -# antlr.jar=/home/kbr/antlr-2.7.2/antlr.jar -# Mac OS X -# antlr.jar=/Users/kbr/antlr-2.7.2/antlr.jar -# Solaris -# antlr.jar=/export/kbr/ANTLR/antlr-2.7.2/antlr.jar - # # The required joal.lib.dir points to the directory containing the # OpenAL library against which JOAL is linked. On Windows, this is the diff --git a/src/java/net/java/games/joal/impl/ALProcAddressLookup.java b/src/java/net/java/games/joal/impl/ALProcAddressLookup.java new file mode 100755 index 0000000..5291587 --- /dev/null +++ b/src/java/net/java/games/joal/impl/ALProcAddressLookup.java @@ -0,0 +1,92 @@ +/** + * Copyright (c) 2003-2005 Sun Microsystems, Inc. All Rights Reserved. + * + * Redistribution and use in source and binary forms, with or without + * modification, are permitted provided that the following conditions are met: + * + * -Redistribution of source code must retain the above copyright notice, + * this list of conditions and the following disclaimer. + * + * -Redistribution in binary form must reproduce the above copyright notice, + * this list of conditions and the following disclaimer in the documentation + * and/or other materials provided with the distribution. + * + * Neither the name of Sun Microsystems, Inc. or the names of contributors may + * 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 OR + * NON-INFRINGEMENT, ARE HEREBY EXCLUDED. SUN MICROSYSTEMS, INC. ("SUN") AND ITS + * 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 SUN OR ITS 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 SUN HAS + * BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + * + * You acknowledge that this software is not designed or intended for use in the + * design, construction, operation or maintenance of any nuclear facility. + */ + +package net.java.games.joal.impl; + +import net.java.games.joal.*; +import com.sun.gluegen.runtime.*; + +/** Helper class for managing OpenAL-related proc address tables. */ + +public class ALProcAddressLookup { + private static final ALProcAddressTable alTable = new ALProcAddressTable(); + private static volatile boolean alTableInitialized = false; + private static final ALCProcAddressTable alcTable = new ALCProcAddressTable(); + private static volatile boolean alcTableInitialized = false; + + public static void resetALProcAddressTable() { + if (!alTableInitialized) { + synchronized (ALProcAddressLookup.class) { + if (!alTableInitialized) { + // At some point this may require an OpenAL context to be + // current as we will actually use alGetProcAddress. Since + // this routine is currently broken and there are no + // per-context function pointers anyway we could actually do + // this work anywhere. We should also in theory have + // per-ALcontext ALProcAddressTables and per-ALCdevice + // ALCProcAddressTables. + ALImpl impl = (ALImpl) ALFactory.getAL(); + ProcAddressHelper.resetProcAddressTable(alTable, impl); + alTableInitialized = true; + } + } + } + } + + public static void resetALCProcAddressTable() { + if (!alcTableInitialized) { + synchronized (ALProcAddressLookup.class) { + if (!alcTableInitialized) { + // At some point this may require an OpenAL device to be + // created as we will actually use alcGetProcAddress. Since + // this routine is currently broken and there are no + // per-device function pointers anyway we could actually do + // this work anywhere. We should also in theory have + // per-ALcontext ALProcAddressTables and per-ALCdevice + // ALCProcAddressTables. + ALImpl impl = (ALImpl) ALFactory.getAL(); + ProcAddressHelper.resetProcAddressTable(alcTable, impl); + alcTableInitialized = true; + } + } + } + } + + public static ALProcAddressTable getALProcAddressTable() { + return alTable; + } + + public static ALCProcAddressTable getALCProcAddressTable() { + return alcTable; + } +} -- cgit v1.2.3