Jogamp
Use new JNILIbLoaderBase addNativeJarLibs(all, atomic) for JOGL, NativeWindow and...
authorSven Gothel <sgothel@jausoft.com>
Sat, 24 Sep 2011 01:25:53 +0000 (03:25 +0200)
committerSven Gothel <sgothel@jausoft.com>
Sat, 24 Sep 2011 01:25:53 +0000 (03:25 +0200)
make/scripts/setenv-jogl.sh
src/jogl/classes/javax/media/opengl/GLProfile.java
src/nativewindow/classes/jogamp/nativewindow/NWJNILibLoader.java
src/newt/classes/jogamp/newt/NEWTJNILibLoader.java

index 586b667..e52c238 100755 (executable)
@@ -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
index f76ad5d..1c9e9da 100644 (file)
@@ -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;
index d4ba273..2b6d3c0 100644 (file)
@@ -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;
       }
     });
index a47079b..1f5d5dd 100644 (file)
@@ -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;
       }
     });
http://JogAmp.org git info: FAQ, tutorial and man pages.