Fix finding onetbb lib on windows (#14018)

This commit is contained in:
Anastasia Kuporosova 2022-11-16 11:13:37 +01:00 committed by GitHub
parent 79d92b7d8d
commit 0f647e6b75
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
3 changed files with 29 additions and 11 deletions

View File

@ -86,6 +86,18 @@ function(ov_download_tbb)
set(IE_PATH_TO_DEPS "${THIRDPARTY_SERVER_PATH}") set(IE_PATH_TO_DEPS "${THIRDPARTY_SERVER_PATH}")
endif() endif()
if (NOT DEFINED ENV{TBBROOT} AND (DEFINED ENV{TBB_DIR} OR DEFINED TBB_DIR))
if (DEFINED ENV{TBB_DIR})
set(TEMP_ROOT $ENV{TBB_DIR})
elseif (DEFINED TBB_DIR)
set(TEMP_ROOT ${TBB_DIR})
endif()
while(NOT EXISTS "${TEMP_ROOT}/include")
get_filename_component(TEMP_ROOT ${TEMP_ROOT} PATH)
endwhile()
set(TBBROOT ${TEMP_ROOT})
endif()
if(WIN32 AND X86_64) if(WIN32 AND X86_64)
# TODO: add target_path to be platform specific as well, to avoid following if # TODO: add target_path to be platform specific as well, to avoid following if
RESOLVE_DEPENDENCY(TBB RESOLVE_DEPENDENCY(TBB

View File

@ -41,7 +41,12 @@ set "OPENVINO_LIB_PATHS=%INTEL_OPENVINO_DIR%\runtime\bin\intel64\Release;%INTEL_
:: TBB :: TBB
if exist %INTEL_OPENVINO_DIR%\runtime\3rdparty\tbb ( if exist %INTEL_OPENVINO_DIR%\runtime\3rdparty\tbb (
if exist %INTEL_OPENVINO_DIR%\runtime\3rdparty\tbb\redist (
set "OPENVINO_LIB_PATHS=%INTEL_OPENVINO_DIR%\runtime\3rdparty\tbb\redist\intel64\vc14;%OPENVINO_LIB_PATHS%"
) else if exist %INTEL_OPENVINO_DIR%\runtime\3rdparty\tbb\bin (
set "OPENVINO_LIB_PATHS=%INTEL_OPENVINO_DIR%\runtime\3rdparty\tbb\bin;%OPENVINO_LIB_PATHS%" set "OPENVINO_LIB_PATHS=%INTEL_OPENVINO_DIR%\runtime\3rdparty\tbb\bin;%OPENVINO_LIB_PATHS%"
)
if exist %INTEL_OPENVINO_DIR%\runtime\3rdparty\tbb\cmake ( if exist %INTEL_OPENVINO_DIR%\runtime\3rdparty\tbb\cmake (
set "TBB_DIR=%INTEL_OPENVINO_DIR%\runtime\3rdparty\tbb\cmake" set "TBB_DIR=%INTEL_OPENVINO_DIR%\runtime\3rdparty\tbb\cmake"
@ -49,6 +54,8 @@ if exist %INTEL_OPENVINO_DIR%\runtime\3rdparty\tbb (
set "TBB_DIR=%INTEL_OPENVINO_DIR%\runtime\3rdparty\tbb\lib\cmake\TBB" set "TBB_DIR=%INTEL_OPENVINO_DIR%\runtime\3rdparty\tbb\lib\cmake\TBB"
) else if exist %INTEL_OPENVINO_DIR%\runtime\3rdparty\tbb\lib64\cmake\TBB ( ) else if exist %INTEL_OPENVINO_DIR%\runtime\3rdparty\tbb\lib64\cmake\TBB (
set "TBB_DIR=%INTEL_OPENVINO_DIR%\runtime\3rdparty\tbb\lib64\cmake\TBB" set "TBB_DIR=%INTEL_OPENVINO_DIR%\runtime\3rdparty\tbb\lib64\cmake\TBB"
) else if exist %INTEL_OPENVINO_DIR%\runtime\3rdparty\tbb\lib\cmake\tbb (
set "TBB_DIR=%INTEL_OPENVINO_DIR%\runtime\3rdparty\tbb\lib\cmake\tbb"
) )
) )

View File

@ -17,12 +17,11 @@ function(_ov_detect_dynamic_tbbbind_2_5 var)
# try to select proper library directory # try to select proper library directory
_ov_get_tbb_location(TBB::tbb _tbb_lib_location) _ov_get_tbb_location(TBB::tbb _tbb_lib_location)
get_filename_component(_tbb_libs_dir "${_tbb_lib_location}" DIRECTORY) get_filename_component(_tbb_libs_dir "${_tbb_lib_location}" DIRECTORY)
# unset for cases if user specified different TBB_DIR / TBBROOT # unset for cases if user specified different TBB_DIR / TBBROOT
unset(_ov_tbbbind_2_5 CACHE) unset(_ov_tbbbind_2_5 CACHE)
find_library(_ov_tbbbind_2_5 find_file(_ov_tbbbind_2_5
NAMES tbbbind_2_5 NAMES "${CMAKE_SHARED_LIBRARY_PREFIX}tbbbind_2_5${CMAKE_SHARED_LIBRARY_SUFFIX}"
HINTS "${_tbb_libs_dir}" HINTS "${_tbb_libs_dir}"
"Path to TBBBind 2.5+ library" "Path to TBBBind 2.5+ library"
NO_DEFAULT_PATH NO_DEFAULT_PATH
@ -131,7 +130,7 @@ if(THREADING MATCHES "^(TBB|TBB_AUTO)$" AND
set(IE_TBBROOT_INSTALL "runtime/3rdparty/tbb") set(IE_TBBROOT_INSTALL "runtime/3rdparty/tbb")
# TBBROOT is not defined if ENV{TBBROOT} is not found # TBBROOT is not defined if ENV{TBBROOT} is not found
# so, we have to deduce this value outselves # so, we have to deduce this value ourselves
if(NOT DEFINED TBBROOT AND DEFINED ENV{TBBROOT}) if(NOT DEFINED TBBROOT AND DEFINED ENV{TBBROOT})
file(TO_CMAKE_PATH $ENV{TBBROOT} TBBROOT) file(TO_CMAKE_PATH $ENV{TBBROOT} TBBROOT)
endif() endif()
@ -162,9 +161,9 @@ if(THREADING MATCHES "^(TBB|TBB_AUTO)$" AND
file(RELATIVE_PATH tbb_libs_dir "${TBBROOT}" "${_tbb_libs_dir}") file(RELATIVE_PATH tbb_libs_dir "${TBBROOT}" "${_tbb_libs_dir}")
# install only meaningful directories # install only meaningful directories
foreach(dir include ${tbb_libs_dir} cmake lib/cmake lib/pkgconfig) foreach(dir include ${tbb_libs_dir} cmake lib/cmake lib/pkgconfig lib/intel64/vc14)
if(EXISTS "${TBBROOT}/${dir}") if(EXISTS "${TBBROOT}/${dir}")
if(dir STREQUAL "include" OR dir MATCHES ".*(cmake|pkgconfig)$") if(dir STREQUAL "include" OR dir MATCHES ".*(cmake|pkgconfig)$" OR dir STREQUAL "lib/intel64/vc14")
set(tbb_component tbb_dev) set(tbb_component tbb_dev)
set(core_dev_components tbb_dev) set(core_dev_components tbb_dev)
unset(exclude_pattern) unset(exclude_pattern)