Commit a2ea7224 authored by 4ast's avatar 4ast Committed by GitHub

Merge pull request #1455 from iovisor/yhs_dev

force linking the whole api-static library into shared library
parents 8cf1ff52 fbe1b321
......@@ -57,24 +57,30 @@ include(clang_libs)
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${clang_lib_exclude_flags}")
set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} ${llvm_lib_exclude_flags}")
set(bcc_common_libs b_frontend clang_frontend bpf-static
# bcc_common_libs_for_a for archive libraries
# bcc_common_libs_for_s for shared libraries
set(bcc_common_libs_for_a b_frontend clang_frontend bpf-static
${clang_libs} ${llvm_libs} ${LIBELF_LIBRARIES})
set(bcc_common_libs_for_s ${bcc_common_libs_for_a})
if(ENABLE_CPP_API)
add_subdirectory(api)
list(APPEND bcc_common_libs api-static)
list(APPEND bcc_common_libs_for_a api-static)
# Keep all API functions
list(APPEND bcc_common_libs_for_s -Wl,--whole-archive api-static -Wl,--no-whole-archive)
endif()
if(ENABLE_USDT)
add_subdirectory(usdt)
list(APPEND bcc_common_libs usdt-static)
list(APPEND bcc_common_libs_for_a usdt-static)
list(APPEND bcc_common_libs_for_s usdt-static)
endif()
add_subdirectory(frontends)
# Link against LLVM libraries
target_link_libraries(bcc-shared ${bcc_common_libs})
target_link_libraries(bcc-static ${bcc_common_libs} bcc-loader-static)
target_link_libraries(bcc-shared ${bcc_common_libs_for_s})
target_link_libraries(bcc-static ${bcc_common_libs_for_a} bcc-loader-static)
install(TARGETS bcc-shared LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR})
install(FILES ${bcc_table_headers} DESTINATION include/bcc)
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment