From ed0138f2f56d3cc0e523f10c3a9180d3119fc8f0 Mon Sep 17 00:00:00 2001 From: Vlad Zagorodniy Date: Mon, 8 Jul 2019 00:05:53 +0200 Subject: [PATCH] Use wayland-protocols Summary: So far we've been copying protocol specifications from wayland-protocols repo to kwayland repo. The main issue with copying is that we have to keep xml files in sync manually. A better approach would be to use xml specs straight from wayland-protocols package. Test Plan: Compiles. Reviewers: #kwin, #frameworks, romangg, davidedmundson Reviewed By: #kwin, romangg, davidedmundson Subscribers: davidedmundson, apol, romangg, asturmlechner, kde-frameworks-devel Tags: #frameworks Differential Revision: https://phabricator.kde.org/D22216 --- CMakeLists.txt | 7 ++- cmake/Modules/FindWaylandProtocols.cmake | 60 ++++++++++++++++++++++++ src/client/CMakeLists.txt | 18 +++---- src/server/CMakeLists.txt | 18 +++---- 4 files changed, 83 insertions(+), 20 deletions(-) create mode 100644 cmake/Modules/FindWaylandProtocols.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 480d2d0..5d3e468 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -8,7 +8,7 @@ include(FeatureSummary) find_package(ECM 5.59.0 NO_MODULE) set_package_properties(ECM PROPERTIES TYPE REQUIRED DESCRIPTION "Extra CMake Modules." URL "https://projects.kde.org/projects/kdesupport/extra-cmake-modules") feature_summary(WHAT REQUIRED_PACKAGES_NOT_FOUND FATAL_ON_MISSING_REQUIRED_PACKAGES) -set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR}) +set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_SOURCE_DIR}/cmake/Modules) include(FeatureSummary) include(GenerateExportHeader) @@ -33,13 +33,16 @@ ecm_setup_version(PROJECT VARIABLE_PREFIX KWAYLAND set(REQUIRED_QT_VERSION 5.10.0) find_package(Qt5 ${REQUIRED_QT_VERSION} CONFIG REQUIRED Concurrent Gui) -find_package(Wayland 1.13 COMPONENTS Client Server) +find_package(Wayland 1.15 COMPONENTS Client Server) set_package_properties(Wayland PROPERTIES TYPE REQUIRED ) find_package(WaylandScanner) +find_package(WaylandProtocols 1.15) +set_package_properties(WaylandProtocols PROPERTIES TYPE REQUIRED) + find_package(EGL) set_package_properties(EGL PROPERTIES TYPE REQUIRED) diff --git a/cmake/Modules/FindWaylandProtocols.cmake b/cmake/Modules/FindWaylandProtocols.cmake new file mode 100644 index 0000000..a3879d3 --- /dev/null +++ b/cmake/Modules/FindWaylandProtocols.cmake @@ -0,0 +1,60 @@ +#.rst: +# FindWaylandProtocols +# ------- +# +# Try to find wayland-protocols on a Unix system. +# +# This will define the following variables: +# +# ``WaylandProtocols_FOUND`` +# True if (the requested version of) wayland-protocols is available +# ``WaylandProtocols_VERSION`` +# The version of wayland-protocols +# ``WaylandProtocols_DATADIR`` +# The wayland protocols data directory + +#============================================================================= +# Copyright 2019 Vlad Zagorodniy +# +# Redistribution and use in source and binary forms, with or without +# modification, are permitted provided that the following conditions +# are met: +# +# 1. Redistributions of source code must retain the copyright +# notice, this list of conditions and the following disclaimer. +# 2. Redistributions in binary form must reproduce the copyright +# notice, this list of conditions and the following disclaimer in the +# documentation and/or other materials provided with the distribution. +# 3. The name of the author may not be used to endorse or promote products +# derived from this software without specific prior written permission. +# +# THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR +# IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +# OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. +# IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT, +# INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT +# NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, +# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY +# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT +# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF +# THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. +#============================================================================= + +find_package(PkgConfig) +pkg_check_modules(PKG_wayland_protocols QUIET wayland-protocols) + +set(WaylandProtocols_VERSION ${PKG_wayland_protocols_VERSION}) +pkg_get_variable(WaylandProtocols_DATADIR wayland-protocols pkgdatadir) + +include(FindPackageHandleStandardArgs) +find_package_handle_standard_args(WaylandProtocols + FOUND_VAR WaylandProtocols_FOUND + REQUIRED_VARS WaylandProtocols_DATADIR + VERSION_VAR WaylandProtocols_VERSION +) + +include(FeatureSummary) +set_package_properties(WaylandProtocols PROPERTIES + DESCRIPTION "Specifications of extended Wayland protocols" + URL "https://wayland.freedesktop.org/" +) diff --git a/src/client/CMakeLists.txt b/src/client/CMakeLists.txt index e50d5c4..d3aa7a3 100644 --- a/src/client/CMakeLists.txt +++ b/src/client/CMakeLists.txt @@ -143,27 +143,27 @@ ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS BASENAME text-input-v2 ) ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS - PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/xdg-shell-unstable-v6.xml + PROTOCOL ${WaylandProtocols_DATADIR}/unstable/xdg-shell/xdg-shell-unstable-v6.xml BASENAME xdg-shell-v6 ) ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS - PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/relative-pointer-unstable-v1.xml + PROTOCOL ${WaylandProtocols_DATADIR}/unstable/relative-pointer/relative-pointer-unstable-v1.xml BASENAME relativepointer-unstable-v1 ) ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS - PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/pointer-gestures-unstable-v1.xml + PROTOCOL ${WaylandProtocols_DATADIR}/unstable/pointer-gestures/pointer-gestures-unstable-v1.xml BASENAME pointer-gestures-unstable-v1 ) ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS - PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/pointer-constraints-unstable-v1.xml + PROTOCOL ${WaylandProtocols_DATADIR}/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml BASENAME pointer-constraints-unstable-v1 ) ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS - PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/xdg-foreign-unstable-v2.xml + PROTOCOL ${WaylandProtocols_DATADIR}/unstable/xdg-foreign/xdg-foreign-unstable-v2.xml BASENAME xdg-foreign-unstable-v2 ) ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS - PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/idle-inhibit-unstable-v1.xml + PROTOCOL ${WaylandProtocols_DATADIR}/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml BASENAME idle-inhibit-unstable-v1 ) ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS @@ -176,17 +176,17 @@ ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS ) ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS - PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/xdg-output-unstable-v1.xml + PROTOCOL ${WaylandProtocols_DATADIR}/unstable/xdg-output/xdg-output-unstable-v1.xml BASENAME xdg-output-unstable-v1 ) ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS - PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/xdg-shell.xml + PROTOCOL ${WaylandProtocols_DATADIR}/stable/xdg-shell/xdg-shell.xml BASENAME xdg-shell ) ecm_add_wayland_client_protocol(CLIENT_LIB_SRCS - PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/xdg-decoration-unstable-v1.xml + PROTOCOL ${WaylandProtocols_DATADIR}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml BASENAME xdg-decoration-unstable-v1 ) diff --git a/src/server/CMakeLists.txt b/src/server/CMakeLists.txt index c8860c3..3263108 100644 --- a/src/server/CMakeLists.txt +++ b/src/server/CMakeLists.txt @@ -125,7 +125,7 @@ ecm_add_wayland_server_protocol(SERVER_LIB_SRCS ) ecm_add_wayland_server_protocol(SERVER_LIB_SRCS - PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/relative-pointer-unstable-v1.xml + PROTOCOL ${WaylandProtocols_DATADIR}/unstable/relative-pointer/relative-pointer-unstable-v1.xml BASENAME relativepointer-unstable-v1 ) @@ -150,27 +150,27 @@ ecm_add_wayland_server_protocol(SERVER_LIB_SRCS ) ecm_add_wayland_server_protocol(SERVER_LIB_SRCS - PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/xdg-shell-unstable-v6.xml + PROTOCOL ${WaylandProtocols_DATADIR}/unstable/xdg-shell/xdg-shell-unstable-v6.xml BASENAME xdg-shell-v6 ) ecm_add_wayland_server_protocol(SERVER_LIB_SRCS - PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/pointer-gestures-unstable-v1.xml + PROTOCOL ${WaylandProtocols_DATADIR}/unstable/pointer-gestures/pointer-gestures-unstable-v1.xml BASENAME pointer-gestures-unstable-v1 ) ecm_add_wayland_server_protocol(SERVER_LIB_SRCS - PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/pointer-constraints-unstable-v1.xml + PROTOCOL ${WaylandProtocols_DATADIR}/unstable/pointer-constraints/pointer-constraints-unstable-v1.xml BASENAME pointer-constraints-unstable-v1 ) ecm_add_wayland_server_protocol(SERVER_LIB_SRCS - PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/xdg-foreign-unstable-v2.xml + PROTOCOL ${WaylandProtocols_DATADIR}/unstable/xdg-foreign/xdg-foreign-unstable-v2.xml BASENAME xdg-foreign-unstable-v2 ) ecm_add_wayland_server_protocol(SERVER_LIB_SRCS - PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/idle-inhibit-unstable-v1.xml + PROTOCOL ${WaylandProtocols_DATADIR}/unstable/idle-inhibit/idle-inhibit-unstable-v1.xml BASENAME idle-inhibit-unstable-v1 ) @@ -190,17 +190,17 @@ ecm_add_wayland_server_protocol(SERVER_LIB_SRCS ) ecm_add_wayland_server_protocol(SERVER_LIB_SRCS - PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/xdg-output-unstable-v1.xml + PROTOCOL ${WaylandProtocols_DATADIR}/unstable/xdg-output/xdg-output-unstable-v1.xml BASENAME xdg-output ) ecm_add_wayland_server_protocol(SERVER_LIB_SRCS - PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/xdg-shell.xml + PROTOCOL ${WaylandProtocols_DATADIR}/stable/xdg-shell/xdg-shell.xml BASENAME xdg-shell ) ecm_add_wayland_server_protocol(SERVER_LIB_SRCS - PROTOCOL ${KWayland_SOURCE_DIR}/src/client/protocols/xdg-decoration-unstable-v1.xml + PROTOCOL ${WaylandProtocols_DATADIR}/unstable/xdg-decoration/xdg-decoration-unstable-v1.xml BASENAME xdg-decoration ) -- 2.22.0