0001-Wayland-Remove-extra-cmake-modules-dependency.patch 5.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. From 8ebf1067390948d03330a5a0c814e5f7f860e678 Mon Sep 17 00:00:00 2001
  2. From: Joel Winarske <joel.winarske@gmail.com>
  3. Date: Mon, 28 Sep 2020 22:23:02 -0700
  4. Subject: [PATCH] Wayland: Remove extra-cmake-modules dependency
  5. Fixes #1774.
  6. [Retrieved (and backported) from:
  7. https://github.com/glfw/glfw/commit/2747e47393cbca2d09db56223e735bd94b21e2eb]
  8. Signed-off-by: Fabrice Fontaine <fontaine.fabrice@gmail.com>
  9. [Dario: make the patch to be applied with fuzz factor 0 dropping all Hunks]
  10. Signed-off-by: Dario Binacchi <dario.binacchi@amarulasolutions.com>
  11. ---
  12. CMakeLists.txt | 16 ++++++------
  13. src/CMakeLists.txt | 62 ++++++++++++++++++++++++++++------------------
  14. 2 files changed, 45 insertions(+), 33 deletions(-)
  15. diff --git a/CMakeLists.txt b/CMakeLists.txt
  16. index 75069161fc36..b315eaa15305 100644
  17. --- a/CMakeLists.txt
  18. +++ b/CMakeLists.txt
  19. @@ -249,20 +249,18 @@ endif()
  20. # Use Wayland for window creation
  21. #--------------------------------------------------------------------
  22. if (_GLFW_WAYLAND)
  23. - find_package(ECM REQUIRED NO_MODULE)
  24. - list(APPEND CMAKE_MODULE_PATH "${ECM_MODULE_PATH}")
  25. - find_package(Wayland REQUIRED Client Cursor Egl)
  26. - find_package(WaylandScanner REQUIRED)
  27. - find_package(WaylandProtocols 1.15 REQUIRED)
  28. + include(FindPkgConfig)
  29. + pkg_check_modules(Wayland REQUIRED
  30. + wayland-client>=0.2.7
  31. + wayland-cursor>=0.2.7
  32. + wayland-egl>=0.2.7
  33. + xkbcommon)
  34. list(APPEND glfw_PKG_DEPS "wayland-client")
  35. list(APPEND glfw_INCLUDE_DIRS "${Wayland_INCLUDE_DIRS}")
  36. - list(APPEND glfw_LIBRARIES "${Wayland_LIBRARIES}" "${CMAKE_THREAD_LIBS_INIT}")
  37. -
  38. - find_package(XKBCommon REQUIRED)
  39. - list(APPEND glfw_INCLUDE_DIRS "${XKBCOMMON_INCLUDE_DIRS}")
  40. + list(APPEND glfw_LIBRARIES "${Wayland_LINK_LIBRARIES}" "${CMAKE_THREAD_LIBS_INIT}")
  41. include(CheckIncludeFiles)
  42. include(CheckFunctionExists)
  43. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
  44. index b6dd86c54512..29be6515ae58 100644
  45. --- a/src/CMakeLists.txt
  46. +++ b/src/CMakeLists.txt
  47. @@ -40,30 +40,44 @@ elseif (_GLFW_WAYLAND)
  48. posix_time.c posix_thread.c xkb_unicode.c
  49. egl_context.c osmesa_context.c)
  50. - ecm_add_wayland_client_protocol(glfw_SOURCES
  51. - PROTOCOL
  52. - "${WAYLAND_PROTOCOLS_PKGDATADIR}/stable/xdg-shell/xdg-shell.xml"
  53. - BASENAME xdg-shell)
  54. - ecm_add_wayland_client_protocol(glfw_SOURCES
  55. - PROTOCOL
  56. - "${WAYLAND_PROTOCOLS_PKGDATADIR}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml"
  57. - BASENAME xdg-decoration)
  58. - ecm_add_wayland_client_protocol(glfw_SOURCES
  59. - PROTOCOL
  60. - "${WAYLAND_PROTOCOLS_PKGDATADIR}/stable/viewporter/viewporter.xml"
  61. - BASENAME viewporter)
  62. - ecm_add_wayland_client_protocol(glfw_SOURCES
  63. - PROTOCOL
  64. - "${WAYLAND_PROTOCOLS_PKGDATADIR}/unstable/relative-pointer/relative-pointer-unstable-v1.xml"
  65. - BASENAME relative-pointer-unstable-v1)
  66. - ecm_add_wayland_client_protocol(glfw_SOURCES
  67. - PROTOCOL
  68. - "${WAYLAND_PROTOCOLS_PKGDATADIR}/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml"
  69. - BASENAME pointer-constraints-unstable-v1)
  70. - ecm_add_wayland_client_protocol(glfw_SOURCES
  71. - PROTOCOL
  72. - "${WAYLAND_PROTOCOLS_PKGDATADIR}/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml"
  73. - BASENAME idle-inhibit-unstable-v1)
  74. + find_program(WAYLAND_SCANNER_EXECUTABLE NAMES wayland-scanner)
  75. + pkg_check_modules(WAYLAND_PROTOCOLS REQUIRED wayland-protocols>=1.15)
  76. + pkg_get_variable(WAYLAND_PROTOCOLS_BASE wayland-protocols pkgdatadir)
  77. +
  78. + macro(wayland_generate protocol_file output_file)
  79. + add_custom_command(OUTPUT ${output_file}.h
  80. + COMMAND ${WAYLAND_SCANNER_EXECUTABLE} client-header
  81. + < ${protocol_file} > ${output_file}.h
  82. + DEPENDS ${protocol_file})
  83. + list(APPEND glfw_SOURCES ${output_file}.h)
  84. +
  85. + add_custom_command(OUTPUT ${output_file}.c
  86. + COMMAND ${WAYLAND_SCANNER_EXECUTABLE} private-code
  87. + < ${protocol_file} > ${output_file}.c
  88. + DEPENDS ${protocol_file})
  89. + list(APPEND glfw_SOURCES ${output_file}.c)
  90. + endmacro()
  91. +
  92. + set(GLFW_WAYLAND_PROTOCOL_SOURCES)
  93. + wayland_generate(
  94. + ${WAYLAND_PROTOCOLS_BASE}/stable/xdg-shell/xdg-shell.xml
  95. + ${CMAKE_BINARY_DIR}/src/wayland-xdg-shell-client-protocol)
  96. + wayland_generate(
  97. + ${WAYLAND_PROTOCOLS_BASE}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml
  98. + ${CMAKE_BINARY_DIR}/src/wayland-xdg-decoration-client-protocol)
  99. + wayland_generate(
  100. + ${WAYLAND_PROTOCOLS_BASE}/stable/viewporter/viewporter.xml
  101. + ${CMAKE_BINARY_DIR}/src/wayland-viewporter-client-protocol)
  102. + wayland_generate(
  103. + ${WAYLAND_PROTOCOLS_BASE}/unstable/relative-pointer/relative-pointer-unstable-v1.xml
  104. + ${CMAKE_BINARY_DIR}/src/wayland-relative-pointer-unstable-v1-client-protocol)
  105. + wayland_generate(
  106. + ${WAYLAND_PROTOCOLS_BASE}/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml
  107. + ${CMAKE_BINARY_DIR}/src/wayland-pointer-constraints-unstable-v1-client-protocol)
  108. + wayland_generate(
  109. + ${WAYLAND_PROTOCOLS_BASE}/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml
  110. + ${CMAKE_BINARY_DIR}/src/wayland-idle-inhibit-unstable-v1-client-protocol)
  111. +
  112. elseif (_GLFW_OSMESA)
  113. set(glfw_HEADERS ${common_HEADERS} null_platform.h null_joystick.h
  114. posix_time.h posix_thread.h osmesa_context.h)
  115. --
  116. 2.43.0