1# ---------------------------------------------------------------------------- 2# Detect other 3rd-party performance and math libraries 3# ---------------------------------------------------------------------------- 4 5# --- TBB --- 6if(WITH_TBB) 7 include("${OpenCV_SOURCE_DIR}/cmake/OpenCVDetectTBB.cmake") 8endif(WITH_TBB) 9 10# --- IPP --- 11if(WITH_IPP) 12 include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindIPP.cmake") 13 if(HAVE_IPP) 14 ocv_include_directories(${IPP_INCLUDE_DIRS}) 15 list(APPEND OPENCV_LINKER_LIBS ${IPP_LIBRARIES}) 16 endif() 17endif() 18 19# --- IPP Async --- 20 21if(WITH_IPP_A) 22 include("${OpenCV_SOURCE_DIR}/cmake/OpenCVFindIPPAsync.cmake") 23 if(IPP_A_INCLUDE_DIR AND IPP_A_LIBRARIES) 24 ocv_include_directories(${IPP_A_INCLUDE_DIR}) 25 link_directories(${IPP_A_LIBRARIES}) 26 set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${IPP_A_LIBRARIES}) 27 endif() 28endif(WITH_IPP_A) 29 30# --- CUDA --- 31if(WITH_CUDA) 32 include("${OpenCV_SOURCE_DIR}/cmake/OpenCVDetectCUDA.cmake") 33endif(WITH_CUDA) 34 35# --- Eigen --- 36if(WITH_EIGEN) 37 find_path(EIGEN_INCLUDE_PATH "Eigen/Core" 38 PATHS /usr/local /opt /usr $ENV{EIGEN_ROOT}/include ENV ProgramFiles ENV ProgramW6432 39 PATH_SUFFIXES include/eigen3 include/eigen2 Eigen/include/eigen3 Eigen/include/eigen2 40 DOC "The path to Eigen3/Eigen2 headers" 41 CMAKE_FIND_ROOT_PATH_BOTH) 42 43 if(EIGEN_INCLUDE_PATH) 44 ocv_include_directories(${EIGEN_INCLUDE_PATH}) 45 ocv_parse_header("${EIGEN_INCLUDE_PATH}/Eigen/src/Core/util/Macros.h" EIGEN_VERSION_LINES EIGEN_WORLD_VERSION EIGEN_MAJOR_VERSION EIGEN_MINOR_VERSION) 46 set(HAVE_EIGEN 1) 47 endif() 48endif(WITH_EIGEN) 49 50# --- Clp --- 51# Ubuntu: sudo apt-get install coinor-libclp-dev coinor-libcoinutils-dev 52ocv_clear_vars(HAVE_CLP) 53if(WITH_CLP) 54 if(UNIX) 55 PKG_CHECK_MODULES(CLP clp) 56 if(CLP_FOUND) 57 set(HAVE_CLP TRUE) 58 if(NOT ${CLP_INCLUDE_DIRS} STREQUAL "") 59 ocv_include_directories(${CLP_INCLUDE_DIRS}) 60 endif() 61 link_directories(${CLP_LIBRARY_DIRS}) 62 set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} ${CLP_LIBRARIES}) 63 endif() 64 endif() 65 66 if(NOT CLP_FOUND) 67 find_path(CLP_INCLUDE_PATH "coin" 68 PATHS "/usr/local/include" "/usr/include" "/opt/include" 69 DOC "The path to Clp headers") 70 if(CLP_INCLUDE_PATH) 71 ocv_include_directories(${CLP_INCLUDE_PATH} "${CLP_INCLUDE_PATH}/coin") 72 get_filename_component(_CLP_LIBRARY_DIR "${CLP_INCLUDE_PATH}/../lib" ABSOLUTE) 73 set(CLP_LIBRARY_DIR "${_CLP_LIBRARY_DIR}" CACHE PATH "Full path of Clp library directory") 74 link_directories(${CLP_LIBRARY_DIR}) 75 if(UNIX) 76 set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} Clp CoinUtils m) 77 else() 78 if(MINGW) 79 set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} Clp CoinUtils) 80 else() 81 set(OPENCV_LINKER_LIBS ${OPENCV_LINKER_LIBS} libClp libCoinUtils) 82 endif() 83 endif() 84 set(HAVE_CLP TRUE) 85 endif() 86 endif() 87endif(WITH_CLP) 88 89# --- C= --- 90if(WITH_CSTRIPES AND NOT HAVE_TBB) 91 include("${OpenCV_SOURCE_DIR}/cmake/OpenCVDetectCStripes.cmake") 92else() 93 set(HAVE_CSTRIPES 0) 94endif() 95 96# --- GCD --- 97if(APPLE AND NOT HAVE_TBB AND NOT HAVE_CSTRIPES) 98 set(HAVE_GCD 1) 99else() 100 set(HAVE_GCD 0) 101endif() 102 103# --- Concurrency --- 104if(MSVC AND NOT HAVE_TBB AND NOT HAVE_CSTRIPES) 105 set(_fname "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/concurrencytest.cpp") 106 file(WRITE "${_fname}" "#if _MSC_VER < 1600\n#error\n#endif\nint main() { return 0; }\n") 107 try_compile(HAVE_CONCURRENCY "${CMAKE_BINARY_DIR}" "${_fname}") 108 file(REMOVE "${_fname}") 109else() 110 set(HAVE_CONCURRENCY 0) 111endif() 112 113# --- OpenMP --- 114if(WITH_OPENMP) 115 find_package(OpenMP) 116 if(OPENMP_FOUND) 117 set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}") 118 set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}") 119 endif() 120 set(HAVE_OPENMP "${OPENMP_FOUND}") 121endif() 122 123if(UNIX OR ANDROID) 124if(NOT APPLE AND NOT HAVE_TBB AND NOT HAVE_OPENMP) 125 set(HAVE_PTHREADS_PF 1) 126else() 127 set(HAVE_PTHREADS_PF 0) 128endif() 129else() 130 set(HAVE_PTHREADS_PF 0) 131endif() 132