From 798fcf29981bdcc22b61a71813a95a72dc683c8a Mon Sep 17 00:00:00 2001 From: panxuefeng Date: Mon, 14 Aug 2023 14:48:26 +0800 Subject: [PATCH 1/2] Support for LoongArch64 --- platform/pom.xml | 22 +++++++++++++ src/it/osgi/pom.xml | 9 ++++++ .../java/org/bytedeco/javacpp/Loader.java | 2 ++ .../properties/linux-loongarch64.properties | 31 +++++++++++++++++++ 4 files changed, 64 insertions(+) create mode 100644 src/main/resources/org/bytedeco/javacpp/properties/linux-loongarch64.properties diff --git a/platform/pom.xml b/platform/pom.xml index 3766d6ec0..6ef21d29e 100644 --- a/platform/pom.xml +++ b/platform/pom.xml @@ -1260,6 +1260,19 @@ + + javacpp.platform.custom-linux-loongarch64 + + + javacpp.platform.host + + linuxloongarch64 + + + linux-loongarch64${javacpp.platform.extension} + + + javacpp.platform.custom-linux-armv8 @@ -1504,6 +1517,15 @@ arm64 + + loongarch64 + + loongarch64 + + + loongarch64 + + armv8 diff --git a/src/it/osgi/pom.xml b/src/it/osgi/pom.xml index 2acef58fe..9aaabb871 100644 --- a/src/it/osgi/pom.xml +++ b/src/it/osgi/pom.xml @@ -73,6 +73,15 @@ arm64 + + loongarch64 + + loongarch64 + + + loongarch64 + + armv8 diff --git a/src/main/java/org/bytedeco/javacpp/Loader.java b/src/main/java/org/bytedeco/javacpp/Loader.java index 819933d58..d35a4300d 100644 --- a/src/main/java/org/bytedeco/javacpp/Loader.java +++ b/src/main/java/org/bytedeco/javacpp/Loader.java @@ -126,6 +126,8 @@ public static String getPlatform() { osArch = "x86_64"; } else if (osArch.startsWith("aarch64") || osArch.startsWith("armv8") || osArch.startsWith("arm64")) { osArch = "arm64"; + } else if (osArch.startsWith("loongarch64")) { + osArch = "loongarch64"; } else if ((osArch.startsWith("arm")) && ((abiType.equals("gnueabihf")) || (libPath.contains("jdk-armhf")))) { osArch = "armhf"; } else if (osArch.startsWith("arm")) { diff --git a/src/main/resources/org/bytedeco/javacpp/properties/linux-loongarch64.properties b/src/main/resources/org/bytedeco/javacpp/properties/linux-loongarch64.properties new file mode 100644 index 000000000..4ccb12128 --- /dev/null +++ b/src/main/resources/org/bytedeco/javacpp/properties/linux-loongarch64.properties @@ -0,0 +1,31 @@ +platform=linux-loongarch64 +platform.path.separator=: +platform.source.suffix=.cpp +platform.includepath.prefix=-I +platform.includepath= +platform.compiler=g++ +platform.compiler.cpp98=-std=c++98 +platform.compiler.cpp03=-std=c++03 +platform.compiler.cpp11=-std=c++11 +platform.compiler.cpp14=-std=c++14 +platform.compiler.cpp17=-std=c++17 +platform.compiler.debug=-O0 -g +platform.compiler.default=-march=loongarch64 -mabi=lp64 -O3 -s +platform.compiler.fastfpu=-ffast-math +platform.compiler.nodeprecated=-Wno-deprecated-declarations +platform.compiler.noexceptions=-fno-exceptions -fno-rtti +platform.compiler.nowarnings=-w +platform.compiler.output=-Wl,-rpath,$ORIGIN/ -Wl,-z,noexecstack -Wl,-Bsymbolic -Wall -fPIC -pthread -shared -o\u0020 +platform.linkpath.prefix=-L +platform.linkpath.prefix2=-Wl,-rpath, +platform.linkpath= +platform.link.prefix=-l +platform.link.suffix= +platform.link= +platform.framework.prefix=-F +platform.framework.suffix= +platform.framework= +platform.executable.prefix= +platform.executable.suffix= +platform.library.prefix=lib +platform.library.suffix=.so From adf38e2c9ca00b854df8d06faa064ed2b75282b3 Mon Sep 17 00:00:00 2001 From: panxuefeng Date: Thu, 17 Aug 2023 13:48:53 +0800 Subject: [PATCH 2/2] remove value of loongarch64 --- src/main/java/org/bytedeco/javacpp/Loader.java | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/main/java/org/bytedeco/javacpp/Loader.java b/src/main/java/org/bytedeco/javacpp/Loader.java index d35a4300d..819933d58 100644 --- a/src/main/java/org/bytedeco/javacpp/Loader.java +++ b/src/main/java/org/bytedeco/javacpp/Loader.java @@ -126,8 +126,6 @@ public static String getPlatform() { osArch = "x86_64"; } else if (osArch.startsWith("aarch64") || osArch.startsWith("armv8") || osArch.startsWith("arm64")) { osArch = "arm64"; - } else if (osArch.startsWith("loongarch64")) { - osArch = "loongarch64"; } else if ((osArch.startsWith("arm")) && ((abiType.equals("gnueabihf")) || (libPath.contains("jdk-armhf")))) { osArch = "armhf"; } else if (osArch.startsWith("arm")) {