Wayland: Remove extra-cmake-modules dependency

Fixes #1774.
This commit is contained in:
Joel Winarske 2020-09-28 22:23:02 -07:00 committed by Emmanuel Gil Peyrot
parent 1353f37a51
commit 2747e47393
3 changed files with 45 additions and 37 deletions

4
.gitignore vendored
View File

@ -52,10 +52,6 @@ src/glfw_config.h
src/glfw3.pc src/glfw3.pc
src/glfw3Config.cmake src/glfw3Config.cmake
src/glfw3ConfigVersion.cmake src/glfw3ConfigVersion.cmake
src/wayland-pointer-constraints-unstable-v1-client-protocol.h
src/wayland-pointer-constraints-unstable-v1-protocol.c
src/wayland-relative-pointer-unstable-v1-client-protocol.h
src/wayland-relative-pointer-unstable-v1-protocol.c
# Compiled binaries # Compiled binaries
src/libglfw.so src/libglfw.so

View File

@ -191,20 +191,18 @@ endif()
# Use Wayland for window creation # Use Wayland for window creation
#-------------------------------------------------------------------- #--------------------------------------------------------------------
if (_GLFW_WAYLAND) if (_GLFW_WAYLAND)
find_package(ECM REQUIRED NO_MODULE)
list(APPEND CMAKE_MODULE_PATH "${ECM_MODULE_PATH}")
find_package(Wayland REQUIRED Client Cursor Egl) include(FindPkgConfig)
find_package(WaylandScanner REQUIRED) pkg_check_modules(Wayland REQUIRED
find_package(WaylandProtocols 1.15 REQUIRED) wayland-client>=0.2.7
wayland-cursor>=0.2.7
wayland-egl>=0.2.7
xkbcommon)
list(APPEND glfw_PKG_DEPS "wayland-client") list(APPEND glfw_PKG_DEPS "wayland-client")
list(APPEND glfw_INCLUDE_DIRS "${Wayland_INCLUDE_DIRS}") list(APPEND glfw_INCLUDE_DIRS "${Wayland_INCLUDE_DIRS}")
list(APPEND glfw_LIBRARIES "${Wayland_LIBRARIES}") list(APPEND glfw_LIBRARIES "${Wayland_LINK_LIBRARIES}")
find_package(XKBCommon REQUIRED)
list(APPEND glfw_INCLUDE_DIRS "${XKBCOMMON_INCLUDE_DIRS}")
include(CheckIncludeFiles) include(CheckIncludeFiles)
include(CheckFunctionExists) include(CheckFunctionExists)

View File

@ -45,30 +45,44 @@ if (_GLFW_X11 OR _GLFW_WAYLAND)
endif() endif()
if (_GLFW_WAYLAND) if (_GLFW_WAYLAND)
ecm_add_wayland_client_protocol(GLFW_WAYLAND_PROTOCOL_SOURCES find_program(WAYLAND_SCANNER_EXECUTABLE NAMES wayland-scanner)
PROTOCOL pkg_check_modules(WAYLAND_PROTOCOLS REQUIRED wayland-protocols>=1.15)
"${WAYLAND_PROTOCOLS_PKGDATADIR}/stable/xdg-shell/xdg-shell.xml" pkg_get_variable(WAYLAND_PROTOCOLS_BASE wayland-protocols pkgdatadir)
BASENAME xdg-shell)
ecm_add_wayland_client_protocol(GLFW_WAYLAND_PROTOCOL_SOURCES macro(wayland_generate protocol_file output_file)
PROTOCOL add_custom_command(OUTPUT ${output_file}.h
"${WAYLAND_PROTOCOLS_PKGDATADIR}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml" COMMAND ${WAYLAND_SCANNER_EXECUTABLE} client-header
BASENAME xdg-decoration) < ${protocol_file} > ${output_file}.h
ecm_add_wayland_client_protocol(GLFW_WAYLAND_PROTOCOL_SOURCES DEPENDS ${protocol_file})
PROTOCOL list(APPEND GLFW_WAYLAND_PROTOCOL_SOURCES ${output_file}.h)
"${WAYLAND_PROTOCOLS_PKGDATADIR}/stable/viewporter/viewporter.xml"
BASENAME viewporter) add_custom_command(OUTPUT ${output_file}.c
ecm_add_wayland_client_protocol(GLFW_WAYLAND_PROTOCOL_SOURCES COMMAND ${WAYLAND_SCANNER_EXECUTABLE} private-code
PROTOCOL < ${protocol_file} > ${output_file}.c
"${WAYLAND_PROTOCOLS_PKGDATADIR}/unstable/relative-pointer/relative-pointer-unstable-v1.xml" DEPENDS ${protocol_file})
BASENAME relative-pointer-unstable-v1) list(APPEND GLFW_WAYLAND_PROTOCOL_SOURCES ${output_file}.c)
ecm_add_wayland_client_protocol(GLFW_WAYLAND_PROTOCOL_SOURCES endmacro()
PROTOCOL
"${WAYLAND_PROTOCOLS_PKGDATADIR}/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml" set(GLFW_WAYLAND_PROTOCOL_SOURCES)
BASENAME pointer-constraints-unstable-v1) wayland_generate(
ecm_add_wayland_client_protocol(GLFW_WAYLAND_PROTOCOL_SOURCES ${WAYLAND_PROTOCOLS_BASE}/stable/xdg-shell/xdg-shell.xml
PROTOCOL ${CMAKE_BINARY_DIR}/src/wayland-xdg-shell-client-protocol)
"${WAYLAND_PROTOCOLS_PKGDATADIR}/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml" wayland_generate(
BASENAME idle-inhibit-unstable-v1) ${WAYLAND_PROTOCOLS_BASE}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml
${CMAKE_BINARY_DIR}/src/wayland-xdg-decoration-client-protocol)
wayland_generate(
${WAYLAND_PROTOCOLS_BASE}/stable/viewporter/viewporter.xml
${CMAKE_BINARY_DIR}/src/wayland-viewporter-client-protocol)
wayland_generate(
${WAYLAND_PROTOCOLS_BASE}/unstable/relative-pointer/relative-pointer-unstable-v1.xml
${CMAKE_BINARY_DIR}/src/wayland-relative-pointer-unstable-v1-client-protocol)
wayland_generate(
${WAYLAND_PROTOCOLS_BASE}/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml
${CMAKE_BINARY_DIR}/src/wayland-pointer-constraints-unstable-v1-client-protocol)
wayland_generate(
${WAYLAND_PROTOCOLS_BASE}/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml
${CMAKE_BINARY_DIR}/src/wayland-idle-inhibit-unstable-v1-client-protocol)
target_sources(glfw PRIVATE ${GLFW_WAYLAND_PROTOCOL_SOURCES}) target_sources(glfw PRIVATE ${GLFW_WAYLAND_PROTOCOL_SOURCES})
endif() endif()