mirror of
https://github.com/opencv/opencv.git
synced 2024-11-30 06:10:02 +08:00
Added TBB version detection to CMake
This commit is contained in:
parent
be20370a3d
commit
7ed80d54d7
@ -832,19 +832,21 @@ else()
|
||||
status(" Use IPP:" WITH_IPP AND NOT IPP_FOUND THEN "IPP not found" ELSE NO)
|
||||
endif()
|
||||
|
||||
status(" Use TBB:" HAVE_TBB THEN YES ELSE NO)
|
||||
status(" Use TBB:" HAVE_TBB THEN "YES (ver ${TBB_VERSION_MAJOR}.${TBB_VERSION_MINOR} interface ${TBB_INTERFACE_VERSION})" ELSE NO)
|
||||
status(" Use Cuda:" HAVE_CUDA THEN YES ELSE NO)
|
||||
status(" Use Eigen:" HAVE_EIGEN THEN YES ELSE NO)
|
||||
|
||||
# interfaces to other languages
|
||||
status("")
|
||||
status(" Python:")
|
||||
status(" Interpreter:" PYTHON_EXECUTABLE THEN "${PYTHON_EXECUTABLE} (ver ${PYTHON_VERSION_FULL})" ELSE NO)
|
||||
status(" Libraries:" HAVE_opencv_python THEN ${PYTHON_LIBRARIES} ELSE NO)
|
||||
status(" numpy:" PYTHON_USE_NUMPY THEN "${PYTHON_NUMPY_INCLUDE_DIR} (ver ${PYTHON_NUMPY_VERSION})" ELSE "NO (Python wrappers can not be generated)")
|
||||
status(" packages path:" PYTHON_EXECUTABLE THEN "${PYTHON_PACKAGES_PATH}" ELSE "-")
|
||||
status(" Interpreter:" PYTHON_EXECUTABLE THEN "${PYTHON_EXECUTABLE} (ver ${PYTHON_VERSION_FULL})" ELSE NO)
|
||||
if(BUILD_opencv_python)
|
||||
status(" Libraries:" HAVE_opencv_python THEN ${PYTHON_LIBRARIES} ELSE NO)
|
||||
status(" numpy:" PYTHON_USE_NUMPY THEN "${PYTHON_NUMPY_INCLUDE_DIR} (ver ${PYTHON_NUMPY_VERSION})" ELSE "NO (Python wrappers can not be generated)")
|
||||
status(" packages path:" PYTHON_EXECUTABLE THEN "${PYTHON_PACKAGES_PATH}" ELSE "-")
|
||||
endif()
|
||||
|
||||
if(ANDROID)
|
||||
if(BUILD_opencv_java)
|
||||
status("")
|
||||
status(" Java:" HAVE_opencv_java THEN YES ELSE NO)
|
||||
endif()
|
||||
@ -853,13 +855,13 @@ endif()
|
||||
if(BUILD_DOCS)
|
||||
status("")
|
||||
status(" Documentation:")
|
||||
status(" Sphinx:" HAVE_SPHINX THEN "${SPHINX_BUILD} (ver ${SPHINX_VERSION})" ELSE NO)
|
||||
status(" PdfLaTeX compiler:" PDFLATEX_COMPILER THEN "${PDFLATEX_COMPILER}" ELSE NO)
|
||||
if(HAVE_SPHINX)
|
||||
status(" Build Documentation:" PDFLATEX_COMPILER THEN YES ELSE "YES (only HTML without math expressions)")
|
||||
status(" Build Documentation:" PDFLATEX_COMPILER THEN YES ELSE "YES (only HTML and without math expressions)")
|
||||
else()
|
||||
status(" Build Documentation:" NO)
|
||||
endif()
|
||||
status(" Sphinx:" HAVE_SPHINX THEN "${SPHINX_BUILD} (ver ${SPHINX_VERSION})" ELSE NO)
|
||||
status(" PdfLaTeX compiler:" PDFLATEX_COMPILER THEN "${PDFLATEX_COMPILER}" ELSE NO)
|
||||
endif()
|
||||
|
||||
# samples and tests
|
||||
|
@ -20,10 +20,10 @@ endif()
|
||||
if(NOT HAVE_TBB)
|
||||
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")
|
||||
|
||||
find_path(TBB_INCLUDE_DIR "tbb/tbb.h" PATHS ${TBB_DEFAULT_INCLUDE_DIRS} DOC "The path to TBB headers")
|
||||
if(TBB_INCLUDE_DIR)
|
||||
find_path(TBB_INCLUDE_DIRS "tbb/tbb.h" PATHS ${TBB_DEFAULT_INCLUDE_DIRS} DOC "The path to TBB headers")
|
||||
if(TBB_INCLUDE_DIRS)
|
||||
if(UNIX)
|
||||
set(TBB_LIB_DIR "${TBB_INCLUDE_DIR}/../lib" CACHE PATH "Full path of TBB library directory")
|
||||
set(TBB_LIB_DIR "${TBB_INCLUDE_DIRS}/../lib" CACHE PATH "Full path of TBB library directory")
|
||||
link_directories("${TBB_LIB_DIR}")
|
||||
endif()
|
||||
if(APPLE)
|
||||
@ -35,11 +35,11 @@ if(NOT HAVE_TBB)
|
||||
set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} tbb)
|
||||
elseif (WIN32)
|
||||
if(CMAKE_COMPILER_IS_GNUCXX)
|
||||
set(TBB_LIB_DIR "${TBB_INCLUDE_DIR}/../lib" CACHE PATH "Full path of TBB library directory")
|
||||
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_DIR}/../lib" ABSOLUTE)
|
||||
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")
|
||||
@ -62,8 +62,23 @@ if(NOT HAVE_TBB)
|
||||
endif()
|
||||
|
||||
set(HAVE_TBB 1)
|
||||
if(NOT "${TBB_INCLUDE_DIR}" STREQUAL "")
|
||||
ocv_include_directories("${TBB_INCLUDE_DIR}")
|
||||
if(NOT "${TBB_INCLUDE_DIRS}" STREQUAL "")
|
||||
ocv_include_directories("${TBB_INCLUDE_DIRS}")
|
||||
endif()
|
||||
endif(TBB_INCLUDE_DIR)
|
||||
endif(TBB_INCLUDE_DIRS)
|
||||
endif(NOT HAVE_TBB)
|
||||
|
||||
# get TBB version
|
||||
if(HAVE_TBB)
|
||||
find_file(TBB_STDDEF_PATH tbb/tbb_stddef.h "${TBB_INCLUDE_DIRS}")
|
||||
endif()
|
||||
if(HAVE_TBB AND TBB_STDDEF_PATH)
|
||||
file(STRINGS "${TBB_STDDEF_PATH}" TBB_VERSION_LINES REGEX "#define (TBB_VERSION_MAJOR|TBB_VERSION_MINOR|TBB_INTERFACE_VERSION)[ ]+[0-9]+" )
|
||||
string(REGEX REPLACE ".+TBB_VERSION_MAJOR[ ]+([0-9]+).*" "\\1" TBB_VERSION_MAJOR "${TBB_VERSION_LINES}")
|
||||
string(REGEX REPLACE ".+TBB_VERSION_MINOR[ ]+([0-9]+).*" "\\1" TBB_VERSION_MINOR "${TBB_VERSION_LINES}")
|
||||
string(REGEX REPLACE ".+TBB_INTERFACE_VERSION[ ]+([0-9]+).*" "\\1" TBB_INTERFACE_VERSION "${TBB_VERSION_LINES}")
|
||||
else()
|
||||
unset(TBB_VERSION_MAJOR)
|
||||
unset(TBB_VERSION_MINOR)
|
||||
unset(TBB_INTERFACE_VERSION)
|
||||
endif()
|
||||
|
Loading…
Reference in New Issue
Block a user