Skip to content

Commit

Permalink
Add check for os.arch when unpacking MLModel .dlls on WIndows (#679)
Browse files Browse the repository at this point in the history
* Add check for os.arch when unpacking MLModel .dlls on WIndows
  • Loading branch information
retiutut authored Oct 26, 2023
1 parent 3caf957 commit 8305c60
Showing 1 changed file with 18 additions and 4 deletions.
22 changes: 18 additions & 4 deletions java_package/brainflow/src/main/java/brainflow/MLModel.java
Original file line number Diff line number Diff line change
Expand Up @@ -43,10 +43,24 @@ private interface DllInterface extends Library
if (SystemUtils.IS_OS_WINDOWS)
{
lib_name = "MLModule.dll";
JarHelper.unpack_from_jar ("onnxruntime_arm.dll");
JarHelper.unpack_from_jar ("onnxruntime_arm64.dll");
JarHelper.unpack_from_jar ("onnxruntime_x64.dll");
JarHelper.unpack_from_jar ("onnxruntime_x86.dll");
String arch = System.getProperty ("os.arch");
switch (arch) {
case "x86":
JarHelper.unpack_from_jar ("onnxruntime_x86.dll");
break;
case "x86_64":
case "amd64":
JarHelper.unpack_from_jar ("onnxruntime_x64.dll");
break;
case "arm":
JarHelper.unpack_from_jar ("onnxruntime_arm.dll");
break;
case "arm64":
JarHelper.unpack_from_jar ("onnxruntime_arm64.dll");
break;
default:
System.err.println("Unsupported Windows architecture: " + arch);
}
} else if (SystemUtils.IS_OS_MAC)
{
lib_name = "libMLModule.dylib";
Expand Down

0 comments on commit 8305c60

Please sign in to comment.