OpenCVFindFrameworks.cmake 1.2 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344
  1. # ----------------------------------------------------------------------------
  2. # Detect frameworks that may be used by 3rd-party libraries as well as OpenCV
  3. # ----------------------------------------------------------------------------
  4. # --- HPX ---
  5. if(WITH_HPX)
  6. find_package(HPX REQUIRED)
  7. ocv_include_directories(${HPX_INCLUDE_DIRS})
  8. set(HAVE_HPX TRUE)
  9. endif(WITH_HPX)
  10. # --- GCD ---
  11. if(APPLE AND NOT HAVE_TBB)
  12. set(HAVE_GCD 1)
  13. else()
  14. set(HAVE_GCD 0)
  15. endif()
  16. # --- Concurrency ---
  17. if(MSVC AND NOT HAVE_TBB AND NOT OPENCV_DISABLE_THREAD_SUPPORT)
  18. set(_fname "${CMAKE_BINARY_DIR}${CMAKE_FILES_DIRECTORY}/CMakeTmp/concurrencytest.cpp")
  19. file(WRITE "${_fname}" "#if _MSC_VER < 1600\n#error\n#endif\nint main() { return 0; }\n")
  20. try_compile(HAVE_CONCURRENCY "${CMAKE_BINARY_DIR}" "${_fname}")
  21. file(REMOVE "${_fname}")
  22. else()
  23. set(HAVE_CONCURRENCY 0)
  24. endif()
  25. # --- OpenMP ---
  26. if(WITH_OPENMP)
  27. find_package(OpenMP)
  28. if(OPENMP_FOUND)
  29. set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} ${OpenMP_C_FLAGS}")
  30. set(CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS} ${OpenMP_CXX_FLAGS}")
  31. endif()
  32. set(HAVE_OPENMP "${OPENMP_FOUND}")
  33. endif()
  34. ocv_clear_vars(HAVE_PTHREADS_PF)
  35. if(WITH_PTHREADS_PF AND HAVE_PTHREAD)
  36. set(HAVE_PTHREADS_PF 1)
  37. else()
  38. set(HAVE_PTHREADS_PF 0)
  39. endif()