diff --git a/CMakeLists.txt b/CMakeLists.txt --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -19,6 +19,7 @@ option(DESKTOP_ENABLED "Build and install The Desktop style" ON) option(STATIC_LIBRARY "Build as a static library (deprecated, use BUILD_SHARED_LIBS instead)" OFF) option(BUILD_EXAMPLES "Build and install examples" OFF) +option(DISABLE_DBUS "Build without D-Bus support" OFF) if(NOT BUILD_SHARED_LIBS) set(STATIC_LIBRARY 1) @@ -100,8 +101,10 @@ ) #use dbus on linux, bsd etc, but not andoid and apple stuff -if (UNIX AND NOT CMAKE_SYSTEM_NAME STREQUAL "Android" AND NOT(APPLE)) +if (UNIX AND NOT CMAKE_SYSTEM_NAME STREQUAL "Android" AND NOT(APPLE) AND NOT(DISABLE_DBUS)) find_package(Qt5DBus) +else() + add_definitions(-DKIRIGAMI_DISABLE_DBUS) endif() if(BUILD_EXAMPLES AND CMAKE_SYSTEM_NAME STREQUAL "Android") diff --git a/src/libkirigami/CMakeLists.txt b/src/libkirigami/CMakeLists.txt --- a/src/libkirigami/CMakeLists.txt +++ b/src/libkirigami/CMakeLists.txt @@ -8,7 +8,7 @@ ) #use dbus on linux, bsd etc, but not andoid and apple stuff -if (UNIX AND NOT CMAKE_SYSTEM_NAME STREQUAL "Android" AND NOT(APPLE)) +if (UNIX AND NOT CMAKE_SYSTEM_NAME STREQUAL "Android" AND NOT(APPLE) AND NOT(DISABLE_DBUS)) qt5_add_dbus_interface(libkirigami_SRCS org.kde.KWin.TabletModeManager.xml tabletmodemanager_interface) set(LIBKIRIGAMKI_EXTRA_LIBS Qt5::DBus) endif() diff --git a/src/libkirigami/tabletmodewatcher.cpp b/src/libkirigami/tabletmodewatcher.cpp --- a/src/libkirigami/tabletmodewatcher.cpp +++ b/src/libkirigami/tabletmodewatcher.cpp @@ -21,7 +21,7 @@ #include "tabletmodewatcher.h" -#if defined(Q_OS_UNIX) && !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS) && !defined(Q_OS_MACOS) +#if defined(Q_OS_UNIX) && !defined(Q_OS_ANDROID) && !defined(Q_OS_IOS) && !defined(Q_OS_MACOS) && !defined(KIRIGAMI_DISABLE_DBUS) #include "tabletmodemanager_interface.h" #include #endif @@ -45,7 +45,7 @@ TabletModeWatcherPrivate(TabletModeWatcher *watcher) : q(watcher) { -#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) +#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS) || defined(KIRIGAMI_DISABLE_DBUS) isTabletModeAvailable = true; isTabletMode = true; #elif defined(Q_OS_MACOS) @@ -92,7 +92,7 @@ void setIsTablet(bool tablet); TabletModeWatcher *q; -#if (defined(Q_OS_LINUX) || defined(Q_OS_UNIX)) && !defined(Q_OS_ANDROID) && !defined(Q_OS_MAC) && !defined(Q_OS_IOS) +#if (defined(Q_OS_LINUX) || defined(Q_OS_UNIX)) && !defined(Q_OS_ANDROID) && !defined(Q_OS_MAC) && !defined(Q_OS_IOS) && !defined(KIRIGAMI_DISABLE_DBUS) OrgKdeKWinTabletModeManagerInterface *m_interface = nullptr; #endif bool isTabletModeAvailable = false;