init.cmake 1.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. if(PROJECT_NAME STREQUAL "OpenCV")
  2. set(ENABLE_PLUGINS_DEFAULT ON)
  3. if(EMSCRIPTEN OR IOS OR WINRT)
  4. set(ENABLE_PLUGINS_DEFAULT OFF)
  5. endif()
  6. set(HIGHGUI_PLUGIN_LIST "" CACHE STRING "List of GUI backends to be compiled as plugins (gtk, gtk2/gtk3, qt, win32 or special value 'all')")
  7. set(HIGHGUI_ENABLE_PLUGINS "${ENABLE_PLUGINS_DEFAULT}" CACHE BOOL "Allow building and using of GUI plugins")
  8. mark_as_advanced(HIGHGUI_PLUGIN_LIST HIGHGUI_ENABLE_PLUGINS)
  9. string(REPLACE "," ";" HIGHGUI_PLUGIN_LIST "${HIGHGUI_PLUGIN_LIST}") # support comma-separated list (,) too
  10. string(TOLOWER "${HIGHGUI_PLUGIN_LIST}" HIGHGUI_PLUGIN_LIST)
  11. if(NOT HIGHGUI_ENABLE_PLUGINS)
  12. if(HIGHGUI_PLUGIN_LIST)
  13. message(WARNING "HighGUI: plugins are disabled through HIGHGUI_ENABLE_PLUGINS, so HIGHGUI_PLUGIN_LIST='${HIGHGUI_PLUGIN_LIST}' is ignored")
  14. set(HIGHGUI_PLUGIN_LIST "")
  15. endif()
  16. else()
  17. # Make virtual plugins target
  18. if(NOT TARGET opencv_highgui_plugins)
  19. add_custom_target(opencv_highgui_plugins ALL)
  20. endif()
  21. endif()
  22. endif()
  23. #
  24. # Detect available dependencies
  25. #
  26. if(NOT PROJECT_NAME STREQUAL "OpenCV")
  27. include(FindPkgConfig)
  28. endif()
  29. macro(add_backend backend_id cond_var)
  30. if(${cond_var})
  31. include("${CMAKE_CURRENT_LIST_DIR}/detect_${backend_id}.cmake")
  32. endif()
  33. endmacro()
  34. add_backend("gtk" WITH_GTK)
  35. add_backend("win32ui" WITH_WIN32UI)
  36. # TODO cocoa
  37. # TODO qt
  38. # TODO opengl
  39. # FIXIT: move content of cmake/OpenCVFindLibsGUI.cmake here (need to resolve CMake scope issues)