Fix building without BT support

I guess no one had tried this in a while.

Signed-off-by: Dirk Hohndel <dirk@hohndel.org>
This commit is contained in:
Dirk Hohndel 2015-10-26 06:05:27 -07:00
parent 1d10a56bdf
commit 3b0f38f24a
5 changed files with 29 additions and 11 deletions

View file

@ -203,13 +203,18 @@ if(ANDROID)
set(ANDROID_PKG AndroidExtras) set(ANDROID_PKG AndroidExtras)
set(ANDROID_LIB Qt5::AndroidExtras) set(ANDROID_LIB Qt5::AndroidExtras)
endif() endif()
find_package(Qt5 REQUIRED COMPONENTS Core Concurrent Widgets Network ${WEBKIT_PKG} ${PRINTING_PKG} Svg Test LinguistTools ${QT_QUICK_PKG} ${ANDROID_PKG} Bluetooth) if(BTSUPPORT)
set(QT_LIBRARIES Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network ${WEBKIT_LIB} ${PRINTING_LIB} Qt5::Svg ${QT_QUICK_LIB} ${ANDROID_LIB} Qt5::Bluetooth) set(BLUETOOTH_PKG Bluetooth)
set(BLUETOOTH_LIB Qt5::Bluetooth)
endif()
find_package(Qt5 REQUIRED COMPONENTS Core Concurrent Widgets Network ${WEBKIT_PKG} ${PRINTING_PKG} Svg Test LinguistTools ${QT_QUICK_PKG} ${ANDROID_PKG} ${BLUETOOTH_PKG})
set(QT_LIBRARIES Qt5::Core Qt5::Concurrent Qt5::Widgets Qt5::Network ${WEBKIT_LIB} ${PRINTING_LIB} Qt5::Svg ${QT_QUICK_LIB} ${ANDROID_LIB} ${BLUETOOTH_LIB})
set(QT_TEST_LIBRARIES ${QT_LIBRARIES} Qt5::Test) set(QT_TEST_LIBRARIES ${QT_LIBRARIES} Qt5::Test)
if ("${Qt5Core_VERSION_STRING}" STRLESS "5.4.0") if (BTSUPPORT AND "${Qt5Core_VERSION_STRING}" STRLESS "5.4.0")
set(BTSUPPORT OFF) set(BTSUPPORT OFF)
message(STATUS "Turning off Bluetooth support as Qt version ${Qt5Core_VERSION_STRING} is insufficiant for that") message(STATUS "Turning off Bluetooth support as Qt version ${Qt5Core_VERSION_STRING} is insufficiant for that")
string(REPLACE "Qt5::Bluetooth" "" QT_LIBRARIES ${QT_LIBRARIES})
endif() endif()
# Generate the ssrf-config.h every 'make' # Generate the ssrf-config.h every 'make'
@ -311,6 +316,12 @@ endif()
# include translations # include translations
add_subdirectory(translations) add_subdirectory(translations)
if(BTSUPPORT)
add_definitions(-DBT_SUPPORT)
set(BT_SRC_FILES qt-ui/btdeviceselectiondialog.cpp)
set(BT_CORE_SRC_FILES qtserialbluetooth.cpp)
endif()
# compile the core library, in C. # compile the core library, in C.
set(SUBSURFACE_CORE_LIB_SRCS set(SUBSURFACE_CORE_LIB_SRCS
cochran.c cochran.c
@ -361,7 +372,7 @@ set(SUBSURFACE_CORE_LIB_SRCS
windowtitleupdate.cpp windowtitleupdate.cpp
divelogexportlogic.cpp divelogexportlogic.cpp
qt-init.cpp qt-init.cpp
qtserialbluetooth.cpp ${BT_CORE_SRC_FILES}
${SERIAL_FTDI} ${SERIAL_FTDI}
${PLATFORM_SRC} ${PLATFORM_SRC}
) )
@ -372,11 +383,6 @@ if(FBSUPPORT)
set(SOCIALNETWORKS qt-ui/socialnetworks.cpp) set(SOCIALNETWORKS qt-ui/socialnetworks.cpp)
endif() endif()
if(BTSUPPORT)
add_definitions(-DBT_SUPPORT)
set(BT_SRC_FILES qt-ui/btdeviceselectiondialog.cpp)
endif()
# the data models that will interface # the data models that will interface
# with the views. # with the views.
set(SUBSURFACE_MODELS_LIB_SRCS set(SUBSURFACE_MODELS_LIB_SRCS

View file

@ -636,7 +636,9 @@ QString ConfigureDiveComputer::dc_open(device_data_t *data)
dc_serial_t *serial_device = NULL; dc_serial_t *serial_device = NULL;
if (data->bluetooth_mode) { if (data->bluetooth_mode) {
#ifdef BT_SUPPORT
rc = dc_serial_qt_open(&serial_device, data->context, data->devname); rc = dc_serial_qt_open(&serial_device, data->context, data->devname);
#endif
#ifdef SERIAL_FTDI #ifdef SERIAL_FTDI
} else if (!strcmp(data->devname, "ftdi")) { } else if (!strcmp(data->devname, "ftdi")) {
rc = dc_serial_ftdi_open(&serial_device, data->context); rc = dc_serial_ftdi_open(&serial_device, data->context);

View file

@ -971,7 +971,9 @@ const char *do_libdivecomputer_import(device_data_t *data)
dc_serial_t *serial_device = NULL; dc_serial_t *serial_device = NULL;
if (data->bluetooth_mode) { if (data->bluetooth_mode) {
#ifdef BT_SUPPORT
rc = dc_serial_qt_open(&serial_device, data->context, data->devname); rc = dc_serial_qt_open(&serial_device, data->context, data->devname);
#endif
#ifdef SERIAL_FTDI #ifdef SERIAL_FTDI
} else if (!strcmp(data->devname, "ftdi")) { } else if (!strcmp(data->devname, "ftdi")) {
rc = dc_serial_ftdi_open(&serial_device, data->context); rc = dc_serial_ftdi_open(&serial_device, data->context);

View file

@ -115,8 +115,12 @@ void GasTypeComboBoxItemDelegate::setModelData(QWidget *editor, QAbstractItemMod
ConfigureDiveComputerDialog::ConfigureDiveComputerDialog(QWidget *parent) : QDialog(parent), ConfigureDiveComputerDialog::ConfigureDiveComputerDialog(QWidget *parent) : QDialog(parent),
config(0), config(0),
#ifdef BT_SUPPORT
deviceDetails(0), deviceDetails(0),
btDeviceSelectionDialog(0) btDeviceSelectionDialog(0)
#else
deviceDetails(0)
#endif
{ {
ui.setupUi(this); ui.setupUi(this);
@ -134,7 +138,7 @@ ConfigureDiveComputerDialog::ConfigureDiveComputerDialog(QWidget *parent) : QDia
connect(ui.logToFile, SIGNAL(stateChanged(int)), this, SLOT(checkLogFile(int))); connect(ui.logToFile, SIGNAL(stateChanged(int)), this, SLOT(checkLogFile(int)));
connect(ui.connectButton, SIGNAL(clicked()), this, SLOT(dc_open())); connect(ui.connectButton, SIGNAL(clicked()), this, SLOT(dc_open()));
connect(ui.disconnectButton, SIGNAL(clicked()), this, SLOT(dc_close())); connect(ui.disconnectButton, SIGNAL(clicked()), this, SLOT(dc_close()));
#if BT_SUPPORT #ifdef BT_SUPPORT
connect(ui.bluetoothMode, SIGNAL(clicked(bool)), this, SLOT(selectRemoteBluetoothDevice())); connect(ui.bluetoothMode, SIGNAL(clicked(bool)), this, SLOT(selectRemoteBluetoothDevice()));
#else #else
ui.bluetoothMode->setVisible(false); ui.bluetoothMode->setVisible(false);

View file

@ -8,7 +8,9 @@
#include "configuredivecomputer.h" #include "configuredivecomputer.h"
#include <QStyledItemDelegate> #include <QStyledItemDelegate>
#include <QNetworkAccessManager> #include <QNetworkAccessManager>
#ifdef BT_SUPPORT
#include "btdeviceselectiondialog.h" #include "btdeviceselectiondialog.h"
#endif
class GasSpinBoxItemDelegate : public QStyledItemDelegate { class GasSpinBoxItemDelegate : public QStyledItemDelegate {
Q_OBJECT Q_OBJECT
@ -85,7 +87,7 @@ slots:
void dc_open(); void dc_open();
void dc_close(); void dc_close();
#if BT_SUPPORT #ifdef BT_SUPPORT
void bluetoothSelectionDialogIsFinished(int result); void bluetoothSelectionDialogIsFinished(int result);
void selectRemoteBluetoothDevice(); void selectRemoteBluetoothDevice();
#endif #endif
@ -119,7 +121,9 @@ private:
QString selected_product; QString selected_product;
bool fw_upgrade_possible; bool fw_upgrade_possible;
#ifdef BT_SUPPORT
BtDeviceSelectionDialog *btDeviceSelectionDialog; BtDeviceSelectionDialog *btDeviceSelectionDialog;
#endif
}; };
class OstcFirmwareCheck : QObject { class OstcFirmwareCheck : QObject {