From c0a417e9e4a0a5b42042be19ad758622f72f3361 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=C3=80lex=20Fiestas?= Date: Wed, 24 May 2017 23:52:18 +0200 Subject: [PATCH] Make Bluetooth optional This way we can merge this code in master with the hope of it getting more attention. --- CMakeLists.txt | 2 +- core/CMakeLists.txt | 13 +++++++++++-- core/daemon.cpp | 10 ++++++++-- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 120102600..0d036e1d8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -10,7 +10,7 @@ cmake_minimum_required(VERSION 2.8.12) find_package(ECM 0.0.9 REQUIRED NO_MODULE) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH} ${ECM_KDE_MODULE_DIR} ${CMAKE_SOURCE_DIR}/cmake) -find_package(Qt5 5.2 REQUIRED COMPONENTS Quick Bluetooth) +find_package(Qt5 5.2 REQUIRED COMPONENTS Quick) find_package(KF5 REQUIRED COMPONENTS I18n ConfigWidgets DBusAddons) find_package(KF5DocTools) diff --git a/core/CMakeLists.txt b/core/CMakeLists.txt index e73155a3e..6dcfcc81f 100644 --- a/core/CMakeLists.txt +++ b/core/CMakeLists.txt @@ -8,7 +8,12 @@ include_directories( add_subdirectory(backends/lan) add_subdirectory(backends/loopback) -add_subdirectory(backends/bluetooth) + +option(BLUETOOTH_ENABLED "Bluetooth support for kdeconnect" OFF) +if(BLUETOOTH_ENABLED) + find_package(Qt5 REQUIRED COMPONENTS Bluetooth) + add_subdirectory(backends/bluetooth) +endif() find_package(KF5Notifications 5.9 REQUIRED) @@ -39,7 +44,6 @@ PUBLIC Qt5::Network KF5::CoreAddons qca-qt5 - Qt5::Bluetooth PRIVATE Qt5::DBus Qt5::Gui @@ -47,6 +51,11 @@ PRIVATE KF5::ConfigCore ) +if (BLUETOOTH_ENABLED) + target_compile_definitions(kdeconnectcore PRIVATE -DKDECONNECT_BLUETOOTH) + target_link_libraries(kdeconnectcore PRIVATE Qt5::Bluetooth) +endif() + set_target_properties(kdeconnectcore PROPERTIES VERSION ${KDECONNECT_VERSION} SOVERSION ${KDECONNECT_VERSION_MAJOR} diff --git a/core/daemon.cpp b/core/daemon.cpp index c45362371..6fd4cb57e 100644 --- a/core/daemon.cpp +++ b/core/daemon.cpp @@ -28,7 +28,11 @@ #include "core_debug.h" #include "kdeconnectconfig.h" #include "networkpackage.h" -#include "backends/bluetooth/bluetoothlinkprovider.h" + +#ifdef KDECONNECT_BLUETOOTH + #include "backends/bluetooth/bluetoothlinkprovider.h" +#endif + #include "backends/lan/lanlinkprovider.h" #include "backends/loopback/loopbacklinkprovider.h" #include "device.h" @@ -67,7 +71,9 @@ Daemon::Daemon(QObject *parent, bool testMode) d->mLinkProviders.insert(new LoopbackLinkProvider()); else { d->mLinkProviders.insert(new LanLinkProvider()); - d->mLinkProviders.insert(new BluetoothLinkProvider()); + #ifdef KDECONNECT_BLUETOOTH + d->mLinkProviders.insert(new BluetoothLinkProvider()); + #endif } //Read remebered paired devices