From: <eli...@us...> - 2006-07-11 20:30:41
|
Revision: 2479 Author: elias_naur Date: 2006-07-11 13:30:19 -0700 (Tue, 11 Jul 2006) ViewCVS: http://svn.sourceforge.net/java-game-lib/?rev=2479&view=rev Log Message: ----------- Linux: added support for 64 bit JVMs Modified Paths: -------------- trunk/LWJGL/build.xml trunk/LWJGL/platform_build/linux_ant/build.xml trunk/LWJGL/src/java/org/lwjgl/DefaultSysImplementation.java trunk/LWJGL/src/java/org/lwjgl/LWJGLUtil.java trunk/LWJGL/src/java/org/lwjgl/LinuxSysImplementation.java trunk/LWJGL/src/java/org/lwjgl/Sys.java trunk/LWJGL/src/java/org/lwjgl/SysImplementation.java trunk/LWJGL/src/java/org/lwjgl/util/applet/LWJGLInstaller.java Modified: trunk/LWJGL/build.xml =================================================================== --- trunk/LWJGL/build.xml 2006-07-11 20:00:27 UTC (rev 2478) +++ trunk/LWJGL/build.xml 2006-07-11 20:30:19 UTC (rev 2479) @@ -358,14 +358,14 @@ </jar> <!-- create each of the native jars --> - <jar destfile="applet/win32_natives.jar" taskname="win32_natives.jar"> + <jar destfile="applet/windows_natives.jar" taskname="windows_natives.jar"> <fileset dir="${lwjgl.lib}/win32"> <patternset refid="lwjgl-win32.fileset"/> <patternset refid="lwjgl-win32_optional.fileset"/> <include name="fmod.dll"/> </fileset> </jar> - <signjar jar="applet/win32_natives.jar" alias="lwjgl" keystore="applet/lwjglkeystore" storepass="123456"/> + <signjar jar="applet/windows_natives.jar" alias="lwjgl" keystore="applet/lwjglkeystore" storepass="123456"/> <jar destfile="applet/linux_natives.jar" taskname="linux_natives.jar"> <fileset dir="${lwjgl.lib}/linux"> @@ -388,12 +388,12 @@ <!-- add it to a natives jar --> <jar destfile="applet/natives.jar" taskname="natives.jar"> <fileset dir="applet"> - <include name="win32_natives.jar"/> + <include name="windows_natives.jar"/> <include name="linux_natives.jar"/> <include name="macosx_natives.jar"/> </fileset> </jar> - <delete file="applet/win32_natives.jar"/> + <delete file="applet/windows_natives.jar"/> <delete file="applet/linux_natives.jar"/> <delete file="applet/macosx_natives.jar"/> Modified: trunk/LWJGL/platform_build/linux_ant/build.xml =================================================================== --- trunk/LWJGL/platform_build/linux_ant/build.xml 2006-07-11 20:00:27 UTC (rev 2478) +++ trunk/LWJGL/platform_build/linux_ant/build.xml 2006-07-11 20:30:19 UTC (rev 2479) @@ -2,7 +2,8 @@ <project name="lwjgl native code, linux" basedir="../../bin" default="compile"> <property name="native" location="../src/native"/> - <property name="libname" value="liblwjgl.so"/> + <property name="libname32" value="liblwjgl.so"/> + <property name="libname64" value="liblwjgl64.so"/> <property name="libs32" value="-L/usr/X11R6/lib -L/usr/X11/lib -lm -lX11 -lXext -lpthread -L${java.home}/lib/i386 -ljawt -Wl,-static,-lXxf86vm,-lXcursor,-lXrender,-lXrandr,-lXfixes,-call_shared"/> <property name="libs64" value="-L/usr/X11R6/lib64 -L/usr/X11/lib64 -lm -lX11 -lXext -lpthread -L${java.home}/lib/amd64 -ljawt -lXxf86vm -lXcursor -lXrender -lXrandr -lXfixes"/> <property name="cflags" value="-O2 -Wall -c -fPIC -std=c99 -pthread"/> @@ -21,6 +22,9 @@ <condition property="libs" value="${libs64}" else="${libs32}"> <equals arg1="${hwplatform}" arg2="x86_64"/> </condition> + <condition property="libname" value="${libname64}" else="${libname32}"> + <equals arg1="${hwplatform}" arg2="x86_64"/> + </condition> <property name="linker_flags" value="-Wl,--version-script=${native}/linux/lwjgl.map -shared -O2 -Wall -o ${libname} ${libs}"/> <apply dir="." executable="cc" dest="." skipemptyfilesets="true" failonerror="true"> <arg line="${cflags}"/> Modified: trunk/LWJGL/src/java/org/lwjgl/DefaultSysImplementation.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/DefaultSysImplementation.java 2006-07-11 20:00:27 UTC (rev 2478) +++ trunk/LWJGL/src/java/org/lwjgl/DefaultSysImplementation.java 2006-07-11 20:30:19 UTC (rev 2479) @@ -46,6 +46,10 @@ return 1000; } + public boolean has64Bit() { + return false; + } + public abstract long getTime(); public abstract void alert(String title, String message); public abstract String getClipboard(); Modified: trunk/LWJGL/src/java/org/lwjgl/LWJGLUtil.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/LWJGLUtil.java 2006-07-11 20:00:27 UTC (rev 2478) +++ trunk/LWJGL/src/java/org/lwjgl/LWJGLUtil.java 2006-07-11 20:30:19 UTC (rev 2479) @@ -58,7 +58,7 @@ public static final int PLATFORM_WINDOWS = 3; public static final String PLATFORM_LINUX_NAME = "linux"; public static final String PLATFORM_MACOSX_NAME = "macosx"; - public static final String PLATFORM_WINDOWS_NAME = "win32"; + public static final String PLATFORM_WINDOWS_NAME = "windows"; /** LWJGL Logo - 16 by 16 pixels */ public static final ByteBuffer LWJGLIcon16x16 = BufferUtils.createByteBuffer(16 * 16 * 4).put(new byte[] { Modified: trunk/LWJGL/src/java/org/lwjgl/LinuxSysImplementation.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/LinuxSysImplementation.java 2006-07-11 20:00:27 UTC (rev 2478) +++ trunk/LWJGL/src/java/org/lwjgl/LinuxSysImplementation.java 2006-07-11 20:30:19 UTC (rev 2479) @@ -71,4 +71,8 @@ // Seems to have failed return false; } + + public boolean has64Bit() { + return true; + } } Modified: trunk/LWJGL/src/java/org/lwjgl/Sys.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/Sys.java 2006-07-11 20:00:27 UTC (rev 2478) +++ trunk/LWJGL/src/java/org/lwjgl/Sys.java 2006-07-11 20:30:19 UTC (rev 2479) @@ -58,8 +58,10 @@ /** The implementation instance to delegate platform specific behavior to */ private final static SysImplementation implementation; + + private final static String POSTFIX64BIT = "64"; - private static void loadLibrary(final String lib_name) { + private static void doLoadLibrary(final String lib_name) { AccessController.doPrivileged(new PrivilegedAction() { public Object run() { String library_path = System.getProperty("org.lwjgl.librarypath"); @@ -72,6 +74,21 @@ return null; } }); + } + + private static void loadLibrary(final String lib_name) { + try { + loadLibrary(lib_name); + } catch (UnsatisfiedLinkError e) { + if (implementation.has64Bit()) { + try { + loadLibrary(lib_name + POSTFIX64BIT); + } catch (UnsatisfiedLinkError e2) { + LWJGLUtil.log("Failed to load 64 bit library:" + e2.getMessage()); + } + } + throw e; + } } static { Modified: trunk/LWJGL/src/java/org/lwjgl/SysImplementation.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/SysImplementation.java 2006-07-11 20:00:27 UTC (rev 2478) +++ trunk/LWJGL/src/java/org/lwjgl/SysImplementation.java 2006-07-11 20:30:19 UTC (rev 2479) @@ -44,22 +44,28 @@ /** * Return the version of the native library */ - public String getNativeLibraryVersion(); + String getNativeLibraryVersion(); - public void setDebug(boolean debug); + void setDebug(boolean debug); /** * Obtains the number of ticks that the hires timer does in a second. * * @return timer resolution in ticks per second or 0 if no timer is present. */ - public long getTimerResolution(); + long getTimerResolution(); - public long getTime(); + long getTime(); - public void alert(String title, String message); + void alert(String title, String message); boolean openURL(String url); - public String getClipboard(); + String getClipboard(); + + /** + * Returns true there exists a separate 64 bit library + * on the platform + */ + boolean has64Bit(); } Modified: trunk/LWJGL/src/java/org/lwjgl/util/applet/LWJGLInstaller.java =================================================================== --- trunk/LWJGL/src/java/org/lwjgl/util/applet/LWJGLInstaller.java 2006-07-11 20:00:27 UTC (rev 2478) +++ trunk/LWJGL/src/java/org/lwjgl/util/applet/LWJGLInstaller.java 2006-07-11 20:30:19 UTC (rev 2479) @@ -84,7 +84,7 @@ * the user's temp directory, and instruct the LWJGL subsystem to load its * native files from there. * The file required by the installer, is gotten from the classloader via its - * getResource command, and is expected to be named <win32 | linux | macosx>_natives.jar. + * getResource command, and is expected to be named <windows | linux | macosx>_natives.jar. * Note: Due to the nature of native libraries, we cannot actually uninstall the currently * loaded files, but rather the "last" installed. This means that the most recent install of LWJGL * will always be present in the users temp dir. When invoking the tempInstall method, all old installations This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |