2 add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/tbb")
3 include_directories(SYSTEM ${TBB_INCLUDE_DIRS})
4 set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} tbb)
5 add_definitions(-DTBB_USE_GCC_BUILTINS=1 -D__TBB_GCC_BUILTIN_ATOMICS_PRESENT=1 -D__TBB_USE_GENERIC_DWORD_LOAD_STORE=1)
7 elseif(UNIX AND NOT APPLE)
8 PKG_CHECK_MODULES(TBB tbb)
12 if(NOT ${TBB_INCLUDE_DIRS} STREQUAL "")
13 ocv_include_directories(${TBB_INCLUDE_DIRS})
15 link_directories(${TBB_LIBRARY_DIRS})
16 set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${TBB_LIBRARIES})
21 set(TBB_DEFAULT_INCLUDE_DIRS "/opt/intel/tbb" "/usr/local/include" "/usr/include" "C:/Program Files/Intel/TBB" "C:/Program Files (x86)/Intel/TBB" "C:/Program Files (x86)/TBB" "${CMAKE_INSTALL_PREFIX}/include")
23 find_path(TBB_INCLUDE_DIRS "tbb/tbb.h" PATHS ${TBB_INCLUDE_DIR} ${TBB_DEFAULT_INCLUDE_DIRS} DOC "The path to TBB headers")
26 set(TBB_LIB_DIR "${TBB_INCLUDE_DIRS}/../lib" CACHE PATH "Full path of TBB library directory")
27 link_directories("${TBB_LIB_DIR}")
30 set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} libtbb.dylib)
32 set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} tbb)
33 add_definitions(-DTBB_USE_GCC_BUILTINS)
35 set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} tbb)
37 if(CMAKE_COMPILER_IS_GNUCXX)
38 set(TBB_LIB_DIR "${TBB_INCLUDE_DIRS}/../lib" CACHE PATH "Full path of TBB library directory")
39 link_directories("${TBB_LIB_DIR}")
40 set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} tbb)
42 get_filename_component(_TBB_LIB_PATH "${TBB_INCLUDE_DIRS}/../lib" ABSOLUTE)
44 if(CMAKE_SYSTEM_PROCESSOR MATCHES amd64*|x86_64* OR MSVC64)
45 set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/intel64")
47 set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/ia32")
51 set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/vc8")
53 set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/vc9")
55 set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/vc10")
57 set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/vc11")
59 set(TBB_LIB_DIR "${_TBB_LIB_PATH}" CACHE PATH "Full path of TBB library directory")
60 link_directories("${TBB_LIB_DIR}")
65 if(NOT "${TBB_INCLUDE_DIRS}" STREQUAL "")
66 ocv_include_directories("${TBB_INCLUDE_DIRS}")
68 endif(TBB_INCLUDE_DIRS)
73 find_file(TBB_STDDEF_PATH tbb/tbb_stddef.h "${TBB_INCLUDE_DIRS}")
75 if(HAVE_TBB AND TBB_STDDEF_PATH)
76 ocv_parse_header("${TBB_STDDEF_PATH}" TBB_VERSION_LINES TBB_VERSION_MAJOR TBB_VERSION_MINOR TBB_INTERFACE_VERSION)
78 unset(TBB_VERSION_MAJOR)
79 unset(TBB_VERSION_MINOR)
80 unset(TBB_INTERFACE_VERSION)