3 add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/tbb")
4 if(NOT ${TBB_INCLUDE_DIRS} STREQUAL "")
5 include_directories(${TBB_INCLUDE_DIRS})
7 set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} tbb)
8 add_definitions(-DTBB_USE_GCC_BUILTINS=1 -D__TBB_GCC_BUILTIN_ATOMICS_PRESENT=1 -D__TBB_USE_GENERIC_DWORD_LOAD_STORE=1)
9 elseif(UNIX AND NOT APPLE)
10 PKG_CHECK_MODULES(TBB tbb)
14 if(NOT ${TBB_INCLUDE_DIRS} STREQUAL "")
15 include_directories(${TBB_INCLUDE_DIRS})
17 link_directories(${TBB_LIBRARY_DIRS})
18 set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${TBB_LIBRARIES})
23 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")
25 find_path(TBB_INCLUDE_DIR "tbb/tbb.h" PATHS ${TBB_DEFAULT_INCLUDE_DIRS} DOC "The path to TBB headers")
28 set(TBB_LIB_DIR "${TBB_INCLUDE_DIR}/../lib" CACHE PATH "Full path of TBB library directory")
29 link_directories("${TBB_LIB_DIR}")
32 set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} libtbb.dylib)
34 set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} tbb)
35 add_definitions(-DTBB_USE_GCC_BUILTINS)
37 set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} tbb)
39 if(CMAKE_COMPILER_IS_GNUCXX)
40 set(TBB_LIB_DIR "${TBB_INCLUDE_DIR}/../lib" CACHE PATH "Full path of TBB library directory")
41 link_directories("${TBB_LIB_DIR}")
42 set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} tbb)
44 get_filename_component(_TBB_LIB_PATH "${TBB_INCLUDE_DIR}/../lib" ABSOLUTE)
46 if(CMAKE_SYSTEM_PROCESSOR MATCHES amd64*|x86_64* OR MSVC64)
47 set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/intel64")
49 set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/ia32")
53 set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/vc8")
55 set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/vc9")
57 set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/vc10")
59 set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/vc11")
61 set(TBB_LIB_DIR "${_TBB_LIB_PATH}" CACHE PATH "Full path of TBB library directory")
62 link_directories("${TBB_LIB_DIR}")
67 if(NOT "${TBB_INCLUDE_DIR}" STREQUAL "")
68 include_directories("${TBB_INCLUDE_DIR}")
70 endif(TBB_INCLUDE_DIR)