Skip to content

Commit 2f8adc7

Browse files
committed
Remove desktop 32-bit support
1 parent 994c552 commit 2f8adc7

File tree

7 files changed

+107
-139
lines changed

7 files changed

+107
-139
lines changed

jme3-core/src/main/java/com/jme3/system/JmeSystemDelegate.java

Lines changed: 61 additions & 34 deletions
Original file line numberDiff line numberDiff line change
@@ -215,9 +215,9 @@ public boolean showSettingsDialog(AppSettings settings, boolean loadFromRegistry
215215
}
216216

217217

218-
private boolean is64Bit(String arch) {
219-
if (arch.equals("x86")) {
220-
return false;
218+
private boolean is64Bit(String arch) {
219+
if (arch.equals("x86")) {
220+
return false;
221221
} else if (arch.equals("amd64")) {
222222
return true;
223223
} else if (arch.equals("x86_64")) {
@@ -240,37 +240,64 @@ private boolean is64Bit(String arch) {
240240
return false;
241241
} else {
242242
throw new UnsupportedOperationException("Unsupported architecture: " + arch);
243-
}
244-
}
245-
246-
public Platform getPlatform() {
247-
String os = System.getProperty("os.name").toLowerCase();
248-
String arch = System.getProperty("os.arch").toLowerCase();
249-
boolean is64 = is64Bit(arch);
250-
if (os.contains("windows")) {
251-
if (arch.startsWith("arm") || arch.startsWith("aarch")) {
252-
return is64 ? Platform.Windows_ARM64 : Platform.Windows_ARM32;
253-
} else {
254-
return is64 ? Platform.Windows64 : Platform.Windows32;
255-
}
256-
} else if (os.contains("linux") || os.contains("freebsd")
257-
|| os.contains("sunos") || os.contains("unix")) {
258-
if (arch.startsWith("arm") || arch.startsWith("aarch")) {
259-
return is64 ? Platform.Linux_ARM64 : Platform.Linux_ARM32;
260-
} else {
261-
return is64 ? Platform.Linux64 : Platform.Linux32;
262-
}
263-
} else if (os.contains("mac os x") || os.contains("darwin")) {
264-
if (arch.startsWith("ppc")) {
265-
return is64 ? Platform.MacOSX_PPC64 : Platform.MacOSX_PPC32;
266-
} else if (arch.startsWith("aarch")) {
267-
return Platform.MacOSX_ARM64; // no 32-bit version
268-
} else {
269-
return is64 ? Platform.MacOSX64 : Platform.MacOSX32;
270-
}
271-
} else {
272-
throw new UnsupportedOperationException("The specified platform: " + os + " is not supported.");
273-
}
243+
}
244+
}
245+
246+
private boolean isArmArchitecture(String arch) {
247+
return arch.startsWith("arm") || arch.startsWith("aarch");
248+
}
249+
250+
private UnsupportedOperationException unsupported32Bit(String osName) {
251+
return new UnsupportedOperationException("32-bit " + osName + " is not supported.");
252+
}
253+
254+
private Platform getWindowsPlatform(String arch, boolean is64) {
255+
if (isArmArchitecture(arch)) {
256+
return is64 ? Platform.Windows_ARM64 : Platform.Windows_ARM32;
257+
}
258+
if (!is64) {
259+
throw unsupported32Bit("Windows");
260+
}
261+
return Platform.Windows64;
262+
}
263+
264+
private Platform getLinuxPlatform(String arch, boolean is64) {
265+
if (isArmArchitecture(arch)) {
266+
return is64 ? Platform.Linux_ARM64 : Platform.Linux_ARM32;
267+
}
268+
if (!is64) {
269+
throw unsupported32Bit("Linux");
270+
}
271+
return Platform.Linux64;
272+
}
273+
274+
private Platform getMacPlatform(String arch, boolean is64) {
275+
if (arch.startsWith("ppc")) {
276+
throw new UnsupportedOperationException("PowerPC macOS is not supported.");
277+
}
278+
if (arch.startsWith("aarch")) {
279+
return Platform.MacOSX_ARM64; // no 32-bit version
280+
}
281+
if (!is64) {
282+
throw unsupported32Bit("macOS");
283+
}
284+
return Platform.MacOSX64;
285+
}
286+
287+
public Platform getPlatform() {
288+
String os = System.getProperty("os.name").toLowerCase();
289+
String arch = System.getProperty("os.arch").toLowerCase();
290+
boolean is64 = is64Bit(arch);
291+
if (os.contains("windows")) {
292+
return getWindowsPlatform(arch, is64);
293+
} else if (os.contains("linux") || os.contains("freebsd")
294+
|| os.contains("sunos") || os.contains("unix")) {
295+
return getLinuxPlatform(arch, is64);
296+
} else if (os.contains("mac os x") || os.contains("darwin")) {
297+
return getMacPlatform(arch, is64);
298+
} else {
299+
throw new UnsupportedOperationException("The specified platform: " + os + " is not supported.");
300+
}
274301
}
275302

276303
public String getBuildInfo() {

jme3-core/src/main/java/com/jme3/system/Platform.java

Lines changed: 36 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -36,74 +36,49 @@
3636
*/
3737
public enum Platform {
3838

39-
/**
40-
* Microsoft Windows 32-bit AMD/Intel
41-
*/
42-
Windows32(Os.Windows),
43-
44-
/**
45-
* Microsoft Windows 64-bit AMD/Intel
46-
*/
47-
Windows64(Os.Windows, true),
48-
49-
/**
50-
* Microsoft Windows 32-bit ARM
51-
*/
52-
Windows_ARM32(Os.Windows),
53-
54-
/**
55-
* Microsoft Windows 64-bit ARM
56-
*/
57-
Windows_ARM64(Os.Windows, true),
58-
59-
/**
60-
* Linux 32-bit Intel
61-
*/
62-
Linux32(Os.Linux),
63-
64-
/**
65-
* Linux 64-bit Intel
66-
*/
67-
Linux64(Os.Linux, true),
68-
69-
/**
70-
* Linux 32-bit ARM
71-
*/
72-
Linux_ARM32(Os.Linux),
73-
74-
/**
75-
* Linux 64-bit ARM
76-
*/
77-
Linux_ARM64(Os.Linux, true),
78-
79-
/**
80-
* Apple Mac OS X 32-bit Intel
81-
*/
82-
MacOSX32(Os.MacOS),
83-
84-
/**
85-
* Apple Mac OS X 64-bit Intel
86-
*/
39+
/**
40+
* Microsoft Windows 64-bit AMD/Intel
41+
*/
42+
Windows64(Os.Windows, true),
43+
44+
/**
45+
* Microsoft Windows 32-bit ARM
46+
*/
47+
Windows_ARM32(Os.Windows),
48+
49+
/**
50+
* Microsoft Windows 64-bit ARM
51+
*/
52+
Windows_ARM64(Os.Windows, true),
53+
54+
/**
55+
* Linux 64-bit Intel
56+
*/
57+
Linux64(Os.Linux, true),
58+
59+
/**
60+
* Linux 32-bit ARM
61+
*/
62+
Linux_ARM32(Os.Linux),
63+
64+
/**
65+
* Linux 64-bit ARM
66+
*/
67+
Linux_ARM64(Os.Linux, true),
68+
69+
/**
70+
* Apple Mac OS X 64-bit Intel
71+
*/
8772
MacOSX64(Os.MacOS, true),
8873

8974
/**
9075
* Apple Mac OS X 64-bit ARM
9176
*/
9277
MacOSX_ARM64(Os.MacOS, true),
9378

94-
/**
95-
* Apple Mac OS X 32 bit PowerPC
96-
*/
97-
MacOSX_PPC32(Os.MacOS),
98-
99-
/**
100-
* Apple Mac OS X 64 bit PowerPC
101-
*/
102-
MacOSX_PPC64(Os.MacOS, true),
103-
104-
/**
105-
* Android ARM5
106-
*/
79+
/**
80+
* Android ARM5
81+
*/
10782
Android_ARM5(Os.Android),
10883

10984
/**

jme3-desktop/src/main/java/com/jme3/system/ExtractNativeLibraries.java

Lines changed: 3 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -60,28 +60,22 @@ public static void main(String[] args) {
6060
}
6161
if (args.length < 2) {
6262
System.err.println("Usage: ExtractNativeLibraries Platform ExtractionPath");
63-
System.err.println("Where 'Platform' is either Windows32, Windows64, Linux32, Linux64, MacOSX32 or MacOSX64");
63+
System.err.println("Where 'Platform' is either Windows64, Linux64, or MacOSX64");
6464
System.err.println("'ExtractionPath' is a folder to extract the binaries to.");
6565
System.err.println("You can also use ExtractNativeLibraries getjarexcludes to get a list of excludes for the jar files that contain binaries.");
6666
System.exit(1);
6767
}
6868
String path = args[1].replace('/', File.separatorChar);
6969
File folder = new File(path);
7070
try {
71-
if ("Windows32".equals(args[0])) {
72-
NativeLibraryLoader.extractNativeLibraries(Platform.Windows32, folder);
73-
} else if ("Windows64".equals(args[0])) {
71+
if ("Windows64".equals(args[0])) {
7472
NativeLibraryLoader.extractNativeLibraries(Platform.Windows64, folder);
75-
} else if ("Linux32".equals(args[0])) {
76-
NativeLibraryLoader.extractNativeLibraries(Platform.Linux32, folder);
7773
} else if ("Linux64".equals(args[0])) {
7874
NativeLibraryLoader.extractNativeLibraries(Platform.Linux64, folder);
79-
} else if ("MacOSX32".equals(args[0])) {
80-
NativeLibraryLoader.extractNativeLibraries(Platform.MacOSX32, folder);
8175
} else if ("MacOSX64".equals(args[0])) {
8276
NativeLibraryLoader.extractNativeLibraries(Platform.MacOSX64, folder);
8377
} else {
84-
System.err.println("Please specify a platform, Windows32, Windows64, Linux32, Linux64, MacOSX32 or MacOSX64");
78+
System.err.println("Please specify a platform, Windows64, Linux64, or MacOSX64");
8579
System.exit(3);
8680
}
8781
} catch (IOException ex) {

jme3-desktop/src/main/java/com/jme3/system/NativeLibraries.java

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -54,11 +54,8 @@ public enum NativeLibraries {
5454
// Delegate loading to lwjgl.
5555
System.setProperty("org.lwjgl.librarypath",
5656
Paths.get(libPath).getParent().toAbsolutePath().toString()))
57-
.addNativeVariant(Platform.Windows32, "lwjgl.dll")
5857
.addNativeVariant(Platform.Windows64, "lwjgl64.dll")
59-
.addNativeVariant(Platform.Linux32, "liblwjgl.so")
6058
.addNativeVariant(Platform.Linux64, "liblwjgl64.so")
61-
.addNativeVariant(Platform.MacOSX32, "liblwjgl.dylib")
6259
.addNativeVariant(Platform.MacOSX64, "liblwjgl.dylib")
6360
),
6461

@@ -68,26 +65,20 @@ public enum NativeLibraries {
6865
* Native OpenAL audio libraries for LWJGL 2 required by jme3-lwjgl backend.
6966
*/
7067
OpenAL(new LibraryInfo("openal")
71-
.addNativeVariant(Platform.Windows32, "OpenAL32.dll")
7268
.addNativeVariant(Platform.Windows64, "OpenAL64.dll")
73-
.addNativeVariant(Platform.Linux32, "libopenal.so")
7469
.addNativeVariant(Platform.Linux64, "libopenal64.so")
75-
.addNativeVariant(Platform.MacOSX32, "openal.dylib", "libopenal.dylib")
7670
.addNativeVariant(Platform.MacOSX64, "openal.dylib", "libopenal.dylib")
7771
),
7872

7973
/**
8074
* Native bullet physics libraries required by Minie library.
8175
*/
8276
BulletJme(new LibraryInfo("bulletjme")
83-
.addNativeVariant(Platform.Windows32, "native/windows/x86/bulletjme.dll", "bulletjme-x86.dll")
8477
.addNativeVariant(Platform.Windows64, "native/windows/x86_64/bulletjme.dll", "bulletjme-x86_64.dll")
8578
.addNativeVariant(Platform.Windows_ARM64, "native/windows/arm64/bulletjme.dll", "bulletjme-arm64.dll")
86-
.addNativeVariant(Platform.Linux32, "native/linux/x86/libbulletjme.so", "libbulletjme-x86.so")
8779
.addNativeVariant(Platform.Linux64, "native/linux/x86_64/libbulletjme.so", "libbulletjme-x86_64.so")
8880
.addNativeVariant(Platform.Linux_ARM32, "native/linux/arm32/libbulletjme.so", "libbulletjme-arm32.so")
8981
.addNativeVariant(Platform.Linux_ARM64, "native/linux/arm64/libbulletjme.so", "libbulletjme-arm64.so")
90-
.addNativeVariant(Platform.MacOSX32, "native/osx/x86/libbulletjme.dylib", "libbulletjme-x86.dylib")
9182
.addNativeVariant(Platform.MacOSX64, "native/osx/x86_64/libbulletjme.dylib", "libbulletjme-x86_64.dylib")
9283
.addNativeVariant(Platform.MacOSX_ARM64, "native/osx/arm64/libbulletjme.dylib", "libbulletjme-arm64.dylib")
9384
),
@@ -100,11 +91,8 @@ public enum NativeLibraries {
10091
// Delegate loading to jinput.
10192
System.setProperty("net.java.games.input.librarypath",
10293
Paths.get(libPath).getParent().toAbsolutePath().toString()))
103-
.addNativeVariant(Platform.Windows32, "jinput-raw.dll")
10494
.addNativeVariant(Platform.Windows64, "jinput-raw_64.dll")
105-
.addNativeVariant(Platform.Linux32, "libjinput-linux.so")
10695
.addNativeVariant(Platform.Linux64, "libjinput-linux64.so")
107-
.addNativeVariant(Platform.MacOSX32, "libjinput-osx.jnilib", "libjinput-osx.dylib")
10896
.addNativeVariant(Platform.MacOSX64, "libjinput-osx.jnilib", "libjinput-osx.dylib")
10997
),
11098

@@ -113,11 +101,8 @@ public enum NativeLibraries {
113101
* (only required on Windows)
114102
*/
115103
JInputDX8(new LibraryInfo("jinput-dx8")
116-
.addNativeVariant(Platform.Windows32, "jinput-dx8.dll", null)
117104
.addNativeVariant(Platform.Windows64, "jinput-dx8_64.dll", null)
118-
.addNativeVariant(Platform.Linux32, null)
119105
.addNativeVariant(Platform.Linux64, null)
120-
.addNativeVariant(Platform.MacOSX32, null)
121106
.addNativeVariant(Platform.MacOSX64, null)
122107
);
123108

jme3-desktop/src/main/java/com/jme3/system/NativeLibraryLoader.java

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -54,15 +54,12 @@
5454
* You can then extract this library (depending on platform), by
5555
* using {@link #loadNativeLibrary(java.lang.String, boolean) }.
5656
* <br>
57-
* Example:<br>
58-
* <pre>
59-
* NativeLibraryLoader.registerNativeLibrary("mystuff", Platform.Windows32, "native/windows/mystuff.dll");
60-
* NativeLibraryLoader.registerNativeLibrary("mystuff", Platform.Windows64, "native/windows/mystuff64.dll");
61-
* NativeLibraryLoader.registerNativeLibrary("mystuff", Platform.Linux32, "native/linux/libmystuff.so");
62-
* NativeLibraryLoader.registerNativeLibrary("mystuff", Platform.Linux64, "native/linux/libmystuff64.so");
63-
* NativeLibraryLoader.registerNativeLibrary("mystuff", Platform.MacOSX32, "native/macosx/libmystuff.jnilib");
64-
* NativeLibraryLoader.registerNativeLibrary("mystuff", Platform.MacOSX64, "native/macosx/libmystuff.jnilib");
65-
* </pre>
57+
* Example:<br>
58+
* <pre>
59+
* NativeLibraryLoader.registerNativeLibrary("mystuff", Platform.Windows64, "native/windows/mystuff64.dll");
60+
* NativeLibraryLoader.registerNativeLibrary("mystuff", Platform.Linux64, "native/linux/libmystuff64.so");
61+
* NativeLibraryLoader.registerNativeLibrary("mystuff", Platform.MacOSX64, "native/macosx/libmystuff.jnilib");
62+
* </pre>
6663
* <br>
6764
* This will register the library. Load it via: <br>
6865
* <pre>

jme3-lwjgl/src/main/java/com/jme3/system/lwjgl/LwjglCanvas.java

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -406,10 +406,7 @@ protected void destroyContext() {
406406
// freezes the application.
407407
// On Mac it freezes the application.
408408
// On Linux it fixes a crash with X Window System.
409-
if (
410-
JmeSystem.getPlatform() == Platform.Windows32 ||
411-
JmeSystem.getPlatform() == Platform.Windows64
412-
) {
409+
if (JmeSystem.getPlatform() == Platform.Windows64) {
413410
// Display.setParent(null);
414411
}
415412
// } catch (LWJGLException ex) {

0 commit comments

Comments
 (0)