CMakeLists.txt 1.0 KB

12345678910111213141516171819202122232425262728293031323334
  1. if(APPLE)
  2. return()
  3. endif()
  4. if(UNIX)
  5. find_package(X11 QUIET)
  6. endif()
  7. SET(OPENCV_OPENGL_SAMPLES_REQUIRED_DEPS
  8. opencv_core
  9. opencv_imgproc
  10. opencv_imgcodecs
  11. opencv_videoio
  12. opencv_highgui)
  13. ocv_check_dependencies(${OPENCV_OPENGL_SAMPLES_REQUIRED_DEPS})
  14. if(BUILD_EXAMPLES AND OCV_DEPENDENCIES_FOUND)
  15. project(opengl_samples)
  16. ocv_include_modules_recurse(${OPENCV_OPENGL_SAMPLES_REQUIRED_DEPS})
  17. file(GLOB all_samples RELATIVE ${CMAKE_CURRENT_SOURCE_DIR} *.cpp)
  18. if(NOT X11_FOUND)
  19. ocv_list_filterout(all_samples "opengl_interop")
  20. endif()
  21. foreach(sample_filename ${all_samples})
  22. ocv_define_sample(tgt ${sample_filename} opengl)
  23. ocv_target_link_libraries(${tgt} PRIVATE "${OPENGL_LIBRARIES}" "${OPENCV_OPENGL_SAMPLES_REQUIRED_DEPS}")
  24. if(sample_filename STREQUAL "opengl_interop.cpp")
  25. ocv_target_link_libraries(${tgt} PRIVATE ${X11_LIBRARIES})
  26. ocv_target_include_directories(${tgt} ${X11_INCLUDE_DIR})
  27. endif()
  28. endforeach()
  29. endif()
  30. ocv_install_example_src(opengl *.cpp *.hpp CMakeLists.txt)