mirror of
https://github.com/opencv/opencv.git
synced 2025-06-07 17:44:04 +08:00
Updated TBB search script and code checks
This commit is contained in:
parent
46a333ed94
commit
695c518384
30
3rdparty/tbb/CMakeLists.txt
vendored
30
3rdparty/tbb/CMakeLists.txt
vendored
@ -70,20 +70,6 @@ ocv_warnings_disable(CMAKE_CXX_FLAGS -Wshadow)
|
|||||||
#set(tbb_md5 "4669e7d4adee018de7a7b8b972987218")
|
#set(tbb_md5 "4669e7d4adee018de7a7b8b972987218")
|
||||||
#set(tbb_version_file "version_string.tmp")
|
#set(tbb_version_file "version_string.tmp")
|
||||||
|
|
||||||
# 4.0 update 2 - works fine
|
|
||||||
#set(tbb_ver "tbb40_20111130oss")
|
|
||||||
#set(tbb_url "http://threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb40_20111130oss_src.tgz")
|
|
||||||
#set(tbb_md5 "1e6926b21e865e79772119cd44fc3ad8")
|
|
||||||
#set(tbb_version_file "version_string.tmp")
|
|
||||||
#set(tbb_need_GENERIC_DWORD_LOAD_STORE TRUE)
|
|
||||||
|
|
||||||
# 4.0 update 1 - works fine
|
|
||||||
#set(tbb_ver "tbb40_20111003oss")
|
|
||||||
#set(tbb_url "http://threadingbuildingblocks.org/sites/default/files/software_releases/source/tbb40_20111003oss_src.tgz")
|
|
||||||
#set(tbb_md5 "7b5d94eb35a563b29ef402e0fd8f15c9")
|
|
||||||
#set(tbb_version_file "version_string.tmp")
|
|
||||||
#set(tbb_need_GENERIC_DWORD_LOAD_STORE TRUE)
|
|
||||||
|
|
||||||
set(tbb_tarball "${CMAKE_CURRENT_SOURCE_DIR}/${tbb_ver}_src.tgz")
|
set(tbb_tarball "${CMAKE_CURRENT_SOURCE_DIR}/${tbb_ver}_src.tgz")
|
||||||
set(tbb_src_dir "${CMAKE_CURRENT_BINARY_DIR}/${tbb_ver}")
|
set(tbb_src_dir "${CMAKE_CURRENT_BINARY_DIR}/${tbb_ver}")
|
||||||
|
|
||||||
@ -127,8 +113,6 @@ if(NOT EXISTS "${tbb_src_dir}")
|
|||||||
endif()
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
set(TBB_INCLUDE_DIRS "${tbb_src_dir}/include" PARENT_SCOPE)
|
|
||||||
|
|
||||||
ocv_include_directories("${tbb_src_dir}/include"
|
ocv_include_directories("${tbb_src_dir}/include"
|
||||||
"${tbb_src_dir}/src/"
|
"${tbb_src_dir}/src/"
|
||||||
"${tbb_src_dir}/src/rml/include"
|
"${tbb_src_dir}/src/rml/include"
|
||||||
@ -173,6 +157,9 @@ endif()
|
|||||||
|
|
||||||
if (CMAKE_COMPILER_IS_GNUCXX)
|
if (CMAKE_COMPILER_IS_GNUCXX)
|
||||||
add_definitions(-DTBB_USE_GCC_BUILTINS=1) #required for ARM GCC
|
add_definitions(-DTBB_USE_GCC_BUILTINS=1) #required for ARM GCC
|
||||||
|
if (NOT CMAKE_OPENCV_GCC_VERSION_NUM LESS 600)
|
||||||
|
set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} -flifetime-dse=1") # workaround for GCC 6.x
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(ANDROID_COMPILER_IS_CLANG)
|
if(ANDROID_COMPILER_IS_CLANG)
|
||||||
@ -180,12 +167,6 @@ if(ANDROID_COMPILER_IS_CLANG)
|
|||||||
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wmissing-prototypes)
|
ocv_warnings_disable(CMAKE_CXX_FLAGS -Wmissing-prototypes)
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(tbb_need_GENERIC_DWORD_LOAD_STORE)
|
|
||||||
#needed by TBB 4.0 update 1,2; fixed in TBB 4.0 update 3 but it has 2 new problems
|
|
||||||
add_definitions(-D__TBB_USE_GENERIC_DWORD_LOAD_STORE=1)
|
|
||||||
set(tbb_need_GENERIC_DWORD_LOAD_STORE ON PARENT_SCOPE)
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(TBB_SOURCE_FILES ${lib_srcs} ${lib_hdrs})
|
set(TBB_SOURCE_FILES ${lib_srcs} ${lib_hdrs})
|
||||||
|
|
||||||
if (ARM AND NOT WIN32)
|
if (ARM AND NOT WIN32)
|
||||||
@ -199,6 +180,8 @@ endif()
|
|||||||
set(TBB_SOURCE_FILES ${TBB_SOURCE_FILES} "${CMAKE_CURRENT_SOURCE_DIR}/${tbb_version_file}")
|
set(TBB_SOURCE_FILES ${TBB_SOURCE_FILES} "${CMAKE_CURRENT_SOURCE_DIR}/${tbb_version_file}")
|
||||||
|
|
||||||
add_library(tbb ${TBB_SOURCE_FILES})
|
add_library(tbb ${TBB_SOURCE_FILES})
|
||||||
|
target_compile_definitions(tbb PRIVATE TBB_USE_GCC_BUILTINS=1 __TBB_GCC_BUILTIN_ATOMICS_PRESENT=1)
|
||||||
|
target_include_directories(tbb SYSTEM PUBLIC $<BUILD_INTERFACE:${tbb_src_dir}/include>)
|
||||||
|
|
||||||
if (WIN32)
|
if (WIN32)
|
||||||
if (ARM)
|
if (ARM)
|
||||||
@ -251,5 +234,4 @@ ocv_install_target(tbb EXPORT OpenCVModules
|
|||||||
ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev
|
ARCHIVE DESTINATION ${OPENCV_3P_LIB_INSTALL_PATH} COMPONENT dev
|
||||||
)
|
)
|
||||||
|
|
||||||
# get TBB version
|
ocv_tbb_read_version("${tbb_src_dir}/include")
|
||||||
ocv_parse_header("${tbb_src_dir}/include/tbb/tbb_stddef.h" TBB_VERSION_LINES TBB_VERSION_MAJOR TBB_VERSION_MINOR TBB_INTERFACE_VERSION CACHE)
|
|
||||||
|
@ -33,16 +33,12 @@ using cv::ParallelLoopBody;
|
|||||||
#include "cxmisc.h"
|
#include "cxmisc.h"
|
||||||
|
|
||||||
#include "cvconfig.h"
|
#include "cvconfig.h"
|
||||||
|
|
||||||
#ifdef HAVE_TBB
|
#ifdef HAVE_TBB
|
||||||
# include "tbb/tbb_stddef.h"
|
# include "tbb/tbb.h"
|
||||||
# if TBB_VERSION_MAJOR*100 + TBB_VERSION_MINOR >= 202
|
# include "tbb/task.h"
|
||||||
# include "tbb/tbb.h"
|
# undef min
|
||||||
# include "tbb/task.h"
|
# undef max
|
||||||
# undef min
|
|
||||||
# undef max
|
|
||||||
# else
|
|
||||||
# undef HAVE_TBB
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_TBB
|
#ifdef HAVE_TBB
|
||||||
|
@ -1,94 +1,85 @@
|
|||||||
|
# Search TBB library (4.1 - 4.4, 2017)
|
||||||
|
#
|
||||||
|
# Own TBB (3rdparty/tbb):
|
||||||
|
# - set cmake option BUILD_TBB to ON
|
||||||
|
#
|
||||||
|
# External TBB (from system):
|
||||||
|
# - Fedora: install 'tbb-devel' package
|
||||||
|
# - Ubuntu: install 'libtbb-dev' package
|
||||||
|
#
|
||||||
|
# External TBB (from official site):
|
||||||
|
# - Linux/OSX:
|
||||||
|
# - in tbbvars.sh replace 'SUBSTITUTE_INSTALL_DIR_HERE' with absolute path to TBB dir
|
||||||
|
# - in terminal run 'source tbbvars.sh intel64 linux' ('source tbbvars.sh' in OSX)
|
||||||
|
# - Windows:
|
||||||
|
# - in terminal run 'tbbvars.bat intel64 vs2015'
|
||||||
|
#
|
||||||
|
# Return:
|
||||||
|
# - HAVE_TBB set to TRUE
|
||||||
|
# - "tbb" target exists and added to OPENCV_LINKER_LIBS
|
||||||
|
|
||||||
|
function(ocv_tbb_verify)
|
||||||
|
if (NOT "$ENV{TBBROOT}" STREQUAL "")
|
||||||
|
# check that library and include dir are inside TBBROOT location
|
||||||
|
get_filename_component(_root "$ENV{TBBROOT}" ABSOLUTE)
|
||||||
|
get_filename_component(_lib "${TBB_ENV_LIB}" ABSOLUTE)
|
||||||
|
get_filename_component(_inc "${TBB_ENV_INCLUDE}" ABSOLUTE)
|
||||||
|
string(FIND "${_lib}" "${_root}" _lib_pos)
|
||||||
|
string(FIND "${_inc}" "${_root}" _inc_pos)
|
||||||
|
if (NOT (_lib_pos EQUAL 0 AND _inc_pos EQUAL 0))
|
||||||
|
message(SEND_ERROR
|
||||||
|
"Possible issue with TBB detection - TBBROOT is set, "
|
||||||
|
"but library/include path is not inside it:\n "
|
||||||
|
"TBBROOT: $ENV{TBBROOT}\n "
|
||||||
|
"(absolute): ${_root}\n "
|
||||||
|
"INCLUDE: ${_inc}\n "
|
||||||
|
"LIBRARY: ${_lib}\n")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
function(ocv_tbb_env_guess _found)
|
||||||
|
find_path(TBB_ENV_INCLUDE NAMES "tbb/tbb.h" PATHS ENV CPATH NO_DEFAULT_PATH)
|
||||||
|
find_path(TBB_ENV_INCLUDE NAMES "tbb/tbb.h")
|
||||||
|
find_library(TBB_ENV_LIB NAMES "tbb" PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH NO_DEFAULT_PATH)
|
||||||
|
find_library(TBB_ENV_LIB NAMES "tbb")
|
||||||
|
find_library(TBB_ENV_LIB_DEBUG NAMES "tbb_debug" PATHS ENV LIBRARY_PATH ENV LD_LIBRARY_PATH NO_DEFAULT_PATH)
|
||||||
|
find_library(TBB_ENV_LIB_DEBUG NAMES "tbb_debug")
|
||||||
|
if (TBB_ENV_INCLUDE AND TBB_ENV_LIB)
|
||||||
|
ocv_tbb_verify()
|
||||||
|
ocv_tbb_read_version("${TBB_ENV_INCLUDE}")
|
||||||
|
add_library(tbb UNKNOWN IMPORTED)
|
||||||
|
set_target_properties(tbb PROPERTIES
|
||||||
|
IMPORTED_LOCATION "${TBB_ENV_LIB}"
|
||||||
|
IMPORTED_LOCATION_DEBUG "${TBB_ENV_LIB_DEBUG}"
|
||||||
|
INTERFACE_INCLUDE_DIRECTORIES "${TBB_ENV_INCLUDE}"
|
||||||
|
)
|
||||||
|
message(STATUS "Found TBB: ${TBB_ENV_LIB}")
|
||||||
|
set(${_found} TRUE PARENT_SCOPE)
|
||||||
|
endif()
|
||||||
|
endfunction()
|
||||||
|
|
||||||
|
function(ocv_tbb_read_version _path)
|
||||||
|
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()
|
||||||
|
|
||||||
|
#=====================================================================
|
||||||
|
|
||||||
if(BUILD_TBB)
|
if(BUILD_TBB)
|
||||||
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/tbb")
|
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/tbb")
|
||||||
include_directories(SYSTEM ${TBB_INCLUDE_DIRS})
|
message(STATUS "Found TBB: build")
|
||||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} tbb)
|
set(HAVE_TBB TRUE)
|
||||||
add_definitions(-DTBB_USE_GCC_BUILTINS=1 -D__TBB_GCC_BUILTIN_ATOMICS_PRESENT=1)
|
|
||||||
if(tbb_need_GENERIC_DWORD_LOAD_STORE)
|
|
||||||
add_definitions(-D__TBB_USE_GENERIC_DWORD_LOAD_STORE=1)
|
|
||||||
endif()
|
|
||||||
set(HAVE_TBB 1)
|
|
||||||
elseif(UNIX AND NOT APPLE)
|
|
||||||
PKG_CHECK_MODULES(TBB tbb)
|
|
||||||
|
|
||||||
if(TBB_FOUND)
|
|
||||||
set(HAVE_TBB 1)
|
|
||||||
if(NOT ${TBB_INCLUDE_DIRS} STREQUAL "")
|
|
||||||
ocv_include_directories(${TBB_INCLUDE_DIRS})
|
|
||||||
endif()
|
|
||||||
link_directories(${TBB_LIBRARY_DIRS})
|
|
||||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${TBB_LIBRARIES})
|
|
||||||
endif()
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
if(NOT HAVE_TBB)
|
if(NOT HAVE_TBB)
|
||||||
set(TBB_DEFAULT_INCLUDE_DIRS
|
ocv_tbb_env_guess(HAVE_TBB)
|
||||||
"/opt/intel/tbb/include" "/usr/local/include" "/usr/include"
|
endif()
|
||||||
"C:/Program Files/Intel/TBB" "C:/Program Files (x86)/Intel/TBB"
|
|
||||||
"C:/Program Files/tbb/include"
|
|
||||||
"C:/Program Files (x86)/tbb/include"
|
|
||||||
"${CMAKE_INSTALL_PREFIX}/include")
|
|
||||||
|
|
||||||
find_path(TBB_INCLUDE_DIRS "tbb/tbb.h" PATHS ${TBB_INCLUDE_DIR} ${TBB_DEFAULT_INCLUDE_DIRS} DOC "The path to TBB headers")
|
if(TBB_INTERFACE_VERSION LESS 6000) # drop support of versions < 4.0
|
||||||
if(TBB_INCLUDE_DIRS)
|
set(HAVE_TBB FALSE)
|
||||||
if(UNIX)
|
endif()
|
||||||
set(TBB_LIB_DIR "${TBB_INCLUDE_DIRS}/../lib" CACHE PATH "Full path of TBB library directory")
|
|
||||||
link_directories("${TBB_LIB_DIR}")
|
|
||||||
endif()
|
|
||||||
if(APPLE)
|
|
||||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} libtbb.dylib)
|
|
||||||
elseif(ANDROID)
|
|
||||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} tbb)
|
|
||||||
add_definitions(-DTBB_USE_GCC_BUILTINS)
|
|
||||||
elseif (UNIX)
|
|
||||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} tbb)
|
|
||||||
elseif (WIN32)
|
|
||||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
|
||||||
set(TBB_LIB_DIR "${TBB_INCLUDE_DIRS}/../lib" CACHE PATH "Full path of TBB library directory")
|
|
||||||
link_directories("${TBB_LIB_DIR}")
|
|
||||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} tbb)
|
|
||||||
else()
|
|
||||||
get_filename_component(_TBB_LIB_PATH "${TBB_INCLUDE_DIRS}/../lib" ABSOLUTE)
|
|
||||||
|
|
||||||
if(CMAKE_SYSTEM_PROCESSOR MATCHES amd64*|x86_64* OR MSVC64)
|
|
||||||
set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/intel64")
|
|
||||||
else()
|
|
||||||
set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/ia32")
|
|
||||||
endif()
|
|
||||||
|
|
||||||
if(MSVC80)
|
|
||||||
set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/vc8")
|
|
||||||
elseif(MSVC90)
|
|
||||||
set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/vc9")
|
|
||||||
elseif(MSVC10)
|
|
||||||
set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/vc10")
|
|
||||||
elseif(MSVC11)
|
|
||||||
set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/vc11")
|
|
||||||
elseif(MSVC12)
|
|
||||||
set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/vc12")
|
|
||||||
elseif(MSVC14)
|
|
||||||
set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/vc14")
|
|
||||||
endif()
|
|
||||||
set(TBB_LIB_DIR "${_TBB_LIB_PATH}" CACHE PATH "Full path of TBB library directory")
|
|
||||||
link_directories("${TBB_LIB_DIR}")
|
|
||||||
endif()
|
|
||||||
endif()
|
|
||||||
|
|
||||||
set(HAVE_TBB 1)
|
|
||||||
if(NOT "${TBB_INCLUDE_DIRS}" STREQUAL "")
|
|
||||||
ocv_include_directories("${TBB_INCLUDE_DIRS}")
|
|
||||||
endif()
|
|
||||||
endif(TBB_INCLUDE_DIRS)
|
|
||||||
endif(NOT HAVE_TBB)
|
|
||||||
|
|
||||||
# get TBB version
|
|
||||||
if(HAVE_TBB)
|
if(HAVE_TBB)
|
||||||
find_file(TBB_STDDEF_PATH tbb/tbb_stddef.h "${TBB_INCLUDE_DIRS}")
|
list(APPEND OPENCV_LINKER_LIBS tbb)
|
||||||
mark_as_advanced(TBB _STDDEF_PATH)
|
|
||||||
endif()
|
|
||||||
if(HAVE_TBB AND TBB_STDDEF_PATH)
|
|
||||||
ocv_parse_header("${TBB_STDDEF_PATH}" TBB_VERSION_LINES TBB_VERSION_MAJOR TBB_VERSION_MINOR TBB_INTERFACE_VERSION)
|
|
||||||
else()
|
|
||||||
unset(TBB_VERSION_MAJOR)
|
|
||||||
unset(TBB_VERSION_MINOR)
|
|
||||||
unset(TBB_INTERFACE_VERSION)
|
|
||||||
endif()
|
endif()
|
||||||
|
@ -687,9 +687,9 @@ macro(ocv_parse_header FILENAME FILE_VAR)
|
|||||||
set(__parnet_scope OFF)
|
set(__parnet_scope OFF)
|
||||||
set(__add_cache OFF)
|
set(__add_cache OFF)
|
||||||
foreach(name ${ARGN})
|
foreach(name ${ARGN})
|
||||||
if("${name}" STREQUAL "PARENT_SCOPE")
|
if(${name} STREQUAL "PARENT_SCOPE")
|
||||||
set(__parnet_scope ON)
|
set(__parnet_scope ON)
|
||||||
elseif("${name}" STREQUAL "CACHE")
|
elseif(${name} STREQUAL "CACHE")
|
||||||
set(__add_cache ON)
|
set(__add_cache ON)
|
||||||
elseif(vars_regex)
|
elseif(vars_regex)
|
||||||
set(vars_regex "${vars_regex}|${name}")
|
set(vars_regex "${vars_regex}|${name}")
|
||||||
@ -703,7 +703,7 @@ macro(ocv_parse_header FILENAME FILE_VAR)
|
|||||||
unset(${FILE_VAR})
|
unset(${FILE_VAR})
|
||||||
endif()
|
endif()
|
||||||
foreach(name ${ARGN})
|
foreach(name ${ARGN})
|
||||||
if(NOT "${name}" STREQUAL "PARENT_SCOPE" AND NOT "${name}" STREQUAL "CACHE")
|
if(NOT ${name} STREQUAL "PARENT_SCOPE" AND NOT ${name} STREQUAL "CACHE")
|
||||||
if(${FILE_VAR})
|
if(${FILE_VAR})
|
||||||
if(${FILE_VAR} MATCHES ".+[ \t]${name}[ \t]+([0-9]+).*")
|
if(${FILE_VAR} MATCHES ".+[ \t]${name}[ \t]+([0-9]+).*")
|
||||||
string(REGEX REPLACE ".+[ \t]${name}[ \t]+([0-9]+).*" "\\1" ${name} "${${FILE_VAR}}")
|
string(REGEX REPLACE ".+[ \t]${name}[ \t]+([0-9]+).*" "\\1" ${name} "${${FILE_VAR}}")
|
||||||
|
@ -60,15 +60,10 @@
|
|||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef HAVE_TBB
|
#ifdef HAVE_TBB
|
||||||
# include "tbb/tbb_stddef.h"
|
# include "tbb/tbb.h"
|
||||||
# if TBB_VERSION_MAJOR*100 + TBB_VERSION_MINOR >= 202
|
# include "tbb/task.h"
|
||||||
# include "tbb/tbb.h"
|
# undef min
|
||||||
# include "tbb/task.h"
|
# undef max
|
||||||
# undef min
|
|
||||||
# undef max
|
|
||||||
# else
|
|
||||||
# undef HAVE_TBB
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined HAVE_FP16 && (defined __F16C__ || (defined _MSC_VER && _MSC_VER >= 1700))
|
#if defined HAVE_FP16 && (defined __F16C__ || (defined _MSC_VER && _MSC_VER >= 1700))
|
||||||
|
@ -84,37 +84,30 @@
|
|||||||
*/
|
*/
|
||||||
|
|
||||||
#if defined HAVE_TBB
|
#if defined HAVE_TBB
|
||||||
|
#include "tbb/tbb.h"
|
||||||
|
#include "tbb/task.h"
|
||||||
#include "tbb/tbb_stddef.h"
|
#include "tbb/tbb_stddef.h"
|
||||||
#if TBB_VERSION_MAJOR*100 + TBB_VERSION_MINOR >= 202
|
#if TBB_INTERFACE_VERSION >= 8000
|
||||||
#include "tbb/tbb.h"
|
#include "tbb/task_arena.h"
|
||||||
#include "tbb/task.h"
|
|
||||||
#if TBB_INTERFACE_VERSION >= 6100
|
|
||||||
#include "tbb/task_arena.h"
|
|
||||||
#endif
|
|
||||||
#undef min
|
|
||||||
#undef max
|
|
||||||
#else
|
|
||||||
#undef HAVE_TBB
|
|
||||||
#endif // end TBB version
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifndef HAVE_TBB
|
|
||||||
#if defined HAVE_CSTRIPES
|
|
||||||
#include "C=.h"
|
|
||||||
#undef shared
|
|
||||||
#elif defined HAVE_OPENMP
|
|
||||||
#include <omp.h>
|
|
||||||
#elif defined HAVE_GCD
|
|
||||||
#include <dispatch/dispatch.h>
|
|
||||||
#include <pthread.h>
|
|
||||||
#elif defined WINRT && _MSC_VER < 1900
|
|
||||||
#include <ppltasks.h>
|
|
||||||
#elif defined HAVE_CONCURRENCY
|
|
||||||
#include <ppl.h>
|
|
||||||
#endif
|
#endif
|
||||||
|
#undef min
|
||||||
|
#undef max
|
||||||
|
#elif defined HAVE_CSTRIPES
|
||||||
|
#include "C=.h"
|
||||||
|
#undef shared
|
||||||
|
#elif defined HAVE_OPENMP
|
||||||
|
#include <omp.h>
|
||||||
|
#elif defined HAVE_GCD
|
||||||
|
#include <dispatch/dispatch.h>
|
||||||
|
#include <pthread.h>
|
||||||
|
#elif defined WINRT && _MSC_VER < 1900
|
||||||
|
#include <ppltasks.h>
|
||||||
|
#elif defined HAVE_CONCURRENCY
|
||||||
|
#include <ppl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined HAVE_TBB && TBB_VERSION_MAJOR*100 + TBB_VERSION_MINOR >= 202
|
|
||||||
|
#if defined HAVE_TBB
|
||||||
# define CV_PARALLEL_FRAMEWORK "tbb"
|
# define CV_PARALLEL_FRAMEWORK "tbb"
|
||||||
#elif defined HAVE_CSTRIPES
|
#elif defined HAVE_CSTRIPES
|
||||||
# define CV_PARALLEL_FRAMEWORK "cstripes"
|
# define CV_PARALLEL_FRAMEWORK "cstripes"
|
||||||
@ -491,8 +484,10 @@ void cv::setNumThreads( int threads )
|
|||||||
int cv::getThreadNum(void)
|
int cv::getThreadNum(void)
|
||||||
{
|
{
|
||||||
#if defined HAVE_TBB
|
#if defined HAVE_TBB
|
||||||
#if TBB_INTERFACE_VERSION >= 6100 && defined TBB_PREVIEW_TASK_ARENA && TBB_PREVIEW_TASK_ARENA
|
#if TBB_INTERFACE_VERSION >= 9100
|
||||||
return tbb::task_arena::current_slot();
|
return tbb::this_task_arena::current_thread_index();
|
||||||
|
#elif TBB_INTERFACE_VERSION >= 8000
|
||||||
|
return tbb::task_arena::current_thread_index();
|
||||||
#else
|
#else
|
||||||
return 0;
|
return 0;
|
||||||
#endif
|
#endif
|
||||||
|
@ -44,10 +44,6 @@
|
|||||||
|
|
||||||
#ifdef HAVE_OPENNI
|
#ifdef HAVE_OPENNI
|
||||||
|
|
||||||
#if defined TBB_INTERFACE_VERSION && TBB_INTERFACE_VERSION < 5000
|
|
||||||
# undef HAVE_TBB
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
|
||||||
#ifndef i386
|
#ifndef i386
|
||||||
|
@ -44,10 +44,6 @@
|
|||||||
|
|
||||||
#ifdef HAVE_OPENNI2
|
#ifdef HAVE_OPENNI2
|
||||||
|
|
||||||
#if defined TBB_INTERFACE_VERSION && TBB_INTERFACE_VERSION < 5000
|
|
||||||
# undef HAVE_TBB
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#include <queue>
|
#include <queue>
|
||||||
|
|
||||||
#ifndef i386
|
#ifndef i386
|
||||||
|
@ -12,15 +12,10 @@
|
|||||||
#include "opencv2/cudaarithm.hpp"
|
#include "opencv2/cudaarithm.hpp"
|
||||||
|
|
||||||
#ifdef HAVE_TBB
|
#ifdef HAVE_TBB
|
||||||
# include "tbb/tbb_stddef.h"
|
# include "tbb/tbb.h"
|
||||||
# if TBB_VERSION_MAJOR*100 + TBB_VERSION_MINOR >= 202
|
# include "tbb/task.h"
|
||||||
# include "tbb/tbb.h"
|
# undef min
|
||||||
# include "tbb/task.h"
|
# undef max
|
||||||
# undef min
|
|
||||||
# undef max
|
|
||||||
# else
|
|
||||||
# undef HAVE_TBB
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(HAVE_CUDA) || !defined(HAVE_TBB) || defined(__arm__)
|
#if !defined(HAVE_CUDA) || !defined(HAVE_TBB) || defined(__arm__)
|
||||||
|
@ -14,15 +14,10 @@
|
|||||||
#include "opencv2/cudastereo.hpp"
|
#include "opencv2/cudastereo.hpp"
|
||||||
|
|
||||||
#ifdef HAVE_TBB
|
#ifdef HAVE_TBB
|
||||||
# include "tbb/tbb_stddef.h"
|
# include "tbb/tbb.h"
|
||||||
# if TBB_VERSION_MAJOR*100 + TBB_VERSION_MINOR >= 202
|
# include "tbb/task.h"
|
||||||
# include "tbb/tbb.h"
|
# undef min
|
||||||
# include "tbb/task.h"
|
# undef max
|
||||||
# undef min
|
|
||||||
# undef max
|
|
||||||
# else
|
|
||||||
# undef HAVE_TBB
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(HAVE_CUDA) || !defined(HAVE_TBB) || defined(__arm__)
|
#if !defined(HAVE_CUDA) || !defined(HAVE_TBB) || defined(__arm__)
|
||||||
|
@ -12,15 +12,10 @@
|
|||||||
#include "opencv2/cudaarithm.hpp"
|
#include "opencv2/cudaarithm.hpp"
|
||||||
|
|
||||||
#ifdef HAVE_TBB
|
#ifdef HAVE_TBB
|
||||||
# include "tbb/tbb_stddef.h"
|
# include "tbb/tbb.h"
|
||||||
# if TBB_VERSION_MAJOR*100 + TBB_VERSION_MINOR >= 202
|
# include "tbb/task.h"
|
||||||
# include "tbb/tbb.h"
|
# undef min
|
||||||
# include "tbb/task.h"
|
# undef max
|
||||||
# undef min
|
|
||||||
# undef max
|
|
||||||
# else
|
|
||||||
# undef HAVE_TBB
|
|
||||||
# endif
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if !defined(HAVE_CUDA) || !defined(HAVE_TBB)
|
#if !defined(HAVE_CUDA) || !defined(HAVE_TBB)
|
||||||
|
Loading…
Reference in New Issue
Block a user