Fix build on Mac OS (#2731)

mac os ld doesn't support --while-archive, correct option is -all_load
This commit is contained in:
Andrey 2019-12-26 12:10:39 +08:00 committed by Changming Sun
parent f142b683a1
commit 9013fe6340

View file

@ -92,7 +92,11 @@ add_custom_command(
add_library(server_grpc_proto ${grpc_srcs})
target_include_directories(server_grpc_proto PUBLIC $<TARGET_PROPERTY:protobuf::libprotobuf,INTERFACE_INCLUDE_DIRECTORIES> "${CMAKE_CURRENT_BINARY_DIR}" ${CMAKE_CURRENT_BINARY_DIR}/onnx PRIVATE)
set(grpc_reflection -Wl,--whole-archive grpc++_reflection -Wl,--no-whole-archive)
if(APPLE)
set(grpc_reflection -Wl,-all_load grpc++_reflection -Wl,-noall_load)
else()
set(grpc_reflection -Wl,--whole-archive grpc++_reflection -Wl,--no-whole-archive)
endif()
set(grpc_static_libs grpc++ grpcpp_channelz)
target_link_libraries(server_grpc_proto ${grpc_static_libs})
add_dependencies(server_grpc_proto server_proto)