diff options
author | Sven Gothel <[email protected]> | 2011-07-17 16:34:39 +0200 |
---|---|---|
committer | Sven Gothel <[email protected]> | 2011-07-17 16:34:39 +0200 |
commit | f733203dfbd034a6b1aa3eb2cd616437c982c435 (patch) | |
tree | 4ace71d4b129870b02f962b714c9dce9f83bc294 /src/java/com/jogamp/common/os/NativeLibrary.java | |
parent | ad3dc39ccfddb007c3e91acf454f804573969419 (diff) |
GlueGen proper size / alignment of primitive and compound types usage [1/2] - Preparation.
Currently GlueGen fails for type long (size) and some alignments (see package.html).
- The size and alignment values shall be queried at runtime.
- Compound alignment needs to follow the described natural alignment (also @runtime).
-
- Build
- add Linux Arm7 (EABI)
- junit test
- added compound/struct tests, pointing out the shortcomings of current impl.
- package.html
- Added alignment documentation
- remove intptr.cfg
- add GluGen types int8_t, int16_t, uint8_t, uint16_t
- move MachineDescription* into runtime
- Platform
- has runtime MachineDescription
- moved size, .. to MachineDescription
- use enums for OSType, CPUArch and CPUType defined by os.name/os.arch,
triggering exception if os/arch is not supported.
This avoids Java String comparison and conscious os/arch detection.
- MachineDescription:
- compile time instances MachineDescription32Bits, MachineDescription64Bits
- runtime queried instance MachineDescriptionRuntime
- correct size, alignment, page size, ..
Diffstat (limited to 'src/java/com/jogamp/common/os/NativeLibrary.java')
-rwxr-xr-x | src/java/com/jogamp/common/os/NativeLibrary.java | 64 |
1 files changed, 28 insertions, 36 deletions
diff --git a/src/java/com/jogamp/common/os/NativeLibrary.java b/src/java/com/jogamp/common/os/NativeLibrary.java index 558aa3e..30075fd 100755 --- a/src/java/com/jogamp/common/os/NativeLibrary.java +++ b/src/java/com/jogamp/common/os/NativeLibrary.java @@ -59,54 +59,39 @@ import java.util.*; supporting code needed in the generated library. */ public class NativeLibrary implements DynamicLookupHelper { - private static final int WINDOWS = 1; - private static final int UNIX = 2; - private static final int MACOSX = 3; protected static boolean DEBUG; protected static boolean DEBUG_LOOKUP; - private static int platform; private static DynamicLinker dynLink; private static String[] prefixes; private static String[] suffixes; static { - // Determine platform we're running on - AccessController.doPrivileged(new PrivilegedAction() { - public Object run() { - String osName = System.getProperty("os.name").toLowerCase(); - if (osName.startsWith("wind")) { - platform = WINDOWS; - } else if (osName.startsWith("mac os x")) { - platform = MACOSX; - } else { - platform = UNIX; - } - - DEBUG = (System.getProperty("jogamp.debug.NativeLibrary") != null); - DEBUG_LOOKUP = (System.getProperty("jogamp.debug.NativeLibrary.Lookup") != null); - - return null; - } - }); // Instantiate dynamic linker implementation - switch (platform) { + switch (Platform.OS_TYPE) { case WINDOWS: dynLink = new WindowsDynamicLinkerImpl(); prefixes = new String[] { "" }; suffixes = new String[] { ".dll" }; break; - case UNIX: - dynLink = new UnixDynamicLinkerImpl(); - prefixes = new String[] { "lib" }; - suffixes = new String[] { ".so" }; - break; - case MACOSX: + + case MACOS: dynLink = new MacOSXDynamicLinkerImpl(); prefixes = new String[] { "lib", "" }; suffixes = new String[] { ".dylib", ".jnilib", "" }; break; + + /* + case FREEBSD: + case DALVIK: + case SUNOS: + case HPUX: + case OPENKODE: + case LINUX: */ default: - throw new InternalError("Platform not initialized properly"); + dynLink = new UnixDynamicLinkerImpl(); + prefixes = new String[] { "lib" }; + suffixes = new String[] { ".so" }; + break; } } @@ -306,7 +291,7 @@ public class NativeLibrary implements DynamicLookupHelper { addPaths(userDir, baseNames, paths); // Add probable Mac OS X-specific paths - if (platform == MACOSX) { + if (Platform.OS_TYPE == Platform.OSType.MACOS) { // Add historical location addPaths("/Library/Frameworks/" + libName + ".Framework", baseNames, paths); // Add current location @@ -325,15 +310,22 @@ public class NativeLibrary implements DynamicLookupHelper { private static String selectName(String windowsLibName, String unixLibName, String macOSXLibName) { - switch (platform) { + switch (Platform.OS_TYPE) { case WINDOWS: return windowsLibName; - case UNIX: - return unixLibName; - case MACOSX: + + case MACOS: return macOSXLibName; + + /* + case FREEBSD: + case DALVIK: + case SUNOS: + case HPUX: + case OPENKODE: + case LINUX: */ default: - throw new InternalError(); + return unixLibName; } } |