Skip to content

Commit

Permalink
Correct NO_SERIAL_LINK Checks
Browse files Browse the repository at this point in the history
  • Loading branch information
HTRamsey committed Apr 27, 2024
1 parent 13eea3d commit 4965c24
Show file tree
Hide file tree
Showing 15 changed files with 289 additions and 306 deletions.
3 changes: 2 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,6 @@ find_package(Qt6
Xml
OPTIONAL_COMPONENTS
LinguistTools
SerialPort
HINTS
${QT_LIBRARY_HINTS}
)
Expand Down Expand Up @@ -176,6 +175,8 @@ if(QGC_DEBUG_QML)
add_compile_definitions(QT_QML_DEBUG)
endif()

cmake_dependent_option(QGC_NO_SERIAL_LINK "Build QGroundControl without Serial Support Support." OFF "NOT IOS" ON)

#######################################################
# QGroundControl Resources
#######################################################
Expand Down
83 changes: 44 additions & 39 deletions src/GPS/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -12,44 +12,49 @@ find_package(Qt6 REQUIRED COMPONENTS Core)
# add_subdirectory(${gps_drivers_SOURCE_DIR} ${gps_drivers_BINARY_DIR} EXCLUDE_FROM_ALL)
# endif()

qt_add_library(gps STATIC
definitions.h
Drivers/src/ashtech.cpp
Drivers/src/ashtech.h
Drivers/src/gps_helper.cpp
Drivers/src/gps_helper.h
Drivers/src/mtk.cpp
Drivers/src/mtk.h
Drivers/src/rtcm.cpp
Drivers/src/rtcm.h
Drivers/src/sbf.cpp
Drivers/src/sbf.h
Drivers/src/ubx.cpp
Drivers/src/ubx.h
GPSManager.cc
GPSManager.h
GPSPositionMessage.h
GPSProvider.cc
GPSProvider.h
RTCMMavlink.cc
RTCMMavlink.h
satellite_info.h
sensor_gnss_relative.h
sensor_gps.h
)
qt_add_library(gps STATIC)

target_link_libraries(gps
PRIVATE
comm
Settings
Utilities
PUBLIC
Qt6::Core
qgc
)
if(NOT QGC_NO_SERIAL_LINK)
target_sources(gps
PRIVATE
definitions.h
Drivers/src/ashtech.cpp
Drivers/src/ashtech.h
Drivers/src/gps_helper.cpp
Drivers/src/gps_helper.h
Drivers/src/mtk.cpp
Drivers/src/mtk.h
Drivers/src/rtcm.cpp
Drivers/src/rtcm.h
Drivers/src/sbf.cpp
Drivers/src/sbf.h
Drivers/src/ubx.cpp
Drivers/src/ubx.h
GPSManager.cc
GPSManager.h
GPSPositionMessage.h
GPSProvider.cc
GPSProvider.h
RTCMMavlink.cc
RTCMMavlink.h
satellite_info.h
sensor_gnss_relative.h
sensor_gps.h
)

target_include_directories(gps
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
Drivers/src
)
target_link_libraries(gps
PRIVATE
comm
Settings
Utilities
PUBLIC
Qt6::Core
qgc
)

target_include_directories(gps
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
Drivers/src
)
endif()
13 changes: 4 additions & 9 deletions src/QGCApplication.cc
Original file line number Diff line number Diff line change
Expand Up @@ -116,16 +116,13 @@
#include "FactSystem.h"
#include "LinkConfiguration.h"

#ifndef __mobile__
#include "FirmwareUpgradeController.h"
#endif

#ifndef NO_SERIAL_LINK
#include "FirmwareUpgradeController.h"
#include "SerialLink.h"
#endif

#ifdef Q_OS_LINUX
#ifndef __mobile__
#ifndef Q_OS_ANDROID
#include <unistd.h>
#include <sys/types.h>
#endif
Expand Down Expand Up @@ -191,7 +188,7 @@ QGCApplication::QGCApplication(int &argc, char* argv[], bool unitTesting)
_msecsElapsedTime.start();

#ifdef Q_OS_LINUX
#ifndef __mobile__
#ifndef Q_OS_ANDROID
if (!_runningUnitTests) {
if (getuid() == 0) {
_exitWithError(QString(
Expand Down Expand Up @@ -492,10 +489,8 @@ void QGCApplication::_initCommon()
qmlRegisterType<ToolStripAction> ("QGroundControl.Controls", 1, 0, "ToolStripAction");
qmlRegisterType<ToolStripActionList> ("QGroundControl.Controls", 1, 0, "ToolStripActionList");

#ifndef __mobile__
#ifndef NO_SERIAL_LINK
qmlRegisterType<FirmwareUpgradeController> (kQGCControllers, 1, 0, "FirmwareUpgradeController");
#endif
#endif
qmlRegisterType<GeoTagController> (kQGCControllers, 1, 0, "GeoTagController");
qmlRegisterType<MavlinkConsoleController> (kQGCControllers, 1, 0, "MavlinkConsoleController");
Expand Down Expand Up @@ -549,7 +544,7 @@ bool QGCApplication::_initForNormalAppBoot()
}

#ifdef Q_OS_LINUX
#ifndef __mobile__
#ifndef Q_OS_ANDROID
#ifndef NO_SERIAL_LINK
if (!_runningUnitTests) {
// Determine if we have the correct permissions to access USB serial devices
Expand Down
6 changes: 3 additions & 3 deletions src/QGCToolbox.cc
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

#include "FactSystem.h"
#include "FirmwarePluginManager.h"
#ifndef __mobile__
#ifndef NO_SERIAL_LINK
#include "GPSManager.h"
#endif
#include "JoystickManager.h"
Expand Down Expand Up @@ -64,7 +64,7 @@ QGCToolbox::QGCToolbox(QGCApplication* app)
_scanAndLoadPlugins(app);
_factSystem = new FactSystem (app, this);
_firmwarePluginManager = new FirmwarePluginManager (app, this);
#ifndef __mobile__
#ifndef NO_SERIAL_LINK
_gpsManager = new GPSManager (app, this);
#endif
_imageProvider = new QGCImageProvider (app, this);
Expand Down Expand Up @@ -99,7 +99,7 @@ void QGCToolbox::setChildToolboxes(void)
_corePlugin->setToolbox(this);
_factSystem->setToolbox(this);
_firmwarePluginManager->setToolbox(this);
#ifndef __mobile__
#ifndef NO_SERIAL_LINK
_gpsManager->setToolbox(this);
#endif
_imageProvider->setToolbox(this);
Expand Down
4 changes: 2 additions & 2 deletions src/QGCToolbox.h
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class QGCToolbox : public QObject {
QGCCorePlugin* corePlugin () { return _corePlugin; }
SettingsManager* settingsManager () { return _settingsManager; }
ADSBVehicleManager* adsbVehicleManager () { return _adsbVehicleManager; }
#ifndef __mobile__
#ifndef NO_SERIAL_LINK
GPSManager* gpsManager () { return _gpsManager; }
#endif
#ifndef QGC_AIRLINK_DISABLED
Expand All @@ -79,7 +79,7 @@ class QGCToolbox : public QObject {

FactSystem* _factSystem = nullptr;
FirmwarePluginManager* _firmwarePluginManager = nullptr;
#ifndef __mobile__
#ifndef NO_SERIAL_LINK
GPSManager* _gpsManager = nullptr;
#endif
QGCImageProvider* _imageProvider = nullptr;
Expand Down
4 changes: 2 additions & 2 deletions src/QmlControls/QGroundControlQmlGlobal.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
#include "QGCMapUrlEngine.h"
#include "FirmwarePluginManager.h"
#include "AppSettings.h"
#ifndef __mobile__
#ifndef NO_SERIAL_LINK
#include "GPSManager.h"
#endif
#include "QGCPalette.h"
Expand Down Expand Up @@ -86,7 +86,7 @@ void QGroundControlQmlGlobal::setToolbox(QGCToolbox* toolbox)
_corePlugin = toolbox->corePlugin();
_firmwarePluginManager = toolbox->firmwarePluginManager();
_settingsManager = toolbox->settingsManager();
#ifndef __mobile__
#ifndef NO_SERIAL_LINK
_gpsRtkFactGroup = toolbox->gpsManager()->gpsRtkFactGroup();
#endif
_adsbVehicleManager = toolbox->adsbVehicleManager();
Expand Down
6 changes: 6 additions & 0 deletions src/QmlControls/QGroundControlQmlGlobal.h
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,9 @@ class QGroundControlQmlGlobal : public QGCTool
Q_PROPERTY(ADSBVehicleManager* adsbVehicleManager READ adsbVehicleManager CONSTANT)
Q_PROPERTY(QGCCorePlugin* corePlugin READ corePlugin CONSTANT)
Q_PROPERTY(MissionCommandTree* missionCommandTree READ missionCommandTree CONSTANT)
#ifndef NO_SERIAL_LINK
Q_PROPERTY(FactGroup* gpsRtk READ gpsRtkFactGroup CONSTANT)
#endif
#ifndef QGC_AIRLINK_DISABLED
Q_PROPERTY(AirLinkManager* airlinkManager READ airlinkManager CONSTANT)
#endif
Expand Down Expand Up @@ -172,7 +174,9 @@ class QGroundControlQmlGlobal : public QGCTool
MAVLinkLogManager* mavlinkLogManager () { return _mavlinkLogManager; }
QGCCorePlugin* corePlugin () { return _corePlugin; }
SettingsManager* settingsManager () { return _settingsManager; }
#ifndef NO_SERIAL_LINK
FactGroup* gpsRtkFactGroup () { return _gpsRtkFactGroup; }
#endif
ADSBVehicleManager* adsbVehicleManager () { return _adsbVehicleManager; }
QmlUnitsConversion* unitsConversion () { return &_unitsConversion; }
static QGeoCoordinate flightMapPosition () { return _coord; }
Expand Down Expand Up @@ -261,7 +265,9 @@ class QGroundControlQmlGlobal : public QGCTool
QGCCorePlugin* _corePlugin = nullptr;
FirmwarePluginManager* _firmwarePluginManager = nullptr;
SettingsManager* _settingsManager = nullptr;
#ifndef NO_SERIAL_LINK
FactGroup* _gpsRtkFactGroup = nullptr;
#endif
AirLinkManager* _airlinkManager = nullptr;
ADSBVehicleManager* _adsbVehicleManager = nullptr;
QGCPalette* _globalPalette = nullptr;
Expand Down
30 changes: 21 additions & 9 deletions src/VehicleSetup/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,23 +1,14 @@
find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml Quick)

qt_add_library(VehicleSetup STATIC
Bootloader.cc
Bootloader.h
FirmwareImage.cc
FirmwareImage.h
FirmwareUpgradeController.cc
FirmwareUpgradeController.h
JoystickConfigController.cc
JoystickConfigController.h
PX4FirmwareUpgradeThread.cc
PX4FirmwareUpgradeThread.h
VehicleComponent.cc
VehicleComponent.h
)

add_custom_target(VehicleSetupQml
SOURCES
FirmwareUpgrade.qml
JoystickConfig.qml
JoystickConfigAdvanced.qml
JoystickConfigButtons.qml
Expand Down Expand Up @@ -49,3 +40,24 @@ target_link_libraries(VehicleSetup
)

target_include_directories(VehicleSetup PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

if(NOT QGC_NO_SERIAL_LINK)
target_sources(VehicleSetup
PRIVATE
Bootloader.cc
Bootloader.h
FirmwareImage.cc
FirmwareImage.h
FirmwareUpgradeController.cc
FirmwareUpgradeController.h
PX4FirmwareUpgradeThread.cc
PX4FirmwareUpgradeThread.h
)

target_link_libraries(VehicleSetup PUBLIC comm)

target_sources(VehicleSetupQml
PRIVATE
FirmwareUpgrade.qml
)
endif()
11 changes: 4 additions & 7 deletions src/comm/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,18 +49,15 @@ target_link_libraries(comm
Utilities
)

if(NOT MOBILE)
option(QGC_NO_SERIAL_LINK "Disable Serial Links" OFF)
if(QGC_NO_SERIAL_LINK)
target_compile_definitions(comm PUBLIC NO_SERIAL_LINK)
else()
target_link_libraries(comm
PRIVATE
gps
PositionManager
)
endif()

option(QGC_NO_SERIAL_LINK "Disable Serial Links" OFF)
if(QGC_NO_SERIAL_LINK)
target_compile_definitions(comm PUBLIC NO_SERIAL_LINK)
else()
if(ANDROID)
add_subdirectory(${CMAKE_SOURCE_DIR}/libs/qtandroidserialport qtandroidserialport.build)
target_link_libraries(comm PUBLIC qtandroidserialport)
Expand Down
Loading

0 comments on commit 4965c24

Please sign in to comment.