From 99278254e352029ce36dc7b597b346b245d9860c Mon Sep 17 00:00:00 2001 From: Ilya Fedin Date: Sun, 16 Feb 2020 13:26:34 +0400 Subject: [PATCH] Move TDESKTOP_DISABLE_DBUS_INTEGRATION to cmake_helpers --- external/CMakeLists.txt | 4 ++-- external/dbusmenu_qt/CMakeLists.txt | 7 ++----- external/qt/CMakeLists.txt | 11 ++++++----- external/qt/package.cmake | 6 +++++- variables.cmake | 1 + 5 files changed, 16 insertions(+), 13 deletions(-) diff --git a/external/CMakeLists.txt b/external/CMakeLists.txt index b52e2cd..ac08574 100644 --- a/external/CMakeLists.txt +++ b/external/CMakeLists.txt @@ -6,7 +6,7 @@ add_subdirectory(auto_updates) add_subdirectory(crash_reports) -if (LINUX) +if (LINUX AND NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION) add_subdirectory(dbusmenu_qt) endif() add_subdirectory(expected) @@ -24,7 +24,7 @@ add_subdirectory(rlottie) if (APPLE) add_subdirectory(sp_media_key_tap) endif() -if (LINUX) +if (LINUX AND NOT DESKTOP_APP_DISABLE_DBUS_INTEGRATION) add_subdirectory(statusnotifieritem) endif() add_subdirectory(variant) diff --git a/external/dbusmenu_qt/CMakeLists.txt b/external/dbusmenu_qt/CMakeLists.txt index 4a977c1..4ed273f 100644 --- a/external/dbusmenu_qt/CMakeLists.txt +++ b/external/dbusmenu_qt/CMakeLists.txt @@ -8,11 +8,8 @@ if (DESKTOP_APP_USE_PACKAGED) add_library(external_dbusmenu_qt INTERFACE IMPORTED GLOBAL) add_library(desktop-app::external_dbusmenu_qt ALIAS external_dbusmenu_qt) - find_package(dbusmenu-qt5) - - if (dbusmenu-qt5_FOUND) - target_link_libraries(external_dbusmenu_qt INTERFACE dbusmenu-qt5) - endif() + find_package(dbusmenu-qt5 REQUIRED) + target_link_libraries(external_dbusmenu_qt INTERFACE dbusmenu-qt5) else() add_library(external_dbusmenu_qt OBJECT) add_library(desktop-app::external_dbusmenu_qt ALIAS external_dbusmenu_qt) diff --git a/external/qt/CMakeLists.txt b/external/qt/CMakeLists.txt index 11ba9a6..59f3094 100644 --- a/external/qt/CMakeLists.txt +++ b/external/qt/CMakeLists.txt @@ -141,8 +141,13 @@ else() cups ) else() + set(qt_libs_dbus) + set(qt_libs_dbus_support) + set(qt_libs_dbus_plugins) + set(qt_libs_dbus_bearers) if (Qt5DBus_FOUND) set(qt_libs_dbus lib/${qt_lib_prefix}Qt5DBus) + set(qt_libs_dbus_support lib/${qt_lib_prefix}Qt5LinuxAccessibilitySupport) set(qt_libs_dbus_plugins plugins/platforminputcontexts/${qt_lib_prefix}ibusplatforminputcontextplugin plugins/platforminputcontexts/${qt_lib_prefix}fcitxplatforminputcontextplugin @@ -161,9 +166,9 @@ else() plugins/platforms/${qt_lib_prefix}qxcb plugins/iconengines/${qt_lib_prefix}qsvgicon lib/${qt_lib_prefix}Qt5XcbQpa - lib/${qt_lib_prefix}Qt5LinuxAccessibilitySupport lib/${qt_lib_prefix}Qt5ServiceSupport lib/${qt_lib_prefix}Qt5EdidSupport + ${qt_libs_dbus_support} plugins/bearer/${qt_lib_prefix}qgenericbearer ${qt_libs_dbus_bearers} ${common_qt_libs} @@ -247,9 +252,5 @@ else() glib-2.0 pthread ) - find_library(DBUS_LIBRARY dbus-1) - if (Qt5DBus_FOUND AND DBUS_LIBRARY) - target_link_libraries(external_qt INTERFACE dbus-1) - endif() endif() endif() diff --git a/external/qt/package.cmake b/external/qt/package.cmake index ab9e0ac..1ab5d41 100644 --- a/external/qt/package.cmake +++ b/external/qt/package.cmake @@ -27,7 +27,11 @@ if (LINUX) find_package(Qt5 COMPONENTS Svg REQUIRED) endif() - find_package(Qt5 COMPONENTS DBus) + if (DESKTOP_APP_DISABLE_DBUS_INTEGRATION) + find_package(Qt5 COMPONENTS DBus) + else() + find_package(Qt5 COMPONENTS DBus REQUIRED) + endif() endif() set_property(GLOBAL PROPERTY AUTOGEN_SOURCE_GROUP "(gen)") diff --git a/variables.cmake b/variables.cmake index 6d7d2f0..8d8e71c 100644 --- a/variables.cmake +++ b/variables.cmake @@ -5,6 +5,7 @@ # https://github.com/desktop-app/legal/blob/master/LEGAL 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_USE_GLIBC_WRAPS "Use wraps for new GLIBC features." OFF) if (LINUX AND NOT DESKTOP_APP_SPECIAL_TARGET STREQUAL "")