Skip to content

Commit

Permalink
Improve CMake Libraries
Browse files Browse the repository at this point in the history
  • Loading branch information
HTRamsey authored and DonLakeFlyer committed Mar 13, 2024
1 parent 927e79d commit 37315ab
Show file tree
Hide file tree
Showing 53 changed files with 523 additions and 435 deletions.
8 changes: 5 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -149,9 +149,6 @@ message(STATUS "QGroundControl version: ${APP_VERSION_STR}")
# QGroundControl Resources
#######################################################

add_subdirectory(libs)
add_subdirectory(src)

set(QGC_RESOURCES
${CMAKE_SOURCE_DIR}/qgcimages.qrc
${CMAKE_SOURCE_DIR}/qgcresources.qrc
Expand Down Expand Up @@ -186,11 +183,16 @@ endif()

qt_add_executable(${PROJECT_NAME} src/main.cc ${QGC_RESOURCES})

add_subdirectory(libs)
add_subdirectory(src)

set_target_properties(${PROJECT_NAME}
PROPERTIES
QT_RESOURCE_PREFIX "/qgc"
)

target_precompile_headers(${PROJECT_NAME} PRIVATE src/pch.h)

if(Qt6LinguistTools_FOUND)
file(GLOB TS_SOURCES RELATIVE ${CMAKE_SOURCE_DIR} ${CMAKE_SOURCE_DIR}/translations/qgc_*.ts)
# TODO: Update to new qt_add_translations form in Qt6.7
Expand Down
2 changes: 1 addition & 1 deletion libs/qmlglsink/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ if(QGC_ENABLE_VIDEOSTREAMING)
${GST_LINK_LIBRARIES}
)

target_include_directories(qmlglsink PRIVATE ${GST_INCLUDE_DIRS})
target_include_directories(qmlglsink PUBLIC ${GST_INCLUDE_DIRS})
if (MSVC)
target_include_directories(qmlglsink PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/windows)
else()
Expand Down
4 changes: 2 additions & 2 deletions libs/qtandroidserialport/src/qserialportinfo.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ QSerialPortInfo::QSerialPortInfo(const QSerialPortInfoPrivate &dd)
QSerialPortInfo::~QSerialPortInfo()
{
}
#if 0

/*! \fn void QSerialPortInfo::swap(QSerialPortInfo &other)
Swaps QSerialPortInfo \a other with this QSerialPortInfo. This operation is
Expand All @@ -137,7 +137,7 @@ QSerialPortInfo& QSerialPortInfo::operator=(const QSerialPortInfo &other)
QSerialPortInfo(other).swap(*this);
return *this;
}
#endif

/*!
Returns the name of the serial port.
Expand Down
3 changes: 1 addition & 2 deletions libs/qtandroidserialport/src/qserialportinfo.h
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,6 @@ QT_BEGIN_NAMESPACE

class QSerialPort;
class QSerialPortInfoPrivate;
class QSerialPortInfoPrivateDeleter;

class QSerialPortInfo
{
Expand Down Expand Up @@ -78,7 +77,7 @@ class QSerialPortInfo
static QList<qint32> standardBaudRates();
static QList<QSerialPortInfo> availablePorts();

QScopedPointer<QSerialPortInfoPrivate, QSerialPortInfoPrivateDeleter> d_ptr;
std::unique_ptr<QSerialPortInfoPrivate> d_ptr;

private:
QSerialPortInfo(const QSerialPortInfoPrivate &dd);
Expand Down
8 changes: 0 additions & 8 deletions libs/qtandroidserialport/src/qserialportinfo_p.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,14 +82,6 @@ class Q_AUTOTEST_EXPORT QSerialPortInfoPrivate
bool hasProductIdentifier;
};

class QSerialPortInfoPrivateDeleter
{
public:
static void cleanup(QSerialPortInfoPrivate *p) {
delete p;
}
};

QT_END_NAMESPACE

#endif // QSERIALPORTINFO_P_H
13 changes: 7 additions & 6 deletions src/ADSB/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
find_package(Qt6 REQUIRED COMPONENTS Core Network Positioning)

qt_add_library(ADSB STATIC
ADSBVehicle.cc
Expand All @@ -8,12 +9,12 @@ qt_add_library(ADSB STATIC

target_link_libraries(ADSB
PUBLIC
Qt6::Core
Qt6::Network
Qt6::Positioning
comm
qgc
QmlControls
)

target_include_directories(ADSB
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
)


target_include_directories(ADSB PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
48 changes: 31 additions & 17 deletions src/AirLink/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,20 +1,34 @@
find_package(Qt6 COMPONENTS Core Network REQUIRED)
find_package(Qt6 REQUIRED COMPONENTS Core)

qt_add_library(AirLink STATIC
AirlinkLink.cc
AirlinkLink.h
AirLinkManager.cc
AirLinkManager.h
AirLinkSettings.qml
)
qt_add_library(AirLink STATIC)

target_link_libraries(AirLink
PUBLIC
Qt6::Core
Qt6::Network
FactSystem
Settings
qgc
)
option(QGC_AIRLINK_DISABLED "Enable airlink" OFF)
if(NOT ${QGC_AIRLINK_DISABLED})
find_package(Qt6 COMPONENTS Network REQUIRED)

target_include_directories(AirLink PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
target_sources(AirLink
PRIVATE
AirlinkLink.cc
AirlinkLink.h
AirLinkManager.cc
AirLinkManager.h
)

add_custom_target(AirLinkQml
SOURCES
AirLinkSettings.qml
)

target_link_libraries(AirLink
PUBLIC
Qt6::Core
Qt6::Network
FactSystem
Settings
qgc
)

target_include_directories(AirLink PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
else()
target_compile_definitions(AirLink PUBLIC QGC_AIRLINK_DISABLED)
endif()
2 changes: 1 addition & 1 deletion src/AnalyzeView/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
find_package(Qt6 REQUIRED COMPONENTS Core)

qt_add_library(AnalyzeView STATIC
ExifParser.cc
Expand Down Expand Up @@ -34,7 +35,6 @@ target_link_libraries(AnalyzeView
PUBLIC
Qt6::Charts
Qt6::Location
Qt6::SerialPort
Qt6::TextToSpeech
Qt6::Widgets
)
Expand Down
5 changes: 3 additions & 2 deletions src/Audio/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
find_package(Qt6 REQUIRED COMPONENTS Core TextToSpeech Widgets)

qt_add_library(Audio STATIC
AudioOutput.cc
AudioOutput.h
)

target_link_libraries(Audio
PRIVATE
Qt6::Widgets
qgc
PUBLIC
Qt6::Core
Qt6::Qml
Qt6::TextToSpeech
Qt6::Widgets
)

target_include_directories(Audio PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
69 changes: 35 additions & 34 deletions src/AutoPilotPlugins/APM/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,36 +1,37 @@
add_custom_target(APMAutoPilotPluginQml
SOURCES
APMAirframeComponent.qml
APMAirframeComponentSummary.qml
APMCameraComponent.qml
APMCameraComponentSummary.qml
APMCameraSubComponent.qml
APMFlightModesComponent.qml
APMFlightModesComponentSummary.qml
APMHeliComponent.qml
APMLightsComponent.qml
APMLightsComponentSummary.qml
APMNotSupported.qml
APMPowerComponent.qml
APMPowerComponentSummary.qml
APMRadioComponentSummary.qml
APMRemoteSupportComponent.qml
APMSafetyComponent.qml
APMSafetyComponentCopter.qml
APMSafetyComponentPlane.qml
APMSafetyComponentRover.qml
APMSafetyComponentSub.qml
APMSafetyComponentSummary.qml
APMSafetyComponentSummaryCopter.qml
APMSafetyComponentSummaryPlane.qml
APMSafetyComponentSummaryRover.qml
APMSafetyComponentSummarySub.qml
APMSensorsComponent.qml
APMSensorsComponentSummary.qml
APMSubFrameComponent.qml
APMSubFrameComponentSummary.qml
APMSubMotorComponent.qml
APMTuningComponentCopter.qml
APMTuningComponentSub.qml
find_package(Qt6 REQUIRED COMPONENTS Core Qml)

add_custom_target(APMAutoPilotPluginQml
SOURCES
APMAirframeComponent.qml
APMAirframeComponentSummary.qml
APMCameraComponent.qml
APMCameraComponentSummary.qml
APMCameraSubComponent.qml
APMFlightModesComponent.qml
APMFlightModesComponentSummary.qml
APMHeliComponent.qml
APMLightsComponent.qml
APMLightsComponentSummary.qml
APMNotSupported.qml
APMPowerComponent.qml
APMPowerComponentSummary.qml
APMRadioComponentSummary.qml
APMRemoteSupportComponent.qml
APMSafetyComponent.qml
APMSafetyComponentCopter.qml
APMSafetyComponentPlane.qml
APMSafetyComponentRover.qml
APMSafetyComponentSub.qml
APMSafetyComponentSummary.qml
APMSafetyComponentSummaryCopter.qml
APMSafetyComponentSummaryPlane.qml
APMSafetyComponentSummaryRover.qml
APMSafetyComponentSummarySub.qml
APMSensorsComponent.qml
APMSensorsComponentSummary.qml
APMSubFrameComponent.qml
APMSubFrameComponentSummary.qml
APMSubMotorComponent.qml
APMTuningComponentCopter.qml
APMTuningComponentSub.qml
)
44 changes: 36 additions & 8 deletions src/AutoPilotPlugins/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,55 +1,83 @@

add_subdirectory(APM)
add_subdirectory(Common)
add_subdirectory(PX4)

find_package(Qt6 REQUIRED COMPONENTS Core)

qt_add_library(AutoPilotPlugins STATIC
APM/APMAirframeComponent.cc
APM/APMAirframeComponent.h
APM/APMAirframeComponentController.cc
APM/APMAirframeComponentController.h
APM/APMAutoPilotPlugin.cc
APM/APMAutoPilotPlugin.h
APM/APMCameraComponent.cc
APM/APMCameraComponent.h
APM/APMFlightModesComponent.cc
APM/APMFlightModesComponent.h
APM/APMFlightModesComponentController.cc
APM/APMFlightModesComponentController.h
APM/APMFollowComponent.cc
APM/APMFollowComponent.h
APM/APMFollowComponentController.cc
APM/APMFollowComponentController.h
APM/APMHeliComponent.cc
APM/APMHeliComponent.h
APM/APMLightsComponent.cc
APM/APMLightsComponent.h
APM/APMMotorComponent.cc
APM/APMMotorComponent.h
APM/APMPowerComponent.cc
APM/APMPowerComponent.h
APM/APMRadioComponent.cc
APM/APMRadioComponent.h
APM/APMRemoteSupportComponent.cc
APM/APMRemoteSupportComponent.h
APM/APMSafetyComponent.cc
APM/APMSafetyComponent.h
APM/APMSensorsComponent.cc
APM/APMSensorsComponent.h
APM/APMSensorsComponentController.cc
APM/APMSensorsComponentController.h
APM/APMSubFrameComponent.cc
APM/APMSubFrameComponent.h
APM/APMSubMotorComponentController.cc
APM/APMSubMotorComponentController.h
APM/APMTuningComponent.cc
APM/APMTuningComponent.h

Common/ESP8266Component.cc
Common/ESP8266Component.h
Common/ESP8266ComponentController.cc
Common/ESP8266ComponentController.h
Common/MotorComponent.cc
Common/MotorComponent.h
Common/RadioComponentController.cc
Common/RadioComponentController.h
Common/SyslinkComponent.cc
Common/SyslinkComponent.h
Common/SyslinkComponentController.cc
Common/SyslinkComponentController.h

Generic/GenericAutoPilotPlugin.cc
Generic/GenericAutoPilotPlugin.h

PX4/ActuatorComponent.cc
PX4/ActuatorComponent.h
PX4/AirframeComponent.cc
PX4/AirframeComponent.h
PX4/AirframeComponentAirframes.cc
PX4/AirframeComponentAirframes.h
PX4/AirframeComponent.cc
PX4/AirframeComponentController.cc
PX4/AirframeComponentController.h
PX4/AirframeComponent.h
PX4/CameraComponent.cc
PX4/CameraComponent.h
PX4/FlightModesComponent.cc
PX4/FlightModesComponent.h
PX4/PowerComponent.cc
PX4/PowerComponent.h
PX4/PowerComponentController.cc
PX4/PowerComponentController.h
PX4/PowerComponent.h
PX4/PX4AirframeLoader.cc
PX4/PX4AirframeLoader.h
PX4/PX4AutoPilotPlugin.cc
Expand All @@ -65,11 +93,12 @@ qt_add_library(AutoPilotPlugins STATIC
PX4/SafetyComponent.cc
PX4/SafetyComponent.h
PX4/SensorsComponent.cc
PX4/SensorsComponent.h
PX4/SensorsComponentController.cc
PX4/SensorsComponentController.h
PX4/SensorsComponent.h

AutoPilotPlugin.cc
AutoPilotPlugin.h
)

target_link_libraries(AutoPilotPlugins
Expand All @@ -78,10 +107,9 @@ target_link_libraries(AutoPilotPlugins
)

target_include_directories(AutoPilotPlugins
INTERFACE
${CMAKE_CURRENT_SOURCE_DIR}
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
APM
Common
PX4
)
)
Loading

0 comments on commit 37315ab

Please sign in to comment.