diff options
author | Sven Gothel <[email protected]> | 2011-09-24 03:25:53 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-09-24 03:25:53 +0200 |
commit | a1b4e9acb011f41698775f1fee0041e88d09613f (patch) | |
tree | 96273716e889c39bac86659ae20772eb401345d1 | |
parent | 424a5ecbd7575eb39343638696c19cd617577912 (diff) |
Use new JNILIbLoaderBase addNativeJarLibs(all, atomic) for JOGL, NativeWindow and NEWT; no more LD_LIB_.. in setenv.sh for test scripts
-rwxr-xr-x | make/scripts/setenv-jogl.sh | 5 | ||||
-rw-r--r-- | src/jogl/classes/javax/media/opengl/GLProfile.java | 29 | ||||
-rw-r--r-- | src/nativewindow/classes/jogamp/nativewindow/NWJNILibLoader.java | 8 | ||||
-rw-r--r-- | src/newt/classes/jogamp/newt/NEWTJNILibLoader.java | 8 |
4 files changed, 22 insertions, 28 deletions
diff --git a/make/scripts/setenv-jogl.sh b/make/scripts/setenv-jogl.sh index 586b667e3..e52c2382f 100755 --- a/make/scripts/setenv-jogl.sh +++ b/make/scripts/setenv-jogl.sh @@ -89,8 +89,9 @@ for i in $LIB/*jar ; do CLASSPATH=$CLASSPATH:$i done export CLASSPATH -export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GLUEGEN_OS:$JOGL_LIB_DIR -export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$GLUEGEN_OS:$JOGL_LIB_DIR +# We use TempJarCache per default now! +#export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:$GLUEGEN_OS:$JOGL_LIB_DIR +#export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH:$GLUEGEN_OS:$JOGL_LIB_DIR echo CLASSPATH: $CLASSPATH echo diff --git a/src/jogl/classes/javax/media/opengl/GLProfile.java b/src/jogl/classes/javax/media/opengl/GLProfile.java index f76ad5d24..1c9e9da1e 100644 --- a/src/jogl/classes/javax/media/opengl/GLProfile.java +++ b/src/jogl/classes/javax/media/opengl/GLProfile.java @@ -115,30 +115,11 @@ public class GLProfile { AccessController.doPrivileged(new PrivilegedAction<Object>() { public Object run() { if(TempJarCache.isInitialized()) { - final Class<?> c = GLProfile.class; - final ClassLoader cl = c.getClassLoader(); - try { - final String jarName = JarUtil.getJarName(c.getName(), cl); - if(DEBUG) { - System.err.println("GLProfile classURL: "+IOUtil.getClassURL(c.getName(), cl)); - System.err.println("GLProfile jarName: "+jarName); - } - if(jarName!=null) { - if( jarName.startsWith("jogl.all") ) { - // all-in-one variant - JNILibLoaderBase.addNativeJarLibs(c, "jogl-all"); - } else { - // atomic variant - JNILibLoaderBase.addNativeJarLibs(c, "nativewindow"); - JNILibLoaderBase.addNativeJarLibs(c, "jogl"); - if( ReflectionUtil.isClassAvailable("com.jogamp.newt.NewtFactory", cl) ) { - JNILibLoaderBase.addNativeJarLibs(c, "newt"); - } - } - } - } catch (IOException ioe) { - ioe.printStackTrace(); - } + String[] atomicNativeJarBaseNames = new String[] { "nativewindow", "jogl", null }; + if( ReflectionUtil.isClassAvailable("com.jogamp.newt.NewtFactory", GLProfile.class.getClassLoader()) ) { + atomicNativeJarBaseNames[2] = "newt"; + } + JNILibLoaderBase.addNativeJarLibs(GLProfile.class, "jogl.all", "jogl-all", atomicNativeJarBaseNames); } initProfilesForDefaultDevices(firstUIActionOnProcess); return null; diff --git a/src/nativewindow/classes/jogamp/nativewindow/NWJNILibLoader.java b/src/nativewindow/classes/jogamp/nativewindow/NWJNILibLoader.java index d4ba27353..2b6d3c016 100644 --- a/src/nativewindow/classes/jogamp/nativewindow/NWJNILibLoader.java +++ b/src/nativewindow/classes/jogamp/nativewindow/NWJNILibLoader.java @@ -31,14 +31,20 @@ package jogamp.nativewindow; import java.security.AccessController; import java.security.PrivilegedAction; + import com.jogamp.common.jvm.JNILibLoaderBase; +import com.jogamp.common.util.cache.TempJarCache; public class NWJNILibLoader extends JNILibLoaderBase { public static void loadNativeWindow(final String ossuffix) { AccessController.doPrivileged(new PrivilegedAction<Object>() { public Object run() { - loadLibrary("nativewindow_"+ossuffix, false); + final String libName = "nativewindow_"+ossuffix ; + if(TempJarCache.isInitialized() && null == TempJarCache.findLibrary(libName)) { + addNativeJarLibs(NWJNILibLoader.class, "jogl.all", "jogl-all", new String[] { "nativewindow" } ); + } + loadLibrary(libName, false); return null; } }); diff --git a/src/newt/classes/jogamp/newt/NEWTJNILibLoader.java b/src/newt/classes/jogamp/newt/NEWTJNILibLoader.java index a47079baf..1f5d5dd3d 100644 --- a/src/newt/classes/jogamp/newt/NEWTJNILibLoader.java +++ b/src/newt/classes/jogamp/newt/NEWTJNILibLoader.java @@ -41,14 +41,20 @@ package jogamp.newt; import java.security.AccessController; import java.security.PrivilegedAction; + import com.jogamp.common.jvm.JNILibLoaderBase; +import com.jogamp.common.util.cache.TempJarCache; public class NEWTJNILibLoader extends JNILibLoaderBase { public static void loadNEWT() { AccessController.doPrivileged(new PrivilegedAction<Object>() { public Object run() { - loadLibrary("newt", false); + final String libName = "newt"; + if(TempJarCache.isInitialized() && null == TempJarCache.findLibrary(libName)) { + addNativeJarLibs(NEWTJNILibLoader.class, "jogl.all", "jogl-all", new String[] { "nativewindow", "newt" } ); + } + loadLibrary(libName, false); return null; } }); |