Skip to content

Commit a92bd18

Browse files
8Keepriccardoblgemini-code-assist[bot]
authored
Remove 32-bit support (#2685)
* Remove desktop 32-bit support * more 32 bit deprecation and cleanup * fixup * Update jme3-android/src/main/java/com/jme3/system/android/JmeAndroidSystem.java Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com> --------- Co-authored-by: Riccardo Balbo <os@rblb.it> Co-authored-by: gemini-code-assist[bot] <176961590+gemini-code-assist[bot]@users.noreply.github.com>
1 parent 5af1548 commit a92bd18

14 files changed

Lines changed: 136 additions & 208 deletions

File tree

gradle.properties

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,6 @@ buildJavaDoc = true
1919
buildNativeProjects = false
2020
buildAndroidExamples = false
2121

22-
buildForPlatforms = Linux64,Linux32,Windows64,Windows32,Mac64
2322
# Forcefully ignore prebuilt libraries
2423
skipPrebuildLibraries=false
2524

jme3-android-native/openalsoft.gradle

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -86,12 +86,10 @@ def ndkPath = new File(rootProject.ndkCommandPath).getParent()
8686
def cmakeToolchain = "${ndkPath}/build/cmake/android.toolchain.cmake"
8787

8888
// 1) list your ABIs here
89-
def openalAbis = [
90-
"armeabi-v7a",
91-
"arm64-v8a",
92-
"x86",
93-
"x86_64"
94-
]
89+
def openalAbis = [
90+
"arm64-v8a",
91+
"x86_64"
92+
]
9593

9694
// 2) for each ABI, register a configure/build pair
9795
openalAbis.each { abi ->
@@ -170,7 +168,7 @@ task buildOpenAlSoftNativeLib(type: Exec) {
170168
// the cmake-build-<ABI> folders.
171169
args(
172170
// let ndk-build know which ABIs to build for
173-
"APP_ABI=armeabi-v7a,arm64-v8a,x86,x86_64",
171+
"APP_ABI=arm64-v8a,x86_64",
174172

175173
// pass in the path to the CMake output root
176174
"OPENALSOFT_BUILD_ROOT=${openalsoftBuildDir}/${openALSoftFolder}",

jme3-android-native/src/native/jme_bufferallocator/Application.mk

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -33,9 +33,8 @@
3333
# Created by pavl_g on 5/17/22.
3434
# For more : https://developer.android.com/ndk/guides/application_mk.
3535
##
36-
APP_PLATFORM := android-19
36+
APP_PLATFORM := android-21
3737
# change this to 'debug' to see android logs
3838
APP_OPTIM := release
39-
APP_ABI := armeabi-v7a,arm64-v8a,x86,x86_64
39+
APP_ABI := arm64-v8a,x86_64
4040
APP_SUPPORT_FLEXIBLE_PAGE_SIZES := true
41-
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
1-
APP_PLATFORM := android-9
1+
APP_PLATFORM := android-21
22
APP_OPTIM := release
3-
APP_ABI := armeabi-v7a,arm64-v8a,x86,x86_64
3+
APP_ABI := arm64-v8a,x86_64
44
APP_SUPPORT_FLEXIBLE_PAGE_SIZES := true
5-
Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
1-
APP_PLATFORM := android-19
1+
APP_PLATFORM := android-21
22
APP_OPTIM := release
3-
APP_ABI := armeabi-v7a,arm64-v8a,x86,x86_64
3+
APP_ABI := arm64-v8a,x86_64
44
APP_STL := c++_static
55
APP_SUPPORT_FLEXIBLE_PAGE_SIZES := true
6-

jme3-android/src/main/java/com/jme3/system/android/JmeAndroidSystem.java

Lines changed: 23 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import android.app.AlertDialog;
44
import android.content.Context;
55
import android.graphics.Bitmap;
6+
import android.os.Build;
67
import android.os.Environment;
78
import android.view.View;
89
import android.view.inputmethod.InputMethodManager;
@@ -24,6 +25,8 @@
2425
import java.io.OutputStream;
2526
import java.net.URL;
2627
import java.nio.ByteBuffer;
28+
import java.util.Arrays;
29+
import java.util.Locale;
2730
import java.util.logging.Level;
2831

2932
public class JmeAndroidSystem extends JmeSystemDelegate {
@@ -115,24 +118,28 @@ public void initialize(AppSettings settings) {
115118

116119
@Override
117120
public Platform getPlatform() {
118-
String arch = System.getProperty("os.arch").toLowerCase();
119-
if (arch.contains("arm")) {
120-
if (arch.contains("v5")) {
121-
return Platform.Android_ARM5;
122-
} else if (arch.contains("v6")) {
123-
return Platform.Android_ARM6;
124-
} else if (arch.contains("v7")) {
125-
return Platform.Android_ARM7;
126-
} else if (arch.contains("v8")) {
121+
String arch = System.getProperty("os.arch", "").toLowerCase(Locale.ROOT);
122+
switch (arch) {
123+
case "aarch64":
124+
case "arm64":
127125
return Platform.Android_ARM8;
128-
} else {
129-
return Platform.Android_ARM5; // unknown ARM
130-
}
131-
} else if (arch.contains("aarch")) {
132-
return Platform.Android_ARM8;
133-
} else {
134-
return Platform.Android_Other;
126+
case "x86_64":
127+
case "amd64":
128+
return Platform.Android_X86_64;
129+
case "arm":
130+
case "armv7l":
131+
case "x86":
132+
case "i386":
133+
case "i686":
134+
throw new UnsupportedOperationException("Unsupported 32-bit Android architecture: " + arch);
135+
default:
136+
if (arch.startsWith("arm") || arch.contains("armeabi")) {
137+
throw new UnsupportedOperationException("Unsupported 32-bit Android architecture: " + arch);
138+
}
139+
throw new UnsupportedOperationException("Unsupported Android architecture: " + arch
140+
+ ", supported ABIs: " + (Build.VERSION.SDK_INT >= 21 ? Arrays.toString(Build.SUPPORTED_ABIS) : "unknown"));
135141
}
142+
136143
}
137144

138145
@Override

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

Lines changed: 69 additions & 42 deletions
Original file line numberDiff line numberDiff line change
@@ -215,59 +215,86 @@ public boolean showSettingsDialog(AppSettings settings, boolean loadFromRegistry
215215
}
216216

217217

218-
private boolean is64Bit(String arch) {
219-
if (arch.equals("x86")) {
220-
return false;
221-
} else if (arch.equals("amd64")) {
222-
return true;
223-
} else if (arch.equals("x86_64")) {
224-
return true;
225-
} else if (arch.equals("ppc") || arch.equals("PowerPC")) {
226-
return false;
227-
} else if (arch.equals("ppc64")) {
228-
return true;
229-
} else if (arch.equals("i386") || arch.equals("i686")) {
230-
return false;
231-
} else if (arch.equals("universal")) {
232-
return false;
233-
} else if (arch.equals("aarch32")) {
234-
return false;
235-
} else if (arch.equals("aarch64")) {
236-
return true;
237-
} else if (arch.equals("armv7") || arch.equals("armv7l")) {
238-
return false;
239-
} else if (arch.equals("arm")) {
240-
return false;
241-
} else {
242-
throw new UnsupportedOperationException("Unsupported architecture: " + arch);
218+
private boolean is64Bit(String arch) {
219+
switch (arch) {
220+
case "amd64":
221+
case "x86_64":
222+
case "aarch64":
223+
case "arm64":
224+
case "ppc64":
225+
case "universal":
226+
return true;
227+
case "x86":
228+
case "i386":
229+
case "i686":
230+
case "aarch32":
231+
case "arm":
232+
case "armv7":
233+
case "armv7l":
234+
return false;
235+
default:
236+
throw new UnsupportedOperationException("Unsupported architecture: " + arch);
237+
}
238+
}
239+
240+
private boolean isArmArchitecture(String arch) {
241+
return arch.startsWith("arm") || arch.startsWith("aarch");
242+
}
243+
244+
private boolean isX86Architecture(String arch) {
245+
return arch.equals("x86")
246+
|| arch.equals("amd64")
247+
|| arch.equals("x86_64")
248+
|| arch.equals("i386")
249+
|| arch.equals("i686")
250+
|| arch.equals("universal");
251+
}
252+
253+
private UnsupportedOperationException unsupported32Bit(String osName) {
254+
return new UnsupportedOperationException("32-bit " + osName + " is not supported.");
255+
}
256+
257+
private Platform getWindowsPlatform(String arch, boolean is64) {
258+
if (!is64) {
259+
// no 32-bit version
260+
throw unsupported32Bit("Windows");
243261
}
262+
if (isArmArchitecture(arch)) return Platform.Windows_ARM64;
263+
if (isX86Architecture(arch)) return Platform.Windows64;
264+
throw new UnsupportedOperationException("Unsupported architecture: " + arch);
265+
}
266+
267+
private Platform getLinuxPlatform(String arch, boolean is64) {
268+
if (!is64) {
269+
// no 32-bit version
270+
throw unsupported32Bit("Linux");
271+
}
272+
if (isArmArchitecture(arch)) return Platform.Linux_ARM64;
273+
if (isX86Architecture(arch)) return Platform.Linux64;
274+
throw new UnsupportedOperationException("Unsupported architecture: " + arch);
275+
}
276+
277+
private Platform getMacPlatform(String arch, boolean is64) {
278+
if (!is64) {
279+
// no 32-bit version
280+
throw unsupported32Bit("macOS");
281+
}
282+
if (isArmArchitecture(arch)) return Platform.MacOSX_ARM64;
283+
if (isX86Architecture(arch)) return Platform.MacOSX64;
284+
throw new UnsupportedOperationException("Unsupported architecture: " + arch);
244285
}
245286

246287
public Platform getPlatform() {
247288
String os = System.getProperty("os.name").toLowerCase();
248289
String arch = System.getProperty("os.arch").toLowerCase();
249290
boolean is64 = is64Bit(arch);
250291
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-
}
292+
return getWindowsPlatform(arch, is64);
256293
} else if (os.contains("linux") || os.contains("freebsd")
257294
|| 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-
}
295+
return getLinuxPlatform(arch, is64);
263296
} 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-
}
297+
return getMacPlatform(arch, is64);
271298
} else {
272299
throw new UnsupportedOperationException("The specified platform: " + os + " is not supported.");
273300
}

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

Lines changed: 13 additions & 69 deletions
Original file line numberDiff line numberDiff line change
@@ -36,51 +36,26 @@
3636
*/
3737
public enum Platform {
3838

39-
/**
40-
* Microsoft Windows 32-bit AMD/Intel
41-
*/
42-
Windows32(Os.Windows),
43-
4439
/**
4540
* Microsoft Windows 64-bit AMD/Intel
4641
*/
4742
Windows64(Os.Windows, true),
4843

49-
/**
50-
* Microsoft Windows 32-bit ARM
51-
*/
52-
Windows_ARM32(Os.Windows),
53-
5444
/**
5545
* Microsoft Windows 64-bit ARM
5646
*/
5747
Windows_ARM64(Os.Windows, true),
5848

59-
/**
60-
* Linux 32-bit Intel
61-
*/
62-
Linux32(Os.Linux),
63-
6449
/**
6550
* Linux 64-bit Intel
6651
*/
6752
Linux64(Os.Linux, true),
6853

69-
/**
70-
* Linux 32-bit ARM
71-
*/
72-
Linux_ARM32(Os.Linux),
73-
7454
/**
7555
* Linux 64-bit ARM
7656
*/
7757
Linux_ARM64(Os.Linux, true),
7858

79-
/**
80-
* Apple Mac OS X 32-bit Intel
81-
*/
82-
MacOSX32(Os.MacOS),
83-
8459
/**
8560
* Apple Mac OS X 64-bit Intel
8661
*/
@@ -90,57 +65,26 @@ public enum Platform {
9065
* Apple Mac OS X 64-bit ARM
9166
*/
9267
MacOSX_ARM64(Os.MacOS, true),
93-
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-
*/
107-
Android_ARM5(Os.Android),
108-
109-
/**
110-
* Android ARM6
111-
*/
112-
Android_ARM6(Os.Android),
113-
114-
/**
115-
* Android ARM7
116-
*/
117-
Android_ARM7(Os.Android),
118-
68+
11969
/**
12070
* Android ARM8
12171
*/
122-
Android_ARM8(Os.Android),
123-
124-
/**
125-
* Android x86
126-
*/
127-
Android_X86(Os.Android),
128-
129-
/**
130-
* iOS on x86
131-
*/
132-
iOS_X86(Os.iOS),
72+
Android_ARM8(Os.Android, true),
13373

13474
/**
135-
* iOS on ARM
75+
* Android x86_64
13676
*/
137-
iOS_ARM(Os.iOS),
77+
Android_X86_64(Os.Android, true),
13878

139-
/**
140-
* Android running on unknown platform (could be x86 or mips for example).
141-
*/
142-
Android_Other(Os.Android),
143-
79+
/**
80+
* iOS on ARM
81+
*/
82+
iOS_ARM(Os.iOS, true),
83+
84+
/**
85+
* iOS on x86_64 (simulator)
86+
*/
87+
iOS_X86(Os.iOS, true),
14488
/**
14589
* Generic web platform on unknown architecture
14690
*/

0 commit comments

Comments
 (0)