Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add support for linux_riscv32, linux_riscv64 #48

Merged
merged 1 commit into from
Nov 7, 2023
Merged
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
26 changes: 23 additions & 3 deletions src/main/java/org/scijava/nativelib/NativeLibraryUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,10 @@
* libxxx[-vvv].so
* linux_arm64
* libxxx[-vvv].so
* linux_riscv32
* libxxx[-vvv].so
* linux_riscv64
* libxxx[-vvv].so
* osx_32
* libxxx[-vvv].dylib
* osx_64
Expand Down Expand Up @@ -83,12 +87,13 @@
public class NativeLibraryUtil {

public static enum Architecture {
UNKNOWN, LINUX_32, LINUX_64, LINUX_ARM, LINUX_ARM64, WINDOWS_32, WINDOWS_64, WINDOWS_ARM64,
OSX_32, OSX_64, OSX_PPC, OSX_ARM64, AIX_32, AIX_64
UNKNOWN, LINUX_32, LINUX_64, LINUX_ARM, LINUX_ARM64, LINUX_RISCV32, LINUX_RISCV64,
WINDOWS_32, WINDOWS_64, WINDOWS_ARM64,
OSX_32, OSX_64, OSX_PPC, OSX_ARM64, AIX_32, AIX_64
}

private static enum Processor {
UNKNOWN, INTEL_32, INTEL_64, PPC, PPC_64, ARM, AARCH_64
UNKNOWN, INTEL_32, INTEL_64, PPC, PPC_64, ARM, AARCH_64, RISCV_32, RISCV_64
}

public static final String DELIM = "/";
Expand Down Expand Up @@ -122,6 +127,12 @@ else if (Processor.ARM == processor) {
else if (Processor.AARCH_64 == processor) {
architecture = Architecture.LINUX_ARM64;
}
else if (Processor.RISCV_32 == processor) {
architecture = Architecture.LINUX_RISCV32;
}
else if (Processor.RISCV_64 == processor) {
architecture = Architecture.LINUX_RISCV64;
}
}
else if (name.contains("aix")) {
if (Processor.PPC == processor) {
Expand Down Expand Up @@ -195,6 +206,13 @@ else if (arch.contains("86") || arch.contains("amd")) {
}
processor = (32 == bits) ? Processor.INTEL_32 : Processor.INTEL_64;
}
else if (arch.contains("riscv")) {
bits = 32;
if (arch.contains("64")) {
bits = 64;
}
processor = (32 == bits) ? Processor.RISCV_32 : Processor.RISCV_64;
}
LOGGER.debug("processor is " + processor + " os.arch is " +
System.getProperty("os.arch").toLowerCase(Locale.ENGLISH));
return processor;
Expand Down Expand Up @@ -235,6 +253,8 @@ public static String getPlatformLibraryName(final String libName) {
case LINUX_64:
case LINUX_ARM:
case LINUX_ARM64:
case LINUX_RISCV32:
case LINUX_RISCV64:
name = "lib" + libName + ".so";
break;
case WINDOWS_32:
Expand Down
Loading