detect_wayland.cmake 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. # --- Wayland ---
  2. macro(ocv_wayland_generate protocol_file output_file)
  3. add_custom_command(OUTPUT ${output_file}.h
  4. COMMAND ${WAYLAND_SCANNER_EXECUTABLE} client-header < ${protocol_file} > ${output_file}.h
  5. DEPENDS ${protocol_file})
  6. add_custom_command(OUTPUT ${output_file}.c
  7. COMMAND ${WAYLAND_SCANNER_EXECUTABLE} private-code < ${protocol_file} > ${output_file}.c
  8. DEPENDS ${protocol_file})
  9. list(APPEND WAYLAND_PROTOCOL_SOURCES ${output_file}.h ${output_file}.c)
  10. endmacro()
  11. ocv_clear_vars(HAVE_WAYLAND_CLIENT HAVE_WAYLAND_CURSOR HAVE_XKBCOMMON HAVE_WAYLAND_PROTOCOLS HAVE_WAYLAND_EGL)
  12. if(WITH_WAYLAND)
  13. ocv_check_modules(WAYLAND_CLIENT wayland-client)
  14. if(WAYLAND_CLIENT_FOUND)
  15. set(HAVE_WAYLAND_CLIENT ON)
  16. endif()
  17. ocv_check_modules(WAYLAND_CURSOR wayland-cursor)
  18. if(WAYLAND_CURSOR_FOUND)
  19. set(HAVE_WAYLAND_CURSOR ON)
  20. endif()
  21. ocv_check_modules(XKBCOMMON xkbcommon)
  22. if(XKBCOMMON_FOUND)
  23. set(HAVE_XKBCOMMON ON)
  24. endif()
  25. ocv_check_modules(WAYLAND_PROTOCOLS wayland-protocols>=1.13)
  26. if(HAVE_WAYLAND_PROTOCOLS)
  27. pkg_get_variable(WAYLAND_PROTOCOLS_BASE wayland-protocols pkgdatadir)
  28. find_host_program(WAYLAND_SCANNER_EXECUTABLE NAMES wayland-scanner REQUIRED)
  29. endif()
  30. if(HAVE_WAYLAND_CLIENT AND HAVE_WAYLAND_CURSOR AND HAVE_XKBCOMMON AND HAVE_WAYLAND_PROTOCOLS)
  31. set(HAVE_WAYLAND TRUE)
  32. endif()
  33. # WAYLAND_EGL is option
  34. ocv_check_modules(WAYLAND_EGL wayland-egl)
  35. if(WAYLAND_EGL_FOUND)
  36. set(HAVE_WAYLAND_EGL ON)
  37. endif()
  38. endif()