From 4436815d19035aaba79cb69b7e2d599ae286297d Mon Sep 17 00:00:00 2001 From: mid-kid Date: Thu, 12 Nov 2020 00:15:46 +0100 Subject: [PATCH] Build wayland suppport optionally --- external/CMakeLists.txt | 2 +- external/qt/CMakeLists.txt | 54 ++++++++++++++++++++++++++------------ external/qt/package.cmake | 6 +++-- options.cmake | 7 +++++ variables.cmake | 1 + 5 files changed, 50 insertions(+), 20 deletions(-) diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index 7cd03d6..dca143e 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -35,7 +35,7 @@ endif() add_checked_subdirectory(iconv) add_checked_subdirectory(jpeg) add_checked_subdirectory(lz4) -if (LINUX) +if (LINUX AND NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) add_checked_subdirectory(materialdecoration) endif() add_checked_subdirectory(minizip) diff --git a/external/qt/CMakeLists.txt b/external/qt/CMakeLists.txt index ab38c44..0aa22a5 100644 --- a/external/qt/CMakeLists.txt +++ b/external/qt/CMakeLists.txt @@ -113,16 +113,22 @@ else() ) endif() + if (Qt5WaylandClient_FOUND) + target_include_directories(external_qt SYSTEM + INTERFACE + ${qt_loc}/include/QtWaylandClient + ${qt_loc}/include/QtWaylandClient/${qt_version} + ${qt_loc}/include/QtWaylandClient/${qt_version}/QtWaylandClient + ) + endif() + if (LINUX) target_include_directories(external_qt SYSTEM INTERFACE ${qt_loc}/include/QtSvg ${qt_loc}/include/QtThemeSupport - ${qt_loc}/include/QtWaylandClient ${qt_loc}/include/QtThemeSupport/${qt_version} - ${qt_loc}/include/QtWaylandClient/${qt_version} ${qt_loc}/include/QtThemeSupport/${qt_version}/QtThemeSupport - ${qt_loc}/include/QtWaylandClient/${qt_version}/QtWaylandClient ) endif() @@ -151,10 +157,16 @@ else() ) endif() - if (LINUX) + if (Qt5WaylandClient_FOUND) target_compile_definitions(external_qt INTERFACE QT_WAYLANDCLIENT_LIB + ) + endif() + + if (LINUX) + target_compile_definitions(external_qt + INTERFACE QT_THEME_SUPPORT_LIB QT_SVG_LIB ) @@ -261,21 +273,29 @@ else() plugins/bearer/${qt_lib_prefix}qnmbearer ) endif() + set(qt_libs_waylandclient) + set(qt_libs_waylandclient_plugins) + if (Qt5WaylandClient_FOUND) + set(qt_libs_waylandclient lib/${qt_lib_prefix}Qt5WaylandClient) + set(qt_libs_waylandclient_plugins + plugins/wayland-decoration-client/${qt_lib_prefix}bradient + plugins/wayland-shell-integration/${qt_lib_prefix}ivi-shell + plugins/wayland-shell-integration/${qt_lib_prefix}wl-shell + plugins/wayland-shell-integration/${qt_lib_prefix}xdg-shell-v5 + plugins/wayland-shell-integration/${qt_lib_prefix}xdg-shell-v6 + plugins/wayland-shell-integration/${qt_lib_prefix}xdg-shell + plugins/wayland-graphics-integration-client/${qt_lib_prefix}qt-plugin-wayland-egl + plugins/wayland-graphics-integration-client/${qt_lib_prefix}drm-egl-server + plugins/wayland-graphics-integration-client/${qt_lib_prefix}dmabuf-server + plugins/wayland-graphics-integration-client/${qt_lib_prefix}shm-emulation-server + plugins/platforms/${qt_lib_prefix}qwayland-egl + plugins/platforms/${qt_lib_prefix}qwayland-generic + ) + endif() set(qt_libs plugins/platforminputcontexts/${qt_lib_prefix}composeplatforminputcontextplugin ${qt_libs_dbus_plugins} - plugins/wayland-decoration-client/${qt_lib_prefix}bradient - plugins/wayland-shell-integration/${qt_lib_prefix}ivi-shell - plugins/wayland-shell-integration/${qt_lib_prefix}wl-shell - plugins/wayland-shell-integration/${qt_lib_prefix}xdg-shell-v5 - plugins/wayland-shell-integration/${qt_lib_prefix}xdg-shell-v6 - plugins/wayland-shell-integration/${qt_lib_prefix}xdg-shell - plugins/wayland-graphics-integration-client/${qt_lib_prefix}qt-plugin-wayland-egl - plugins/wayland-graphics-integration-client/${qt_lib_prefix}drm-egl-server - plugins/wayland-graphics-integration-client/${qt_lib_prefix}dmabuf-server - plugins/wayland-graphics-integration-client/${qt_lib_prefix}shm-emulation-server - plugins/platforms/${qt_lib_prefix}qwayland-egl - plugins/platforms/${qt_lib_prefix}qwayland-generic + ${qt_libs_waylandclient_plugins} plugins/platforms/${qt_lib_prefix}qxcb plugins/imageformats/${qt_lib_prefix}qsvg plugins/iconengines/${qt_lib_prefix}qsvgicon @@ -287,7 +307,7 @@ else() ${qt_libs_dbus_support} plugins/bearer/${qt_lib_prefix}qgenericbearer ${qt_libs_dbus_bearers} - lib/${qt_lib_prefix}Qt5WaylandClient + ${qt_libs_waylandclient} lib/${qt_lib_prefix}Qt5ServiceSupport ${common_qt_libs} ${qt_libs_dbus} diff --git a/external/qt/package.cmake b/external/qt/package.cmake index 62d2a09..60d92cc 100644 --- a/external/qt/package.cmake +++ b/external/qt/package.cmake @@ -24,8 +24,10 @@ find_package(Qt5 COMPONENTS Core Gui Widgets Network REQUIRED) find_package(Qt5Gui COMPONENTS QWebpPlugin REQUIRED) if (LINUX) - find_package(Qt5 COMPONENTS WaylandClient REQUIRED) - find_package(Qt5 OPTIONAL_COMPONENTS XkbCommonSupport QUIET) + if (NOT DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) + find_package(Qt5 COMPONENTS WaylandClient REQUIRED) + find_package(Qt5 OPTIONAL_COMPONENTS XkbCommonSupport QUIET) + endif() if (NOT DESKTOP_APP_USE_PACKAGED OR DESKTOP_APP_USE_PACKAGED_LAZY_PLATFORMTHEMES) find_package(Qt5 COMPONENTS Svg REQUIRED) diff --git a/options.cmake b/options.cmake index 8d1c52b..89eea38 100644 --- a/options.cmake +++ b/options.cmake @@ -26,6 +26,13 @@ if (DESKTOP_APP_DISABLE_DBUS_INTEGRATION) ) endif() +if (DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION) + target_compile_definitions(common_options + INTERFACE + DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION + ) +endif() + if (DESKTOP_APP_DISABLE_WEBRTC_INTEGRATION) target_compile_definitions(common_options INTERFACE diff --git a/variables.cmake b/variables.cmake index 4431fba..c30a1ca 100644 --- a/variables.cmake +++ b/variables.cmake @@ -29,6 +29,7 @@ endif() option(DESKTOP_APP_LOTTIE_USE_CACHE "Use caching in lottie animations." ON) option(DESKTOP_APP_DISABLE_DBUS_INTEGRATION "Disable all code for D-Bus integration (Linux only)." OFF) +option(DESKTOP_APP_DISABLE_WAYLAND_INTEGRATION "Disable all code for Wayland integration (Linux only)." OFF) option(DESKTOP_APP_DISABLE_WEBRTC_INTEGRATION "Disable all code for WebRTC integration." OFF) option(DESKTOP_APP_USE_GLIBC_WRAPS "Use wraps for new GLIBC features." OFF) option(DESKTOP_APP_USE_PACKAGED "Find libraries using CMake instead of exact paths." ${no_special_target})