Support of oneTBB via env TBBROOT (#8327)

This commit is contained in:
Ilya Lavrenov 2021-11-01 13:43:48 +03:00 committed by GitHub
parent 3251e0cbc3
commit b82cc125fa
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 15 additions and 1 deletions

View File

@ -148,7 +148,12 @@ if(THREADING STREQUAL "TBB" OR THREADING STREQUAL "TBB_AUTO")
endif()
update_deps_cache(TBBROOT "${TBB}" "Path to TBB root folder")
update_deps_cache(TBB_DIR "${TBB}/cmake" "Path to TBB cmake folder")
if(EXISTS "${TBBROOT}/lib/cmake/TBB/TBBConfig.cmake")
# oneTBB case
update_deps_cache(TBB_DIR "${TBB}/lib/cmake/TBB" "Path to TBB cmake folder")
else()
update_deps_cache(TBB_DIR "${TBB}/cmake" "Path to TBB cmake folder")
endif()
update_deps_cache(TBBBIND_2_5_DIR "${TBBBIND_2_5}/cmake" "Path to TBBBIND_2_5 cmake folder")
debug_message(STATUS "tbb=" ${TBB})

View File

@ -26,6 +26,7 @@ endif()
find_package(TBB
CONFIG
PATHS ${TBBROOT}/cmake
${TBBROOT}/lib/cmake/TBB # oneTBB case
${IEDevScripts_DIR}/${IE_OWN_TBB_CONFIG}
NO_CMAKE_FIND_ROOT_PATH
NO_DEFAULT_PATH

View File

@ -25,6 +25,14 @@ function(set_ie_threading_interface_for TARGET_NAME)
else()
find_dependency(TBB COMPONENTS tbb tbbmalloc)
endif()
# oneTBB does not define TBB_IMPORTED_TARGETS
if(TBB_FOUND AND NOT TBB_IMPORTED_TARGETS)
foreach(target TBB::tbb TBB::tbbmalloc)
if(TARGET ${target})
list(APPEND TBB_IMPORTED_TARGETS ${target})
endif()
endforeach()
endif()
set(TBB_FOUND ${TBB_FOUND} PARENT_SCOPE)
set(TBB_IMPORTED_TARGETS ${TBB_IMPORTED_TARGETS} PARENT_SCOPE)
set(TBB_VERSION ${TBB_VERSION} PARENT_SCOPE)