2013-01-10 14:18:01 +01:00
|
|
|
if(BUILD_TBB)
|
2012-02-24 19:16:05 +01:00
|
|
|
add_subdirectory("${OpenCV_SOURCE_DIR}/3rdparty/tbb")
|
2012-06-08 12:32:51 +02:00
|
|
|
include_directories(SYSTEM ${TBB_INCLUDE_DIRS})
|
2012-02-24 19:16:05 +01:00
|
|
|
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} tbb)
|
2012-06-19 22:08:15 +02:00
|
|
|
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()
|
2012-02-27 07:19:25 +01:00
|
|
|
set(HAVE_TBB 1)
|
2012-02-24 19:16:05 +01:00
|
|
|
elseif(UNIX AND NOT APPLE)
|
2012-02-03 12:26:49 +01:00
|
|
|
PKG_CHECK_MODULES(TBB tbb)
|
|
|
|
|
|
|
|
if(TBB_FOUND)
|
|
|
|
set(HAVE_TBB 1)
|
|
|
|
if(NOT ${TBB_INCLUDE_DIRS} STREQUAL "")
|
2012-06-09 17:00:04 +02:00
|
|
|
ocv_include_directories(${TBB_INCLUDE_DIRS})
|
2012-02-03 12:26:49 +01:00
|
|
|
endif()
|
|
|
|
link_directories(${TBB_LIBRARY_DIRS})
|
|
|
|
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${TBB_LIBRARIES})
|
|
|
|
endif()
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(NOT HAVE_TBB)
|
2012-09-06 12:42:30 +02:00
|
|
|
set(TBB_DEFAULT_INCLUDE_DIRS
|
2013-01-30 14:17:04 +01:00
|
|
|
"/opt/intel/tbb/include" "/usr/local/include" "/usr/include"
|
2012-09-06 12:42:30 +02:00
|
|
|
"C:/Program Files/Intel/TBB" "C:/Program Files (x86)/Intel/TBB"
|
2015-12-04 15:07:41 +01:00
|
|
|
"C:/Program Files/tbb/include"
|
2012-09-06 12:42:30 +02:00
|
|
|
"C:/Program Files (x86)/tbb/include"
|
2012-08-21 11:59:27 +02:00
|
|
|
"${CMAKE_INSTALL_PREFIX}/include")
|
2012-02-03 12:26:49 +01:00
|
|
|
|
2012-04-13 23:50:59 +02:00
|
|
|
find_path(TBB_INCLUDE_DIRS "tbb/tbb.h" PATHS ${TBB_INCLUDE_DIR} ${TBB_DEFAULT_INCLUDE_DIRS} DOC "The path to TBB headers")
|
|
|
|
if(TBB_INCLUDE_DIRS)
|
2012-02-03 12:26:49 +01:00
|
|
|
if(UNIX)
|
2012-04-13 23:50:59 +02:00
|
|
|
set(TBB_LIB_DIR "${TBB_INCLUDE_DIRS}/../lib" CACHE PATH "Full path of TBB library directory")
|
2012-02-03 12:26:49 +01:00
|
|
|
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)
|
2012-04-13 23:50:59 +02:00
|
|
|
set(TBB_LIB_DIR "${TBB_INCLUDE_DIRS}/../lib" CACHE PATH "Full path of TBB library directory")
|
2012-02-03 12:26:49 +01:00
|
|
|
link_directories("${TBB_LIB_DIR}")
|
|
|
|
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} tbb)
|
|
|
|
else()
|
2012-04-13 23:50:59 +02:00
|
|
|
get_filename_component(_TBB_LIB_PATH "${TBB_INCLUDE_DIRS}/../lib" ABSOLUTE)
|
2012-02-03 12:26:49 +01:00
|
|
|
|
|
|
|
if(CMAKE_SYSTEM_PROCESSOR MATCHES amd64*|x86_64* OR MSVC64)
|
|
|
|
set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/intel64")
|
2012-02-06 07:11:23 +01:00
|
|
|
else()
|
2012-02-03 12:26:49 +01:00
|
|
|
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")
|
2014-04-28 13:23:49 +02:00
|
|
|
elseif(MSVC12)
|
|
|
|
set(_TBB_LIB_PATH "${_TBB_LIB_PATH}/vc12")
|
2012-02-03 12:26:49 +01:00
|
|
|
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)
|
2012-04-13 23:50:59 +02:00
|
|
|
if(NOT "${TBB_INCLUDE_DIRS}" STREQUAL "")
|
2012-06-09 17:00:04 +02:00
|
|
|
ocv_include_directories("${TBB_INCLUDE_DIRS}")
|
2012-02-03 12:26:49 +01:00
|
|
|
endif()
|
2012-04-13 23:50:59 +02:00
|
|
|
endif(TBB_INCLUDE_DIRS)
|
2012-02-03 12:26:49 +01:00
|
|
|
endif(NOT HAVE_TBB)
|
2012-04-13 23:50:59 +02:00
|
|
|
|
|
|
|
# get TBB version
|
|
|
|
if(HAVE_TBB)
|
|
|
|
find_file(TBB_STDDEF_PATH tbb/tbb_stddef.h "${TBB_INCLUDE_DIRS}")
|
2012-10-10 22:54:45 +02:00
|
|
|
mark_as_advanced(TBB _STDDEF_PATH)
|
2012-04-13 23:50:59 +02:00
|
|
|
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()
|