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 /src | |
parent | 424a5ecbd7575eb39343638696c19cd617577912 (diff) |
Use new JNILIbLoaderBase addNativeJarLibs(all, atomic) for JOGL, NativeWindow and NEWT; no more LD_LIB_.. in setenv.sh for test scripts
Diffstat (limited to 'src')
3 files changed, 19 insertions, 26 deletions
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; } }); |