[prev in list] [next in list] [prev in thread] [next in thread] 

List:       kde-commits
Subject:    [kirigami] /: Allow Kirigami build without KWin tablet mode dependency
From:       Aleix Pol <null () kde ! org>
Date:       2018-06-01 0:06:32
Message-ID: E1fOXaS-0007Y7-6O () code ! kde ! org
[Download RAW message or body]

Git commit f5cd75acadf4254144c975437d3022f460669a64 by Aleix Pol, on behalf of \
Murillo Bernardes. Committed on 01/06/2018 at 00:05.
Pushed by apol into branch 'master'.

Allow Kirigami build without KWin tablet mode dependency

Summary:
Even on linux it might be the case to not need/want the tablet mode manager \
dependency.

This is the case for Subsurface-mobile, where desktop builds (linux and Mac) are used \
for development, with the final target being iOS and Android.

Reviewers: mart, davidedmundson

Reviewed By: mart

Subscribers: apol, davidedmundson, plasma-devel

Tags: #kirigami

Differential Revision: https://phabricator.kde.org/D13148

M  +3    -1    CMakeLists.txt
M  +1    -1    src/libkirigami/CMakeLists.txt
M  +5    -7    src/libkirigami/tabletmodewatcher.cpp

https://commits.kde.org/kirigami/f5cd75acadf4254144c975437d3022f460669a64

diff --git a/CMakeLists.txt b/CMakeLists.txt
index 4fa38de..42a303f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -19,6 +19,7 @@ option(BUILD_SHARED_LIBS "Build a shared module" ON)
 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,9 @@ ecm_setup_version(${KF5_VERSION}
 )
 
 #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)
+    add_definitions(-DKIRIGAMI_ENABLE_DBUS)
 endif()
 
 if(BUILD_EXAMPLES AND CMAKE_SYSTEM_NAME STREQUAL "Android")
diff --git a/src/libkirigami/CMakeLists.txt b/src/libkirigami/CMakeLists.txt
index 624f378..88d1158 100644
--- a/src/libkirigami/CMakeLists.txt
+++ b/src/libkirigami/CMakeLists.txt
@@ -8,7 +8,7 @@ set(libkirigami_SRCS
 )
 
 #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 index 7c9259f..2d228eb 100644
--- 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(KIRIGAMI_ENABLE_DBUS)
 #include "tabletmodemanager_interface.h"
 #include <QDBusConnection>
 #endif
@@ -45,13 +45,11 @@ public:
     TabletModeWatcherPrivate(TabletModeWatcher *watcher)
         : q(watcher)
     {
-#if defined(Q_OS_ANDROID) || defined(Q_OS_IOS)
+
+#if !defined(KIRIGAMI_ENABLE_DBUS) && (defined(Q_OS_ANDROID) || defined(Q_OS_IOS))
         isTabletModeAvailable = true;
         isTabletMode = true;
-#elif defined(Q_OS_MACOS)
-        isTabletModeAvailable = false;
-        isTabletMode = false;
-#elif defined(Q_OS_LINUX) || defined(Q_OS_UNIX)
+#elif defined(KIRIGAMI_ENABLE_DBUS)
         //Mostly for debug purposes and for platforms which are always mobile,
         //such as Plasma Mobile
         if (qEnvironmentVariableIsSet("QT_QUICK_CONTROLS_MOBILE") ||        
@@ -92,7 +90,7 @@ public:
     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(KIRIGAMI_ENABLE_DBUS)
     OrgKdeKWinTabletModeManagerInterface *m_interface = nullptr;
 #endif
     bool isTabletModeAvailable = false;


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic