Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion gradle.properties
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ buildJavaDoc = true
buildNativeProjects = false
buildAndroidExamples = false

buildForPlatforms = Linux64,Linux32,Windows64,Windows32,Mac64
# Forcefully ignore prebuilt libraries
skipPrebuildLibraries=false

Expand Down
12 changes: 5 additions & 7 deletions jme3-android-native/openalsoft.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -86,12 +86,10 @@ def ndkPath = new File(rootProject.ndkCommandPath).getParent()
def cmakeToolchain = "${ndkPath}/build/cmake/android.toolchain.cmake"

// 1) list your ABIs here
def openalAbis = [
"armeabi-v7a",
"arm64-v8a",
"x86",
"x86_64"
]
def openalAbis = [
"arm64-v8a",
"x86_64"
]

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

// pass in the path to the CMake output root
"OPENALSOFT_BUILD_ROOT=${openalsoftBuildDir}/${openALSoftFolder}",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,9 +33,8 @@
# Created by pavl_g on 5/17/22.
# For more : https://developer.android.com/ndk/guides/application_mk.
##
APP_PLATFORM := android-19
APP_PLATFORM := android-21
# change this to 'debug' to see android logs
APP_OPTIM := release
APP_ABI := armeabi-v7a,arm64-v8a,x86,x86_64
APP_ABI := arm64-v8a,x86_64
APP_SUPPORT_FLEXIBLE_PAGE_SIZES := true

5 changes: 2 additions & 3 deletions jme3-android-native/src/native/jme_decode/Application.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
APP_PLATFORM := android-9
APP_PLATFORM := android-21
APP_OPTIM := release
APP_ABI := armeabi-v7a,arm64-v8a,x86,x86_64
APP_ABI := arm64-v8a,x86_64
APP_SUPPORT_FLEXIBLE_PAGE_SIZES := true

5 changes: 2 additions & 3 deletions jme3-android-native/src/native/jme_openalsoft/Application.mk
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
APP_PLATFORM := android-19
APP_PLATFORM := android-21
APP_OPTIM := release
APP_ABI := armeabi-v7a,arm64-v8a,x86,x86_64
APP_ABI := arm64-v8a,x86_64
APP_STL := c++_static
APP_SUPPORT_FLEXIBLE_PAGE_SIZES := true

Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
import android.app.AlertDialog;
import android.content.Context;
import android.graphics.Bitmap;
import android.os.Build;
import android.os.Environment;
import android.view.View;
import android.view.inputmethod.InputMethodManager;
Expand All @@ -24,6 +25,8 @@
import java.io.OutputStream;
import java.net.URL;
import java.nio.ByteBuffer;
import java.util.Arrays;
import java.util.Locale;
import java.util.logging.Level;

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

@Override
public Platform getPlatform() {
String arch = System.getProperty("os.arch").toLowerCase();
if (arch.contains("arm")) {
if (arch.contains("v5")) {
return Platform.Android_ARM5;
} else if (arch.contains("v6")) {
return Platform.Android_ARM6;
} else if (arch.contains("v7")) {
return Platform.Android_ARM7;
} else if (arch.contains("v8")) {
String arch = System.getProperty("os.arch", "").toLowerCase(Locale.ROOT);
switch (arch) {
case "aarch64":
case "arm64":
return Platform.Android_ARM8;
} else {
return Platform.Android_ARM5; // unknown ARM
}
} else if (arch.contains("aarch")) {
return Platform.Android_ARM8;
} else {
return Platform.Android_Other;
case "x86_64":
case "amd64":
return Platform.Android_X86_64;
case "arm":
case "armv7l":
case "x86":
case "i386":
case "i686":
throw new UnsupportedOperationException("Unsupported 32-bit Android architecture: " + arch);
default:
if (arch.startsWith("arm") || arch.contains("armeabi")) {
throw new UnsupportedOperationException("Unsupported 32-bit Android architecture: " + arch);
}
throw new UnsupportedOperationException("Unsupported Android architecture: " + arch
+ ", supported ABIs: " + (Build.VERSION.SDK_INT >= 21 ? Arrays.toString(Build.SUPPORTED_ABIS) : "unknown"));
}

}

@Override
Expand Down
111 changes: 69 additions & 42 deletions jme3-core/src/main/java/com/jme3/system/JmeSystemDelegate.java
Original file line number Diff line number Diff line change
Expand Up @@ -215,59 +215,86 @@ public boolean showSettingsDialog(AppSettings settings, boolean loadFromRegistry
}


private boolean is64Bit(String arch) {
if (arch.equals("x86")) {
return false;
} else if (arch.equals("amd64")) {
return true;
} else if (arch.equals("x86_64")) {
return true;
} else if (arch.equals("ppc") || arch.equals("PowerPC")) {
return false;
} else if (arch.equals("ppc64")) {
return true;
} else if (arch.equals("i386") || arch.equals("i686")) {
return false;
} else if (arch.equals("universal")) {
return false;
} else if (arch.equals("aarch32")) {
return false;
} else if (arch.equals("aarch64")) {
return true;
} else if (arch.equals("armv7") || arch.equals("armv7l")) {
return false;
} else if (arch.equals("arm")) {
return false;
} else {
throw new UnsupportedOperationException("Unsupported architecture: " + arch);
private boolean is64Bit(String arch) {
switch (arch) {
case "amd64":
case "x86_64":
case "aarch64":
case "arm64":
case "ppc64":
case "universal":
return true;
case "x86":
case "i386":
case "i686":
case "aarch32":
case "arm":
case "armv7":
case "armv7l":
return false;
default:
throw new UnsupportedOperationException("Unsupported architecture: " + arch);
}
Comment thread
riccardobl marked this conversation as resolved.
}

private boolean isArmArchitecture(String arch) {
return arch.startsWith("arm") || arch.startsWith("aarch");
}

private boolean isX86Architecture(String arch) {
return arch.equals("x86")
|| arch.equals("amd64")
|| arch.equals("x86_64")
|| arch.equals("i386")
|| arch.equals("i686")
|| arch.equals("universal");
}
Comment thread
riccardobl marked this conversation as resolved.

private UnsupportedOperationException unsupported32Bit(String osName) {
return new UnsupportedOperationException("32-bit " + osName + " is not supported.");
}

private Platform getWindowsPlatform(String arch, boolean is64) {
if (!is64) {
// no 32-bit version
throw unsupported32Bit("Windows");
}
if (isArmArchitecture(arch)) return Platform.Windows_ARM64;
if (isX86Architecture(arch)) return Platform.Windows64;
throw new UnsupportedOperationException("Unsupported architecture: " + arch);
}

private Platform getLinuxPlatform(String arch, boolean is64) {
if (!is64) {
// no 32-bit version
throw unsupported32Bit("Linux");
}
if (isArmArchitecture(arch)) return Platform.Linux_ARM64;
if (isX86Architecture(arch)) return Platform.Linux64;
throw new UnsupportedOperationException("Unsupported architecture: " + arch);
}

private Platform getMacPlatform(String arch, boolean is64) {
if (!is64) {
// no 32-bit version
throw unsupported32Bit("macOS");
}
if (isArmArchitecture(arch)) return Platform.MacOSX_ARM64;
if (isX86Architecture(arch)) return Platform.MacOSX64;
throw new UnsupportedOperationException("Unsupported architecture: " + arch);
}

public Platform getPlatform() {
String os = System.getProperty("os.name").toLowerCase();
String arch = System.getProperty("os.arch").toLowerCase();
boolean is64 = is64Bit(arch);
if (os.contains("windows")) {
if (arch.startsWith("arm") || arch.startsWith("aarch")) {
return is64 ? Platform.Windows_ARM64 : Platform.Windows_ARM32;
} else {
return is64 ? Platform.Windows64 : Platform.Windows32;
}
return getWindowsPlatform(arch, is64);
} else if (os.contains("linux") || os.contains("freebsd")
|| os.contains("sunos") || os.contains("unix")) {
if (arch.startsWith("arm") || arch.startsWith("aarch")) {
return is64 ? Platform.Linux_ARM64 : Platform.Linux_ARM32;
} else {
return is64 ? Platform.Linux64 : Platform.Linux32;
}
return getLinuxPlatform(arch, is64);
} else if (os.contains("mac os x") || os.contains("darwin")) {
if (arch.startsWith("ppc")) {
return is64 ? Platform.MacOSX_PPC64 : Platform.MacOSX_PPC32;
} else if (arch.startsWith("aarch")) {
return Platform.MacOSX_ARM64; // no 32-bit version
} else {
return is64 ? Platform.MacOSX64 : Platform.MacOSX32;
}
return getMacPlatform(arch, is64);
} else {
throw new UnsupportedOperationException("The specified platform: " + os + " is not supported.");
}
Expand Down
82 changes: 13 additions & 69 deletions jme3-core/src/main/java/com/jme3/system/Platform.java
Original file line number Diff line number Diff line change
Expand Up @@ -36,51 +36,26 @@
*/
public enum Platform {

/**
* Microsoft Windows 32-bit AMD/Intel
*/
Windows32(Os.Windows),

/**
* Microsoft Windows 64-bit AMD/Intel
*/
Windows64(Os.Windows, true),

/**
* Microsoft Windows 32-bit ARM
*/
Windows_ARM32(Os.Windows),

/**
* Microsoft Windows 64-bit ARM
*/
Windows_ARM64(Os.Windows, true),

/**
* Linux 32-bit Intel
*/
Linux32(Os.Linux),

/**
* Linux 64-bit Intel
*/
Linux64(Os.Linux, true),

/**
* Linux 32-bit ARM
*/
Linux_ARM32(Os.Linux),

/**
* Linux 64-bit ARM
*/
Linux_ARM64(Os.Linux, true),

/**
* Apple Mac OS X 32-bit Intel
*/
MacOSX32(Os.MacOS),

/**
* Apple Mac OS X 64-bit Intel
*/
Expand All @@ -90,57 +65,26 @@ public enum Platform {
* Apple Mac OS X 64-bit ARM
*/
MacOSX_ARM64(Os.MacOS, true),

/**
* Apple Mac OS X 32 bit PowerPC
*/
MacOSX_PPC32(Os.MacOS),

/**
* Apple Mac OS X 64 bit PowerPC
*/
MacOSX_PPC64(Os.MacOS, true),

/**
* Android ARM5
*/
Android_ARM5(Os.Android),

/**
* Android ARM6
*/
Android_ARM6(Os.Android),

/**
* Android ARM7
*/
Android_ARM7(Os.Android),


/**
* Android ARM8
*/
Android_ARM8(Os.Android),

/**
* Android x86
*/
Android_X86(Os.Android),

/**
* iOS on x86
*/
iOS_X86(Os.iOS),
Android_ARM8(Os.Android, true),

/**
* iOS on ARM
* Android x86_64
*/
iOS_ARM(Os.iOS),
Android_X86_64(Os.Android, true),

/**
* Android running on unknown platform (could be x86 or mips for example).
*/
Android_Other(Os.Android),

/**
* iOS on ARM
*/
iOS_ARM(Os.iOS, true),

/**
* iOS on x86_64 (simulator)
*/
iOS_X86(Os.iOS, true),
/**
* Generic web platform on unknown architecture
*/
Expand Down
Loading