summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorSven Gothel <sgothel@jausoft.com>2011-12-18 16:38:24 +0100
committerSven Gothel <sgothel@jausoft.com>2011-12-18 16:38:24 +0100
commit970afd0ee8d69c09d90a59b90afd2149a6b211b5 (patch)
tree92b3566ccbbc46eb25b81b1f8c85dd8b659a7783
parent70407434fd4cd205b127ed7d73832eb0b3d01263 (diff)
Add TempJarCache usage
-rw-r--r--.classpath1
-rw-r--r--nbproject/project.properties7
-rw-r--r--src/com/jogamp/opencl/JOCLJNILibLoader.java18
3 files changed, 21 insertions, 5 deletions
diff --git a/.classpath b/.classpath
index 77db55c..45fa2b7 100644
--- a/.classpath
+++ b/.classpath
@@ -5,5 +5,6 @@
<classpathentry kind="src" path="test"/>
<classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER"/>
<classpathentry kind="con" path="org.eclipse.jdt.USER_LIBRARY/jogamp"/>
+ <classpathentry combineaccessrules="false" kind="src" path="/gluegen"/>
<classpathentry kind="output" path="build"/>
</classpath>
diff --git a/nbproject/project.properties b/nbproject/project.properties
index 5d0b818..f9458c7 100644
--- a/nbproject/project.properties
+++ b/nbproject/project.properties
@@ -75,17 +75,18 @@ manifest.file=${rootrel.build}/manifest.mf
meta.inf.dir=${src.dir}/META-INF
platform.active=default_platform
run.classpath=\
- ${javac.classpath}:\
+ ${dist.jar}:${javac.classpath}:\
${build.classes.dir}
# Space-separated list of JVM arguments used when running the project
# (you may also define separate properties like run-sys-prop.name=value instead of -Dname=value
# or test-sys-prop.name=value to set system properties for unit tests):
-run.jvmargs=${jvmDataModel.arg} -Xmx256m -Djava.library.path=\
+run.jvmargs=${jvmDataModel.arg} -Xmx256m \
+ -Djava.library.path=\
"${basedir}/${rootrel.build}/natives/jocl${path.separator}\
${jogl.root}/${rootrel.build}/lib${path.separator}\
${gluegen.root}/${rootrel.build}/obj"
run.test.classpath=\
- ${javac.test.classpath}:\
+ ${dist.jar}:${javac.test.classpath}:\
${build.test.classes.dir}
source.encoding=UTF-8
source.reference.gluegen-rt.jar=${gluegen.root}/src/java:${gluegen.root}/${rootrel.build}/gensrc/java
diff --git a/src/com/jogamp/opencl/JOCLJNILibLoader.java b/src/com/jogamp/opencl/JOCLJNILibLoader.java
index 4ee99f1..328c223 100644
--- a/src/com/jogamp/opencl/JOCLJNILibLoader.java
+++ b/src/com/jogamp/opencl/JOCLJNILibLoader.java
@@ -28,8 +28,13 @@
package com.jogamp.opencl;
+import java.security.AccessController;
+import java.security.PrivilegedAction;
+
import com.jogamp.common.jvm.JNILibLoaderBase;
import com.jogamp.common.os.NativeLibrary;
+import com.jogamp.common.os.Platform;
+import com.jogamp.common.util.cache.TempJarCache;
/**
@@ -43,7 +48,16 @@ class JOCLJNILibLoader extends JNILibLoaderBase {
* @return Returns libOpenCL represented as NativeLibrary.
*/
static NativeLibrary loadOpenCL() {
- loadLibrary("jocl", null, false);
- return NativeLibrary.open("OpenCL", JOCLJNILibLoader.class.getClassLoader());
+ return AccessController.doPrivileged(new PrivilegedAction<NativeLibrary>() {
+ public NativeLibrary run() {
+ Platform.initSingleton();
+ final String libName = "jocl";
+ if(TempJarCache.isInitialized() && null == TempJarCache.findLibrary(libName)) {
+ addNativeJarLibs(JOCLJNILibLoader.class, "jocl", null );
+ }
+ loadLibrary(libName, false);
+ return NativeLibrary.open("OpenCL", JOCLJNILibLoader.class.getClassLoader());
+ }
+ });
}
}