Skip to content

Commit

Permalink
Set symbol visibility to hidden for non-Windows (onnx#1707)
Browse files Browse the repository at this point in the history
  • Loading branch information
pjh5 authored and houseroad committed Dec 26, 2018
1 parent 96d1039 commit 89051f8
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion CMakeLists.txt
Expand Up @@ -300,7 +300,10 @@ if (MSVC)
set(ONNX_API_DEFINE "-DONNX_API=")
endif()
else()
set(ONNX_API_DEFINE "-DONNX_API=")
# On non-Windows, hide all symbols we don't need
set(ONNX_API_DEFINE "-DONNX_API=__attribute__\(\(__visibility__\(\"default\"\)\)\)")
set_target_properties(onnx_proto PROPERTIES CXX_VISIBILITY_PRESET hidden)
set_target_properties(onnx_proto PROPERTIES VISIBILITY_INLINES_HIDDEN 1)
endif()
target_compile_definitions(onnx_proto PRIVATE ${ONNX_API_DEFINE})

Expand Down

0 comments on commit 89051f8

Please sign in to comment.