Unverified Commit 676f8d36 authored by Scott Cyphers's avatar Scott Cyphers Committed by GitHub

Use pre-built tbb on macos (#2371)

* Use pre-built tbb on macos

* Review comments

* Only copy lib when changed
parent eecf585c
...@@ -336,7 +336,7 @@ else() ...@@ -336,7 +336,7 @@ else()
include(cmake/external_llvm.cmake) include(cmake/external_llvm.cmake)
endif() endif()
if (WIN32) if (WIN32 OR APPLE)
include(cmake/external_tbb_prebuilt.cmake) include(cmake/external_tbb_prebuilt.cmake)
else() else()
include(cmake/external_tbb.cmake) include(cmake/external_tbb.cmake)
......
...@@ -16,10 +16,13 @@ ...@@ -16,10 +16,13 @@
include(ExternalProject) include(ExternalProject)
set(ARCHIVE_FILE_BASE tbb2019_20181203oss)
if (WIN32) if (WIN32)
set(ARCHIVE_FILE_BASE tbb2019_20181203oss)
set(TBB_FILE https://github.com/01org/tbb/releases/download/2019_U3/${ARCHIVE_FILE_BASE}_win.zip) set(TBB_FILE https://github.com/01org/tbb/releases/download/2019_U3/${ARCHIVE_FILE_BASE}_win.zip)
set(TBB_SHA1_HASH 1989458a49e780d76248edac13b963f80c9a460c) set(TBB_SHA1_HASH 1989458a49e780d76248edac13b963f80c9a460c)
elseif(APPLE)
set(TBB_FILE https://github.com/01org/tbb/releases/download/2019_U3/${ARCHIVE_FILE_BASE}_mac.tgz)
set(TBB_SHA1_HASH 36926fb46add578b88a5c7e19652b94bb612e4be)
endif() endif()
ExternalProject_Add( ExternalProject_Add(
...@@ -37,11 +40,26 @@ ExternalProject_Add( ...@@ -37,11 +40,26 @@ ExternalProject_Add(
ExternalProject_Get_Property(ext_tbb SOURCE_DIR) ExternalProject_Get_Property(ext_tbb SOURCE_DIR)
set(SOURCE_DIR ${SOURCE_DIR}/${ARCHIVE_FILE_BASE}) set(SOURCE_DIR ${SOURCE_DIR}/${ARCHIVE_FILE_BASE})
set(TBB_LINK_LIBS if (WIN32)
${SOURCE_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}clangTooling${CMAKE_SHARED_LIBRARY_SUFFIX} set(TBB_LINK_LIBS
${SOURCE_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}clangTooling${CMAKE_SHARED_LIBRARY_SUFFIX} ${SOURCE_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}clangTooling${CMAKE_SHARED_LIBRARY_SUFFIX}
${SOURCE_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}clangTooling${CMAKE_SHARED_LIBRARY_SUFFIX} )
) elseif(APPLE)
if(CMAKE_BUILD_TYPE STREQUAL "Debug")
set(TBB_LIB_NAME tbb_debug)
else()
set(TBB_LIB_NAME tbb)
endif()
set(TBB_LINK_LIBS
${NGRAPH_BUILD_DIR}/${CMAKE_SHARED_LIBRARY_PREFIX}${TBB_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX}
)
add_custom_command(TARGET ext_tbb POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different ${SOURCE_DIR}/lib/${CMAKE_SHARED_LIBRARY_PREFIX}${TBB_LIB_NAME}${CMAKE_SHARED_LIBRARY_SUFFIX} ${NGRAPH_BUILD_DIR}
COMMENT "Move tbb libraries to ngraph build directory"
)
endif()
add_library(libtbb INTERFACE) add_library(libtbb INTERFACE)
add_dependencies(libtbb ext_tbb) add_dependencies(libtbb ext_tbb)
......
...@@ -133,7 +133,7 @@ if (NGRAPH_HALIDE) ...@@ -133,7 +133,7 @@ if (NGRAPH_HALIDE)
) )
endif() endif()
if (NGRAPH_TBB_ENABLE AND NOT WIN32) if (NGRAPH_TBB_ENABLE AND NOT (WIN32 OR APPLE))
include(${TBB_ROOT}/cmake/TBBBuild.cmake) include(${TBB_ROOT}/cmake/TBBBuild.cmake)
tbb_build(TBB_ROOT ${TBB_ROOT} MAKE_ARGS tbb_build_dir=${CMAKE_CURRENT_BINARY_DIR}/tbb_build tbb_build(TBB_ROOT ${TBB_ROOT} MAKE_ARGS tbb_build_dir=${CMAKE_CURRENT_BINARY_DIR}/tbb_build
tbb_build_prefix=tbb CONFIG_DIR TBB_DIR) tbb_build_prefix=tbb CONFIG_DIR TBB_DIR)
......
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