Make Bluetooth optional

This way we can merge this code in master with the hope of it getting
more attention.
This commit is contained in:
Àlex Fiestas 2017-05-24 23:52:18 +02:00
parent 54ef8862eb
commit c0a417e9e4
No known key found for this signature in database
GPG key ID: 60AC676CEC24059E
3 changed files with 20 additions and 5 deletions

View file

@ -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)

View file

@ -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}

View file

@ -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());
#ifdef KDECONNECT_BLUETOOTH
d->mLinkProviders.insert(new BluetoothLinkProvider());
#endif
}
//Read remebered paired devices