Commit 62917302 authored by Florian Hölzl's avatar Florian Hölzl

Finished preloading of LWJGL native libraries.

refs 2454
parent 8b340007
......@@ -31,3 +31,4 @@ Bundle-ClassPath: lib/lwjgl.jar,
Bundle-NativeCode: lib/liblwjgl.so ; lib/libjemalloc.so ; osname = linux ; processor = x86_64,
lib/liblwjgl.dylib ; lib/libjemalloc.dylib ; osname = macosx ; processor = x86_64,
lib/lwjgl.dll ; lib/jemalloc.dll ; osname = win32 ; processor = x86_64 ; osname = Windows 8 ; osname = Windows8 ; osname = Win8 ; osname = Windows 8.1 ; osname = Windows8.1 ; osname = Win8.1 ; ; processor = x86_64
Eclipse-BundleShape: dir
......@@ -17,8 +17,12 @@ $Id$
+--------------------------------------------------------------------------*/
package org.fortiss.tooling.graphicsGL.ui;
import static java.lang.System.mapLibraryName;
import static org.eclipse.core.runtime.FileLocator.toFileURL;
import org.eclipse.jface.resource.ImageDescriptor;
import org.eclipse.ui.plugin.AbstractUIPlugin;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleContext;
/**
......@@ -44,10 +48,28 @@ public class ToolingGraphicsGLUIActivator extends AbstractUIPlugin {
super.start(context);
plugin = this;
System.out.println("Loading native LWJGL libraries.");
// System.load("/Users/hoelzl/workspaces/af3/plugins/org.fortiss.tooling.graphicsGL.ui/lib/libjemalloc.dylib");
System.load("/Users/hoelzl/workspaces/af3/plugins/org.fortiss.tooling.graphicsGL.ui/lib/liblwjgl.dylib");
System.out.println("Done loading native LWJGL libraries.");
System.out.println("Preloading native LWJGL libraries.");
// preload JEMALLOC
String jemallocLibPath = loadPluginLocalLibrary(getBundle(), "/lib", "jemalloc");
System.out.println("LWJGL jemalloc library path = " + jemallocLibPath);
// LWJGL has its own System.load() call when this property is provided
System.setProperty("org.lwjgl.system.jemalloc.libname", jemallocLibPath);
// preload LWJGL
String lwjglLibPath = loadPluginLocalLibrary(getBundle(), "/lib", "lwjgl");
System.out.println("LWJGL lwjgl library path = " + lwjglLibPath);
System.out.println("Done preloading native LWJGL libraries.");
}
/** Load the given local library using {@link System#load(String)}. */
private String loadPluginLocalLibrary(Bundle bundle, String bundleLocalLibraryFolder,
String libraryName) throws Exception {
String osLibName = mapLibraryName(libraryName);
String fullPath =
toFileURL(bundle.getEntry(bundleLocalLibraryFolder)).getPath() + osLibName;
System.load(fullPath);
return fullPath;
}
/** {@inheritDoc} */
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment