From 4477453b6e87beb704978fe7b8a372dd642b5683 Mon Sep 17 00:00:00 2001 From: Hennadii Stepanov <32963518+hebasto@users.noreply.github.com> Date: Sun, 28 Apr 2024 08:54:26 +0100 Subject: [PATCH] cmake: Add `WITH_DBUS` option --- CMakeLists.txt | 3 +++ src/qt/CMakeLists.txt | 8 ++++++++ src/qt/notificator.cpp | 4 ---- src/qt/notificator.h | 4 ---- 4 files changed, 11 insertions(+), 8 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 7be4f351a1830..285376d971aab 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -153,6 +153,8 @@ if(WITH_QRENCODE) ) endif() +cmake_dependent_option(WITH_DBUS "Enable DBus support." ON "CMAKE_SYSTEM_NAME STREQUAL \"Linux\" AND BUILD_GUI" OFF) + option(MULTIPROCESS "Build multiprocess bitcoin-node, bitcoin-wallet, and bitcoin-gui executables in addition to monolithic bitcoind and bitcoin-qt executables. Requires libmultiprocess library. Experimental." OFF) if(MULTIPROCESS) find_package(Libmultiprocess CONFIG REQUIRED) @@ -618,6 +620,7 @@ message(" UPnP ................................ ${WITH_MINIUPNPC}") message(" ZeroMQ .............................. ${WITH_ZMQ}") message(" USDT tracing ........................ ${WITH_USDT}") message(" QR code (GUI) ....................... ${WITH_QRENCODE}") +message(" DBus (GUI, Linux only) .............. ${WITH_DBUS}") message("Tests:") message(" test_bitcoin ........................ ${BUILD_TESTS}") message(" test_bitcoin-qt ..................... ${BUILD_GUI_TESTS}") diff --git a/src/qt/CMakeLists.txt b/src/qt/CMakeLists.txt index 63a3212218945..722ad532109a2 100644 --- a/src/qt/CMakeLists.txt +++ b/src/qt/CMakeLists.txt @@ -6,6 +6,9 @@ set(qt_components Core Gui Widgets LinguistTools) if(ENABLE_WALLET) list(APPEND qt_components Network) endif() +if(WITH_DBUS) + list(APPEND qt_components DBus) +endif() if(BUILD_GUI_TESTS) list(APPEND qt_components Test) endif() @@ -174,6 +177,11 @@ if(ENABLE_WALLET) ) endif() +if(WITH_DBUS) + target_compile_definitions(bitcoinqt PRIVATE USE_DBUS) + target_link_libraries(bitcoinqt PRIVATE Qt5::DBus) +endif() + if(QT_IS_STATIC) # We want to define static plugins to link ourselves, thus preventing # automatic linking against a "sane" set of default static plugins. diff --git a/src/qt/notificator.cpp b/src/qt/notificator.cpp index 551c0ffd1372a..6eeb19cd20acd 100644 --- a/src/qt/notificator.cpp +++ b/src/qt/notificator.cpp @@ -2,10 +2,6 @@ // Distributed under the MIT software license, see the accompanying // file COPYING or http://www.opensource.org/licenses/mit-license.php. -#if defined(HAVE_CONFIG_H) -#include -#endif - #include #include diff --git a/src/qt/notificator.h b/src/qt/notificator.h index 1fd8181a22684..f72a859f89af4 100644 --- a/src/qt/notificator.h +++ b/src/qt/notificator.h @@ -5,10 +5,6 @@ #ifndef BITCOIN_QT_NOTIFICATOR_H #define BITCOIN_QT_NOTIFICATOR_H -#if defined(HAVE_CONFIG_H) -#include -#endif - #include #include