Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 17 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -713,7 +713,23 @@ if(GTEST_FOUND)
# include runtime files for unit testing
target_link_libraries(cpptest PRIVATE ${TVM_TEST_LIBRARY_NAME} GTest::GTest GTest::Main GTest::gmock pthread dl)
if(DEFINED LLVM_LIBS)
target_link_libraries(cpptest PRIVATE ${LLVM_LIBS})
# The TVM library is linked with LLVM libraries. If the LLVM libraries are
# static and the symbols are not hidden, then don't link them again into
# cpptest since cpptest is itself linked against the TVM library. If static
# LLVM libraries are linked in twice, it can cause issues with global
# variable initialization (cl::opt).
# If the LLVM libraries are dynamic, we have to link them again, since the
# TVM library will not contain any LLVM definitions.
unset(LLVM_SO)
foreach(L IN LISTS LLVM_LIBS)
if(L MATCHES "libLLVM.*\.so")
set(LLVM_SO TRUE)
break()
endif()
endforeach()
if(DEFINED LLVM_SO OR HIDE_PRIVATE_SYMBOLS)
target_link_libraries(cpptest PRIVATE ${LLVM_LIBS})
endif()
endif()
if(DEFINED ETHOSN_RUNTIME_LIBRARY)
target_link_libraries(cpptest PRIVATE ${ETHOSN_RUNTIME_LIBRARY})
Expand Down