Skip to content

Commit 60e2c45

Browse files
committed
try to fix java build on mac
1 parent 16d0c15 commit 60e2c45

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

cmake/onnxruntime_java.cmake

+9
Original file line numberDiff line numberDiff line change
@@ -58,6 +58,15 @@ file(GLOB onnxruntime4j_native_src
5858
onnxruntime_add_shared_library_module(onnxruntime4j_jni ${onnxruntime4j_native_src})
5959
set_property(TARGET onnxruntime4j_jni PROPERTY C_STANDARD 11)
6060

61+
if (APPLE)
62+
set_target_properties(onnxruntime4j_jni PROPERTIES
63+
MACOSX_RPATH TRUE
64+
SKIP_BUILD_RPATH TRUE
65+
INSTALL_RPATH_USE_LINK_PATH FALSE
66+
BUILD_WITH_INSTALL_NAME_DIR TRUE
67+
INSTALL_NAME_DIR @rpath)
68+
endif()
69+
6170
# depend on java sources. if they change, the JNI should recompile
6271
add_dependencies(onnxruntime4j_jni onnxruntime4j)
6372
onnxruntime_add_include_to_target(onnxruntime4j_jni onnxruntime_session)

0 commit comments

Comments
 (0)