From 6a3d31af2deac811578962bb3d8cb3a2ffbac53b Mon Sep 17 00:00:00 2001 From: Jiaxun Yang Date: Sun, 26 Jan 2020 22:37:16 +0800 Subject: [PATCH] build: add support for Linux MIPS64 cross compilation Mostly identical to the ARM one except bullet is disabled due to CI nolonger provide formal bullet build but switch to libbulletc have not completed. Signed-off-by: Jiaxun Yang --- README.md | 1 + build.gradle.kts | 1 + build.xml | 22 +++++++++++++++++++ config/build-bindings.xml | 17 +++++++------- config/build-definitions.xml | 6 ++--- config/linux/build.xml | 1 + .../main/java/org/lwjgl/system/Platform.java | 15 ++++++++----- 7 files changed, 47 insertions(+), 16 deletions(-) diff --git a/README.md b/README.md index 12feb54525..30402e7662 100644 --- a/README.md +++ b/README.md @@ -74,6 +74,7 @@ following platforms/architectures: - Linux x64 - Linux arm64 (ARMv8/AArch64) - Linux arm32 (ARMv7/armhf) +- Linux mips64 (mips64r2 Little-Endian) - macOS x64 - Windows x64 - Windows x86 diff --git a/build.gradle.kts b/build.gradle.kts index 0f23f8f52d..4a40d5ff50 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -62,6 +62,7 @@ enum class Platforms(val classifier: String) { LINUX("linux"), LINUX_ARM64("linux-arm64"), LINUX_ARM32("linux-arm32"), + LINUX_MIPS64("linux-mips64"), MACOS("macos"), WINDOWS("windows"), WINDOWS_X86("windows-x86"); diff --git a/build.xml b/build.xml index cc9ad37b2a..fb8b41bf28 100644 --- a/build.xml +++ b/build.xml @@ -951,6 +951,7 @@ + @@ -979,6 +980,10 @@ + + + + @@ -1036,6 +1041,9 @@ + + + @@ -1057,6 +1065,7 @@ + @@ -1078,6 +1087,7 @@ + @@ -1271,6 +1281,11 @@ + + + + + @@ -1345,6 +1360,9 @@ + + + @@ -1421,6 +1439,10 @@ + + + + diff --git a/config/build-bindings.xml b/config/build-bindings.xml index 10fd86a3bd..14b401d51d 100644 --- a/config/build-bindings.xml +++ b/config/build-bindings.xml @@ -14,8 +14,8 @@ This script is included in /config/build-definitions.xml. - - + + @@ -24,7 +24,8 @@ This script is included in /config/build-definitions.xml. - + + @@ -37,31 +38,31 @@ This script is included in /config/build-definitions.xml. - + - + - + - + - + diff --git a/config/build-definitions.xml b/config/build-definitions.xml index 71eb23802c..d983d7ea7c 100644 --- a/config/build-definitions.xml +++ b/config/build-definitions.xml @@ -16,15 +16,15 @@ This script is included in /build.xml and /config/update-dependencies.xml. By default, os.arch of the JVM that runs ANT is used, but this can be overridden for cross-compiling to another architecture. - Valid values: x64, x86, arm64, arm32 + Valid values: x64, x86, arm64, arm32, mips64 --> - - + + diff --git a/config/linux/build.xml b/config/linux/build.xml index 3ab3819b1a..f113035636 100644 --- a/config/linux/build.xml +++ b/config/linux/build.xml @@ -7,6 +7,7 @@ + diff --git a/modules/lwjgl/core/src/main/java/org/lwjgl/system/Platform.java b/modules/lwjgl/core/src/main/java/org/lwjgl/system/Platform.java index 1babac9199..491093e01d 100644 --- a/modules/lwjgl/core/src/main/java/org/lwjgl/system/Platform.java +++ b/modules/lwjgl/core/src/main/java/org/lwjgl/system/Platform.java @@ -54,7 +54,8 @@ public enum Architecture { X64(true), X86(false), ARM64(true), - ARM32(false); + ARM32(false), + MIPS64(true); static final Architecture current; @@ -64,10 +65,14 @@ public enum Architecture { String osArch = System.getProperty("os.arch"); boolean is64Bit = osArch.contains("64") || osArch.startsWith("armv8"); - current = osArch.startsWith("arm") || osArch.startsWith("aarch64") - ? (is64Bit ? Architecture.ARM64 : Architecture.ARM32) - : (is64Bit ? Architecture.X64 : Architecture.X86); - } + if (osArch.startsWith("arm") || osArch.startsWith("aarch64")) { + current = (is64Bit ? Architecture.ARM64 : Architecture.ARM32); + } else if (osArch.startsWith("mips") || osArch.startsWith("loongson")) { + current = Architecture.MIPS64; + } else { + current = (is64Bit ? Architecture.X64 : Architecture.X86); + } + } Architecture(boolean is64Bit) { this.is64Bit = is64Bit;