Commit 2b7e74e5 authored by Sang Ik Lee's avatar Sang Ik Lee Committed by Robert Kimball

CMake: Read tbb library version on Linux. (#2471)

parent ede9720c
......@@ -50,13 +50,28 @@ if(NGRAPH_TBB_ENABLE)
set(TBB_LIB_NAME tbb)
set(TBB_BUILDDIR_NAME tbb_release)
endif()
install(DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/tbb_build/${TBB_BUILDDIR_NAME}/
DESTINATION ${NGRAPH_INSTALL_LIB}
FILES_MATCHING REGEX "/${CMAKE_SHARED_LIBRARY_PREFIX}${TBB_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}(\\.[0-9]+)*$"
)
set(TBB_BUILD_DIR ${CMAKE_CURRENT_BINARY_DIR}/tbb_build/${TBB_BUILDDIR_NAME})
set(TBB_LIB ${CMAKE_SHARED_LIBRARY_PREFIX}${TBB_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX})
file(COPY
${TBB_BUILD_DIR}/${TBB_LIB}
DESTINATION ${NGRAPH_BUILD_DIR})
if(LINUX)
execute_process(COMMAND grep TBB_COMPATIBLE_INTERFACE_VERSION ${TBB_ROOT}/include/tbb/tbb_stddef.h OUTPUT_VARIABLE TBB_SOVER_LINE)
string(REGEX MATCH "[0-9.]+" TBB_SOVER ${TBB_SOVER_LINE})
message(STATUS "TBB so version: ${TBB_SOVER}")
file(COPY
${TBB_BUILD_DIR}/${TBB_LIB}.${TBB_SOVER}
DESTINATION ${NGRAPH_BUILD_DIR})
endif()
install(FILES ${NGRAPH_BUILD_DIR}/${TBB_LIB}
DESTINATION ${NGRAPH_INSTALL_LIB})
if(LINUX)
install(FILES ${NGRAPH_BUILD_DIR}/${TBB_LIB}.${TBB_SOVER}
DESTINATION ${NGRAPH_INSTALL_LIB})
endif()
add_library(libtbb INTERFACE)
target_link_libraries(libtbb INTERFACE
${CMAKE_CURRENT_BINARY_DIR}/tbb_build/${TBB_BUILDDIR_NAME}/${CMAKE_SHARED_LIBRARY_PREFIX}${TBB_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}
${NGRAPH_BUILD_DIR}/${TBB_LIB}
)
target_include_directories(libtbb SYSTEM INTERFACE ${TBB_ROOT}/include)
endif()
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