diff options
author | Robert Griebl <robert.griebl@qt.io> | 2021-06-16 03:44:22 +0200 |
---|---|---|
committer | Qt Cherry-pick Bot <cherrypick_bot@qt-project.org> | 2021-06-16 14:27:16 +0000 |
commit | bbdb0ed116d0bb9818aee963589ffcb9e7e2f59b (patch) | |
tree | 0ddd01d3770834a88fe1cf165f2f7eea92f044b9 | |
parent | 2f22843cb540590afbfafc0bc4825a43b2104310 (diff) | |
download | qtwayland-bbdb0ed116d0bb9818aee963589ffcb9e7e2f59b.tar.gz |
cmake: be more flexible when creating Wayland client and server extension headers
This was hardcoded to QtWaylandClient/QtWaylandServer for cmake, while $$MODULE_INCNAME
was used in the old qmake world.
(this is an update to the previous commit, fixing the client side of things, plus adding
an override for both)
The header location will now default to the current Qt modules private include
dir (as it was in qmake times), but we now also have the ability to override
this default via WAYLAND_INCLUDE_DIR to deal with special cases like the
WlShellExtension (which is an own Qt private module itself)
Change-Id: I4e96578a9a00598c236fcd22a460aeca4984baeb
Reviewed-by: Dominik Holland <dominik.holland@qt.io>
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
(cherry picked from commit 0c93bfd8679319cc906544141287c0e973b8555d)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
-rw-r--r-- | src/client/Qt6WaylandClientMacros.cmake | 16 | ||||
-rw-r--r-- | src/compositor/Qt6WaylandCompositorMacros.cmake | 19 | ||||
-rw-r--r-- | src/plugins/shellintegration/wl-shell/CMakeLists.txt | 2 |
3 files changed, 24 insertions, 13 deletions
diff --git a/src/client/Qt6WaylandClientMacros.cmake b/src/client/Qt6WaylandClientMacros.cmake index 5eab19d8..6bda08e7 100644 --- a/src/client/Qt6WaylandClientMacros.cmake +++ b/src/client/Qt6WaylandClientMacros.cmake @@ -1,5 +1,5 @@ function(qt6_generate_wayland_protocol_client_sources target) - cmake_parse_arguments(arg "" "" "FILES" ${ARGN}) + cmake_parse_arguments(arg "" "WAYLAND_INCLUDE_DIR" "FILES" ${ARGN}) if(DEFINED arg_UNPARSED_ARGUMENTS) message(FATAL_ERROR "Unknown arguments were passed to qt6_generate_wayland_protocol_client_sources: (${arg_UNPARSED_ARGUMENTS}).") endif() @@ -34,11 +34,17 @@ function(qt6_generate_wayland_protocol_client_sources target) COMMAND Wayland::Scanner --strict --include-core-only public-code < "${protocol_file}" > "${waylandscanner_code_output}" ) - # TODO: Make this less hacky set(wayland_include_dir "") - get_target_property(is_for_module "${target}" INTERFACE_MODULE_HAS_HEADERS) - if (is_for_module) - set(wayland_include_dir "QtWaylandClient/private") + if(arg_WAYLAND_INCLUDE_DIR) + set(wayland_include_dir "${arg_WAYLAND_INCLUDE_DIR}") + else() + get_target_property(qt_module ${target} _qt_module_interface_name) + get_target_property(is_for_module "${target}" INTERFACE_MODULE_HAS_HEADERS) + if (qt_module) + set(wayland_include_dir "Qt${qt_module}/private") + elseif (is_for_module) + set(wayland_include_dir "QtWaylandClient/private") + endif() endif() add_custom_command( diff --git a/src/compositor/Qt6WaylandCompositorMacros.cmake b/src/compositor/Qt6WaylandCompositorMacros.cmake index b8771b95..3fb08b3a 100644 --- a/src/compositor/Qt6WaylandCompositorMacros.cmake +++ b/src/compositor/Qt6WaylandCompositorMacros.cmake @@ -1,5 +1,5 @@ function(qt6_generate_wayland_protocol_server_sources target) - cmake_parse_arguments(arg "" "" "FILES" ${ARGN}) + cmake_parse_arguments(arg "" "WAYLAND_INCLUDE_DIR" "FILES" ${ARGN}) if(DEFINED arg_UNPARSED_ARGUMENTS) message(FATAL_ERROR "Unknown arguments were passed to qt6_generate_wayland_protocol_server_sources: (${arg_UNPARSED_ARGUMENTS}).") endif() @@ -32,14 +32,17 @@ function(qt6_generate_wayland_protocol_server_sources target) COMMAND Wayland::Scanner --strict --include-core-only public-code < "${protocol_file}" > "${waylandscanner_code_output}" ) - # TODO: make this less hacky set(wayland_include_dir "") - get_target_property(qt_module ${target} _qt_module_interface_name) - get_target_property(is_for_module "${target}" INTERFACE_MODULE_HAS_HEADERS) - if (qt_module) - set(wayland_include_dir "Qt${qt_module}/private") - elseif (is_for_module) - set(wayland_include_dir "QtWaylandCompositor/private") + if(arg_WAYLAND_INCLUDE_DIR) + set(wayland_include_dir "${arg_WAYLAND_INCLUDE_DIR}") + else() + get_target_property(qt_module ${target} _qt_module_interface_name) + get_target_property(is_for_module "${target}" INTERFACE_MODULE_HAS_HEADERS) + if (qt_module) + set(wayland_include_dir "Qt${qt_module}/private") + elseif (is_for_module) + set(wayland_include_dir "QtWaylandCompositor/private") + endif() endif() add_custom_command( diff --git a/src/plugins/shellintegration/wl-shell/CMakeLists.txt b/src/plugins/shellintegration/wl-shell/CMakeLists.txt index 0a0a83d1..d7c052fa 100644 --- a/src/plugins/shellintegration/wl-shell/CMakeLists.txt +++ b/src/plugins/shellintegration/wl-shell/CMakeLists.txt @@ -17,6 +17,8 @@ qt_internal_add_module(WlShellIntegrationPrivate ) qt6_generate_wayland_protocol_client_sources(WlShellIntegrationPrivate + # this is just a helper module and still part of the QtWaylandClient build + WAYLAND_INCLUDE_DIR QtWaylandClient/private FILES ${CMAKE_CURRENT_SOURCE_DIR}/../../../3rdparty/protocol/wayland.xml ) |