Skip to content

Commit 7f25d4c

Browse files
committed
Fixes the java packaging on Windows.
1 parent f17e73e commit 7f25d4c

File tree

1 file changed

+13
-2
lines changed

1 file changed

+13
-2
lines changed

cmake/onnxruntime_java.cmake

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -100,7 +100,8 @@ if (CMAKE_SYSTEM_NAME STREQUAL "Android")
100100
file(MAKE_DIRECTORY ${ANDROID_PACKAGE_OUTPUT_DIR})
101101
endif()
102102

103-
# Set platform and ach for packaging
103+
# Set platform and arch for packaging
104+
# Checks the names set by MLAS on non-Windows platforms first
104105
if (CMAKE_SYSTEM_NAME STREQUAL "Android")
105106
set(JNI_ARCH ${ANDROID_ABI})
106107
elseif (ARM64)
@@ -110,7 +111,17 @@ elseif (X86_64)
110111
elseif (POWER)
111112
set(JNI_ARCH ppc64)
112113
else()
113-
message(FATAL_ERROR "Java is currently not supported for x86 architecture")
114+
# Now mirror the checks used with MSVC
115+
if(MSVC)
116+
if(onnxruntime_target_platform STREQUAL "ARM64")
117+
set(JNI_ARCH aarch64)
118+
elseif(onnxruntime_target_platform STREQUAL "x64")
119+
set(JNI_ARCH x64)
120+
endif()
121+
else()
122+
# if everything else failed then we're on a 32-bit arch and Java isn't supported
123+
message(FATAL_ERROR "Java is currently not supported on 32-bit x86 architecture")
124+
endif()
114125
endif()
115126

116127
if (WIN32)

0 commit comments

Comments
 (0)