Skip to content

Commit cbd4cec

Browse files
committed
create onnx_proto from onnx_proto_object for xcode
1 parent f0d3ab9 commit cbd4cec

File tree

1 file changed

+11
-0
lines changed

1 file changed

+11
-0
lines changed

cmake/external/onnxruntime_external_deps.cmake

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -530,6 +530,17 @@ onnxruntime_fetchcontent_declare(
530530

531531
onnxruntime_fetchcontent_makeavailable(onnx)
532532

533+
# https://github.com/onnx/onnx/pull/7087 introduces onnx_object, which
534+
# creates a target onnx_proto_object. If onnx_proto target does not exist,
535+
# we alias onnx_proto_object to onnx_proto for backward compatibility.
536+
if (NOT TARGET onnx_proto AND TARGET onnx_proto_object)
537+
message(STATUS "Creating onnx_proto static library from onnx_proto_object")
538+
add_library(onnx_proto STATIC $<TARGET_OBJECTS:onnx_proto_object>)
539+
target_link_libraries(onnx_proto PUBLIC ${PROTOBUF_LIB})
540+
target_include_directories(onnx_proto PUBLIC $<TARGET_PROPERTY:onnx_proto_object,INTERFACE_INCLUDE_DIRECTORIES>)
541+
target_compile_definitions(onnx_proto PUBLIC $<TARGET_PROPERTY:onnx_proto_object,INTERFACE_COMPILE_DEFINITIONS>)
542+
endif()
543+
533544
if(TARGET ONNX::onnx AND NOT TARGET onnx)
534545
message(STATUS "Aliasing ONNX::onnx to onnx")
535546
add_library(onnx ALIAS ONNX::onnx)

0 commit comments

Comments
 (0)