From 280a82844fdae43b78bc438abe6cb009dadf0838 Mon Sep 17 00:00:00 2001 From: Vlad Zagorodniy Date: Sun, 30 Jun 2019 00:13:46 +0300 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 --- src/wayland/CMakeLists.txt | 18 +++--- .../cmake/Modules/FindWaylandProtocols.cmake | 60 +++++++++++++++++++ 2 files changed, 69 insertions(+), 9 deletions(-) create mode 100644 src/wayland/cmake/Modules/FindWaylandProtocols.cmake diff --git a/src/wayland/CMakeLists.txt b/src/wayland/CMakeLists.txt index c8860c3c71..3263108672 100644 --- a/src/wayland/CMakeLists.txt +++ b/src/wayland/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 ) diff --git a/src/wayland/cmake/Modules/FindWaylandProtocols.cmake b/src/wayland/cmake/Modules/FindWaylandProtocols.cmake new file mode 100644 index 0000000000..a3879d3cb0 --- /dev/null +++ b/src/wayland/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/" +)