You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@tvm.apache.org by tq...@apache.org on 2026/10/15 05:43:06 UTC
(tvm) 04/05: [FIX][CMake] Keep private visibility on owned library targets
This is an automated email from the ASF dual-hosted git repository.
tqchen pushed a commit to branch tirx/standalone-package-cleanup
in repository https://gitbox.apache.org/repos/asf/tvm.git
commit 81623680431a934122a614306348da6991990ca6
Author: Tianqi Chen <tq...@users.noreply.github.com>
AuthorDate: Thu Oct 15 05:26:24 2026 +0000
[FIX][CMake] Keep private visibility on owned library targets
---
CMakeLists.txt | 9 ++++++---
1 file changed, 6 insertions(+), 3 deletions(-)
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 3e40018bb0..4bd18b92a0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -129,9 +129,6 @@ if(MSVC)
endif()
else()
add_compile_options(-Wall)
- if(HIDE_PRIVATE_SYMBOLS)
- add_compile_options(-fvisibility=hidden)
- endif()
if(APPLE)
set(TVM_NO_UNDEFINED_SYMBOLS "-Wl,-undefined,error")
else()
@@ -178,6 +175,9 @@ add_library(tvm_runtime_extra_defs INTERFACE)
target_link_libraries(tvm_runtime_extra_defs INTERFACE
tvm_tirx::tvm_runtime tvm_tirx::private_headers tvm_ffi::header)
target_compile_definitions(tvm_runtime_extra_defs INTERFACE TVM_RUNTIME_EXTRA_EXPORTS TVM_FFI_EXPORTS)
+if(HIDE_PRIVATE_SYMBOLS AND NOT MSVC)
+ target_compile_options(tvm_runtime_extra_defs INTERFACE -fvisibility=hidden)
+endif()
target_link_libraries(tvm_runtime_extra PRIVATE tvm_runtime_extra_defs)
tvm_file_glob(GLOB _vm_sources src/runtime/vm/*.cc src/runtime/rpc/minrpc/*.cc)
target_sources(tvm_runtime_extra PRIVATE ${_vm_sources})
@@ -234,6 +234,9 @@ endif()
include(cmake/modules/RuntimeExtra.cmake)
target_link_libraries(tvm_runtime_extra PRIVATE ${TVM_RUNTIME_LINKER_LIBS} ${CMAKE_DL_LIBS})
add_library(tvm_compiler SHARED ${COMPILER_SRCS})
+if(HIDE_PRIVATE_SYMBOLS AND NOT MSVC)
+ target_compile_options(tvm_compiler PRIVATE -fvisibility=hidden)
+endif()
target_compile_definitions(tvm_compiler PRIVATE TVM_EXPORTS TVM_FFI_EXPORTS)
target_link_libraries(tvm_compiler PUBLIC tvm_tirx::tvm_tirx tvm_runtime_extra)
target_link_libraries(tvm_compiler PRIVATE tvm_tirx::private_headers ${TVM_LINKER_LIBS})