Skip to content

Commit

Permalink
Bug fix
Browse files Browse the repository at this point in the history
  • Loading branch information
jim19930609 committed Sep 22, 2022
1 parent 2f95b64 commit c994296
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
1 change: 1 addition & 0 deletions c_api/export_symbols_mac.lds
Original file line number Diff line number Diff line change
@@ -1,2 +1,3 @@
# MacOS
_ti_*
__ZN4capi5utils*
7 changes: 4 additions & 3 deletions cmake/TaichiCAPI.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -33,12 +33,13 @@ target_link_libraries(${TAICHI_C_API_NAME} PRIVATE taichi_ui_vulkan)
target_link_libraries(${TAICHI_C_API_NAME} PRIVATE taichi_ui)
endif()

# Only export symbols declared under c_api/include/taichi/ for libtaichi_c_api.so
# Avoid exporting third party symbols from libtaichi_c_api.so
# Note that on Windows, the default behaviour is that external symbols will be excluded from .dll.
if(LINUX)
target_link_options(${TAICHI_C_API_NAME} PUBLIC -Wl,--exclude-libs,ALL)
target_link_options(${TAICHI_C_API_NAME} PRIVATE -Wl,--exclude-libs,ALL)
elseif(APPLE)
# Unfortunately, ld on MacOS does not support --exclude-libs and we have to manually specify the exported symbols
target_link_options(${TAICHI_C_API_NAME} PUBLIC -Wl,-exported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/c_api/export_symbols_mac.lds)
target_link_options(${TAICHI_C_API_NAME} PRIVATE -Wl,-exported_symbols_list,${CMAKE_CURRENT_SOURCE_DIR}/c_api/export_symbols_mac.lds)
endif()

set(C_API_OUTPUT_DIRECTORY "${CMAKE_CURRENT_SOURCE_DIR}/build")
Expand Down

0 comments on commit c994296

Please sign in to comment.