mirror of
https://github.com/opencv/opencv.git
synced 2024-11-27 12:40:05 +08:00
[opencv 3.x] back-ported tbb support ubuntu 22.04
This commit is contained in:
parent
dc37883702
commit
e625b32841
2
3rdparty/tbb/CMakeLists.txt
vendored
2
3rdparty/tbb/CMakeLists.txt
vendored
@ -170,4 +170,4 @@ ocv_install_target(tbb EXPORT OpenCVModules
|
||||
|
||||
ocv_install_3rdparty_licenses(tbb "${tbb_src_dir}/LICENSE" "${tbb_src_dir}/README")
|
||||
|
||||
ocv_tbb_read_version("${tbb_src_dir}/include")
|
||||
ocv_tbb_read_version("${tbb_src_dir}/include" tbb)
|
||||
|
@ -19,7 +19,7 @@
|
||||
# - "tbb" target exists and added to OPENCV_LINKER_LIBS
|
||||
|
||||
function(ocv_tbb_cmake_guess _found)
|
||||
find_package(TBB QUIET COMPONENTS tbb PATHS "$ENV{TBBROOT}/cmake")
|
||||
find_package(TBB QUIET COMPONENTS tbb PATHS "$ENV{TBBROOT}/cmake" "$ENV{TBBROOT}/lib/cmake/tbb")
|
||||
if(TBB_FOUND)
|
||||
if(NOT TARGET TBB::tbb)
|
||||
message(WARNING "No TBB::tbb target found!")
|
||||
@ -28,11 +28,11 @@ function(ocv_tbb_cmake_guess _found)
|
||||
get_target_property(_lib TBB::tbb IMPORTED_LOCATION_RELEASE)
|
||||
message(STATUS "Found TBB (cmake): ${_lib}")
|
||||
get_target_property(_inc TBB::tbb INTERFACE_INCLUDE_DIRECTORIES)
|
||||
ocv_tbb_read_version("${_inc}")
|
||||
add_library(tbb INTERFACE IMPORTED)
|
||||
set_target_properties(tbb PROPERTIES
|
||||
INTERFACE_LINK_LIBRARIES TBB::tbb
|
||||
)
|
||||
ocv_tbb_read_version("${_inc}" tbb)
|
||||
set(${_found} TRUE PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
@ -66,7 +66,6 @@ function(ocv_tbb_env_guess _found)
|
||||
find_library(TBB_ENV_LIB_DEBUG NAMES "tbb_debug")
|
||||
if (TBB_ENV_INCLUDE AND (TBB_ENV_LIB OR TBB_ENV_LIB_DEBUG))
|
||||
ocv_tbb_env_verify()
|
||||
ocv_tbb_read_version("${TBB_ENV_INCLUDE}")
|
||||
add_library(tbb UNKNOWN IMPORTED)
|
||||
set_target_properties(tbb PROPERTIES
|
||||
IMPORTED_LOCATION "${TBB_ENV_LIB}"
|
||||
@ -82,12 +81,14 @@ function(ocv_tbb_env_guess _found)
|
||||
get_filename_component(_dir "${TBB_ENV_LIB}" DIRECTORY)
|
||||
set_target_properties(tbb PROPERTIES INTERFACE_LINK_LIBRARIES "-L${_dir}")
|
||||
endif()
|
||||
ocv_tbb_read_version("${TBB_ENV_INCLUDE}" tbb)
|
||||
message(STATUS "Found TBB (env): ${TBB_ENV_LIB}")
|
||||
set(${_found} TRUE PARENT_SCOPE)
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
function(ocv_tbb_read_version _path)
|
||||
function(ocv_tbb_read_version _path _tgt)
|
||||
find_file(TBB_VER_FILE oneapi/tbb/version.h "${_path}" NO_DEFAULT_PATH CMAKE_FIND_ROOT_PATH_BOTH)
|
||||
find_file(TBB_VER_FILE tbb/tbb_stddef.h "${_path}" NO_DEFAULT_PATH CMAKE_FIND_ROOT_PATH_BOTH)
|
||||
ocv_parse_header("${TBB_VER_FILE}" TBB_VERSION_LINES TBB_VERSION_MAJOR TBB_VERSION_MINOR TBB_INTERFACE_VERSION CACHE)
|
||||
endfunction()
|
||||
|
@ -118,16 +118,10 @@ if(MKL_USE_SINGLE_DYNAMIC_LIBRARY AND NOT (MKL_VERSION_STR VERSION_LESS "10.3.0"
|
||||
|
||||
elseif(NOT (MKL_VERSION_STR VERSION_LESS "11.3.0"))
|
||||
|
||||
foreach(MKL_ARCH ${MKL_ARCH_LIST})
|
||||
list(APPEND mkl_lib_find_paths
|
||||
${MKL_ROOT_DIR}/../tbb/lib/${MKL_ARCH}
|
||||
)
|
||||
endforeach()
|
||||
|
||||
set(mkl_lib_list "mkl_intel_${MKL_ARCH_SUFFIX}")
|
||||
|
||||
if(MKL_WITH_TBB)
|
||||
list(APPEND mkl_lib_list mkl_tbb_thread tbb)
|
||||
list(APPEND mkl_lib_list mkl_tbb_thread)
|
||||
elseif(MKL_WITH_OPENMP)
|
||||
if(MSVC)
|
||||
list(APPEND mkl_lib_list mkl_intel_thread libiomp5md)
|
||||
@ -155,6 +149,7 @@ if(NOT MKL_LIBRARIES)
|
||||
endif()
|
||||
list(APPEND MKL_LIBRARIES ${${lib_var_name}})
|
||||
endforeach()
|
||||
list(APPEND MKL_LIBRARIES ${OPENCV_EXTRA_MKL_LIBRARIES})
|
||||
endif()
|
||||
|
||||
message(STATUS "Found MKL ${MKL_VERSION_STR} at: ${MKL_ROOT_DIR}")
|
||||
|
@ -101,7 +101,6 @@
|
||||
#endif
|
||||
#include "tbb/tbb.h"
|
||||
#include "tbb/task.h"
|
||||
#include "tbb/tbb_stddef.h"
|
||||
#if TBB_INTERFACE_VERSION >= 8000
|
||||
#include "tbb/task_arena.h"
|
||||
#endif
|
||||
|
Loading…
Reference in New Issue
Block a user