Skip to content

Commit 4a4a65e

Browse files
committed
Fix CMake scripts to run custom builds.
Base changes to enable building and running QGC custom builds. QT build script are sufficient to run custom build but CMake scripts totally ignore all custom changes. There's lot of work to be done in matter of resources which I did not address at all in this commit.
1 parent 4003b48 commit 4a4a65e

File tree

11 files changed

+243
-98
lines changed

11 files changed

+243
-98
lines changed

custom-example/custom.cmake

Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
message(STATUS "Adding Custom Plugin")
2+
3+
# you can disable usb camera
4+
set(QGC_DISABLE_UVC OFF)
5+
6+
# disable video streaming
7+
set(DISABLE_VIDEOSTREAMING OFF)
8+
# disable video streaming
9+
set(QGC_DISABLE_MAVLINK_INSPECTOR OFF )
10+
11+
# disable airmap
12+
set(DISABLE_AIRMAP OFF)
13+
14+
# disable Ardupilot mavlink dialect
15+
set(QGC_DISABLE_APM_MAVLINK ON)
16+
# disable Ardupilot firmware plugin
17+
set(QGC_DISABLE_APM_PLUGIN ON)
18+
# disable PX4 firmware plugin
19+
# set(QGC_DISABLE_PX4_PLUGIN ON)
20+
# disable Ardupilot firmware plugin factory
21+
set(QGC_DISABLE_APM_PLUGIN_FACTORY ON)
22+
# disable PX4 firmware plugin factory
23+
set(QGC_DISABLE_PX4_PLUGIN_FACTORY ON)
24+
25+
set(CUSTOMCLASS "CustomPlugin")
26+
set(CUSTOMHEADER \"CustomPlugin.h\")
27+
28+
set(CUSTOM_SRC_PATH ${CMAKE_CURRENT_SOURCE_DIR}/custom/src)
29+
30+
include_directories(${CUSTOM_SRC_PATH})
31+
include_directories(${CUSTOM_SRC_PATH}/FirmwarePlugin)
32+
include_directories(${CUSTOM_SRC_PATH}/AutoPilotPlugin)
33+
34+
set(CUSTOM_SRC
35+
${CUSTOM_SRC_PATH}/CustomPlugin.cc
36+
${CUSTOM_SRC_PATH}/AutoPilotPlugin/CustomAutoPilotPlugin.cc
37+
${CUSTOM_SRC_PATH}/FirmwarePlugin/CustomFirmwarePlugin.cc
38+
${CUSTOM_SRC_PATH}/FirmwarePlugin/CustomFirmwarePluginFactory.cc
39+
)
40+
41+
42+
set(CUSTOM_RESOURCES ${CMAKE_CURRENT_SOURCE_DIR}/custom/custom.qrc)

qgroundcontrol.pro

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ iOSBuild {
153153
# disable both the Plugin and PluginFactory entries. To include custom support
154154
# for an existing plugin type disable PluginFactory only. Then provide you own
155155
# implementation of FirmwarePluginFactory and use the FirmwarePlugin and
156-
# AutoPilotPlugin classes as the base clase for your derived plugin
156+
# AutoPilotPlugin classes as the base class for your derived plugin
157157
# implementation.
158158

159159
contains (CONFIG, QGC_DISABLE_APM_PLUGIN) {
@@ -1376,6 +1376,9 @@ contains (CONFIG, DISABLE_VIDEOSTREAMING) {
13761376
}
13771377

13781378
!VideoEnabled {
1379+
# TODO bzd here propably should go:
1380+
# DEFINES -= QGC_GST_STREAMING
1381+
13791382
INCLUDEPATH += \
13801383
src/VideoReceiver
13811384

src/AnalyzeView/CMakeLists.txt

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,15 @@ if(BUILD_TESTING)
77
)
88
endif()
99

10+
if (NOT QGC_DISABLE_MAVLINK_INSPECTOR)
11+
set(MAVLINK_INSPECTOR_SRC
12+
MAVLinkInspectorController.cc
13+
MAVLinkInspectorController.h
14+
)
15+
set(MAVLINK_INSPECTOR_QML
16+
MAVLinkInspectorPage.qml)
17+
endif()
18+
1019
add_library(AnalyzeView
1120
ExifParser.cc
1221
ExifParser.h
@@ -16,8 +25,7 @@ add_library(AnalyzeView
1625
LogDownloadController.h
1726
MavlinkConsoleController.cc
1827
MavlinkConsoleController.h
19-
MAVLinkInspectorController.cc
20-
MAVLinkInspectorController.h
28+
${MAVLINK_INSPECTOR_SRC}
2129
PX4LogParser.cc
2230
PX4LogParser.h
2331
ULogParser.cc
@@ -33,7 +41,7 @@ add_custom_target(AnalyzeViewQml
3341
GeoTagPage.qml
3442
LogDownloadPage.qml
3543
MavlinkConsolePage.qml
36-
MAVLinkInspectorPage.qml
44+
${MAVLINK_INSPECTOR_QML}
3745
VibrationPage.qml
3846
)
3947

src/AutoPilotPlugins/CMakeLists.txt

Lines changed: 88 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -1,30 +1,74 @@
1-
2-
add_subdirectory(APM)
31
add_subdirectory(Common)
4-
add_subdirectory(PX4)
52

6-
add_library(AutoPilotPlugins
7-
APM/APMAirframeComponent.cc
8-
APM/APMAirframeComponentController.cc
9-
APM/APMAutoPilotPlugin.cc
10-
APM/APMCameraComponent.cc
11-
APM/APMCompassCal.cc
12-
APM/APMFlightModesComponent.cc
13-
APM/APMFlightModesComponentController.cc
14-
APM/APMFollowComponent.cc
15-
APM/APMFollowComponentController.cc
16-
APM/APMHeliComponent.cc
17-
APM/APMLightsComponent.cc
18-
APM/APMMotorComponent.cc
19-
APM/APMPowerComponent.cc
20-
APM/APMRadioComponent.cc
21-
APM/APMSafetyComponent.cc
22-
APM/APMSensorsComponent.cc
23-
APM/APMSensorsComponentController.cc
24-
APM/APMSubFrameComponent.cc
25-
APM/APMSubMotorComponentController.cc
26-
APM/APMTuningComponent.cc
3+
if (NOT QGC_DISABLE_PX4_PLUGIN)
4+
add_subdirectory(PX4)
5+
6+
set(PX4FirmwarePlugin
7+
PX4/ActuatorComponent.cc
8+
PX4/ActuatorComponent.h
9+
PX4/AirframeComponentAirframes.cc
10+
PX4/AirframeComponentAirframes.h
11+
PX4/AirframeComponent.cc
12+
PX4/AirframeComponentController.cc
13+
PX4/AirframeComponentController.h
14+
PX4/AirframeComponent.h
15+
PX4/CameraComponent.cc
16+
PX4/CameraComponent.h
17+
PX4/FlightModesComponent.cc
18+
PX4/FlightModesComponent.h
19+
PX4/PowerComponent.cc
20+
PX4/PowerComponentController.cc
21+
PX4/PowerComponentController.h
22+
PX4/PowerComponent.h
23+
PX4/PX4AirframeLoader.cc
24+
PX4/PX4AirframeLoader.h
25+
PX4/PX4AutoPilotPlugin.cc
26+
PX4/PX4AutoPilotPlugin.h
27+
PX4/PX4FlightBehavior.cc
28+
PX4/PX4FlightBehavior.h
29+
PX4/PX4RadioComponent.cc
30+
PX4/PX4RadioComponent.h
31+
PX4/PX4SimpleFlightModesController.cc
32+
PX4/PX4SimpleFlightModesController.h
33+
PX4/PX4TuningComponent.cc
34+
PX4/PX4TuningComponent.h
35+
PX4/SafetyComponent.cc
36+
PX4/SafetyComponent.h
37+
PX4/SensorsComponent.cc
38+
PX4/SensorsComponentController.cc
39+
PX4/SensorsComponentController.h
40+
PX4/SensorsComponent.h
41+
)
42+
endif()
43+
44+
if (NOT QGC_DISABLE_APM_PLUGIN)
45+
add_subdirectory(APM)
2746

47+
set(APMFirmwarePlugin
48+
APM/APMAirframeComponent.cc
49+
APM/APMAirframeComponentController.cc
50+
APM/APMAutoPilotPlugin.cc
51+
APM/APMCameraComponent.cc
52+
APM/APMCompassCal.cc
53+
APM/APMFlightModesComponent.cc
54+
APM/APMFlightModesComponentController.cc
55+
APM/APMFollowComponent.cc
56+
APM/APMFollowComponentController.cc
57+
APM/APMHeliComponent.cc
58+
APM/APMLightsComponent.cc
59+
APM/APMMotorComponent.cc
60+
APM/APMPowerComponent.cc
61+
APM/APMRadioComponent.cc
62+
APM/APMSafetyComponent.cc
63+
APM/APMSensorsComponent.cc
64+
APM/APMSensorsComponentController.cc
65+
APM/APMSubFrameComponent.cc
66+
APM/APMSubMotorComponentController.cc
67+
APM/APMTuningComponent.cc
68+
)
69+
endif()
70+
71+
add_library(AutoPilotPlugins
2872
Common/ESP8266Component.cc
2973
Common/ESP8266ComponentController.cc
3074
Common/MotorComponent.cc
@@ -34,42 +78,9 @@ add_library(AutoPilotPlugins
3478

3579
Generic/GenericAutoPilotPlugin.cc
3680

37-
PX4/ActuatorComponent.cc
38-
PX4/ActuatorComponent.h
39-
PX4/AirframeComponentAirframes.cc
40-
PX4/AirframeComponentAirframes.h
41-
PX4/AirframeComponent.cc
42-
PX4/AirframeComponentController.cc
43-
PX4/AirframeComponentController.h
44-
PX4/AirframeComponent.h
45-
PX4/CameraComponent.cc
46-
PX4/CameraComponent.h
47-
PX4/FlightModesComponent.cc
48-
PX4/FlightModesComponent.h
49-
PX4/PowerComponent.cc
50-
PX4/PowerComponentController.cc
51-
PX4/PowerComponentController.h
52-
PX4/PowerComponent.h
53-
PX4/PX4AirframeLoader.cc
54-
PX4/PX4AirframeLoader.h
55-
PX4/PX4AutoPilotPlugin.cc
56-
PX4/PX4AutoPilotPlugin.h
57-
PX4/PX4FlightBehavior.cc
58-
PX4/PX4FlightBehavior.h
59-
PX4/PX4RadioComponent.cc
60-
PX4/PX4RadioComponent.h
61-
PX4/PX4SimpleFlightModesController.cc
62-
PX4/PX4SimpleFlightModesController.h
63-
PX4/PX4TuningComponent.cc
64-
PX4/PX4TuningComponent.h
65-
PX4/SafetyComponent.cc
66-
PX4/SafetyComponent.h
67-
PX4/SensorsComponent.cc
68-
PX4/SensorsComponentController.cc
69-
PX4/SensorsComponentController.h
70-
PX4/SensorsComponent.h
71-
7281
AutoPilotPlugin.cc
82+
${APMFirmwarePlugin}
83+
${PX4FirmwarePlugin}
7384
)
7485

7586
target_link_libraries(AutoPilotPlugins
@@ -81,7 +92,23 @@ target_include_directories(AutoPilotPlugins
8192
INTERFACE
8293
${CMAKE_CURRENT_SOURCE_DIR}
8394
PUBLIC
84-
APM
8595
Common
86-
PX4
8796
)
97+
98+
if (NOT QGC_DISABLE_APM_PLUGIN)
99+
target_include_directories(AutoPilotPlugins
100+
INTERFACE
101+
${CMAKE_CURRENT_SOURCE_DIR}
102+
PUBLIC
103+
APM
104+
)
105+
endif()
106+
107+
if (NOT QGC_DISABLE_PX4_PLUGIN)
108+
target_include_directories(AutoPilotPlugins
109+
INTERFACE
110+
${CMAKE_CURRENT_SOURCE_DIR}
111+
PUBLIC
112+
PX4
113+
)
114+
endif()

src/FirmwarePlugin/CMakeLists.txt

Lines changed: 51 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,23 +1,48 @@
11
add_subdirectory(APM)
22

3+
if (NOT QGC_DISABLE_PX4_PLUGIN_FACTORY)
4+
set(PX4FirmwarePluginFactory
5+
PX4/PX4FirmwarePluginFactory.cc
6+
)
7+
endif()
8+
9+
if (NOT QGC_DISABLE_PX4_PLUGIN)
10+
11+
set(PX4FirmwarePlugin
12+
PX4/PX4FirmwarePlugin.cc
13+
PX4/PX4ParameterMetaData.cc
14+
PX4/PX4Resources.qrc
15+
)
16+
endif()
17+
18+
if (NOT QGC_DISABLE_APM_PLUGIN_FACTORY)
19+
set(APMFirmwarePluginFactory
20+
APM/APMFirmwarePluginFactory.cc
21+
)
22+
endif()
23+
24+
if (NOT QGC_DISABLE_APM_PLUGIN)
25+
set(APMFirmwarePlugin
26+
APM/APMFirmwarePlugin.cc
27+
APM/APMParameterMetaData.cc
28+
APM/ArduCopterFirmwarePlugin.cc
29+
APM/ArduPlaneFirmwarePlugin.cc
30+
APM/ArduRoverFirmwarePlugin.cc
31+
APM/ArduSubFirmwarePlugin.cc
32+
APM/APMResources.qrc
33+
)
34+
endif()
35+
336
add_library(FirmwarePlugin
437
CameraMetaData.cc
538
FirmwarePlugin.cc
639
FirmwarePluginManager.cc
740

8-
APM/APMFirmwarePlugin.cc
9-
APM/APMFirmwarePluginFactory.cc
10-
APM/APMParameterMetaData.cc
11-
APM/ArduCopterFirmwarePlugin.cc
12-
APM/ArduPlaneFirmwarePlugin.cc
13-
APM/ArduRoverFirmwarePlugin.cc
14-
APM/ArduSubFirmwarePlugin.cc
15-
APM/APMResources.qrc
16-
17-
PX4/PX4FirmwarePlugin.cc
18-
PX4/PX4FirmwarePluginFactory.cc
19-
PX4/PX4ParameterMetaData.cc
20-
PX4/PX4Resources.qrc
41+
${APMFirmwarePlugin}
42+
${APMFirmwarePluginFactory}
43+
44+
${PX4FirmwarePluginFactory}
45+
${PX4FirmwarePlugin}
2146
)
2247

2348
target_link_libraries(FirmwarePlugin
@@ -28,6 +53,17 @@ target_link_libraries(FirmwarePlugin
2853
target_include_directories(FirmwarePlugin
2954
INTERFACE
3055
${CMAKE_CURRENT_SOURCE_DIR}
31-
APM
32-
)
56+
)
3357

58+
if (NOT QGC_DISABLE_APM_PLUGIN)
59+
target_include_directories(FirmwarePlugin
60+
INTERFACE
61+
APM)
62+
endif()
63+
64+
if (NOT QGC_DISABLE_PX4_PLUGIN)
65+
target_include_directories(FirmwarePlugin
66+
INTERFACE
67+
PX4
68+
)
69+
endif()

src/Settings/CMakeLists.txt

Lines changed: 14 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
1+
if (NOT QGC_DISABLE_APM_MAVLINK)
2+
set(APM_MAVLINK_SR_SETTINGS_SRC
3+
APMMavlinkStreamRateSettings.cc
4+
APMMavlinkStreamRateSettings.h
5+
6+
)
7+
endif()
18

29
add_library(Settings
310
ADSBVehicleManagerSettings.cc
411
ADSBVehicleManagerSettings.h
5-
APMMavlinkStreamRateSettings.cc
6-
APMMavlinkStreamRateSettings.h
12+
${APM_MAVLINK_SR_SETTINGS_SRC}
713
AppSettings.cc
814
AppSettings.h
915
AutoConnectSettings.cc
@@ -37,8 +43,12 @@ add_library(Settings
3743
target_link_libraries(Settings
3844
PUBLIC
3945
qgc
40-
Qt5::Multimedia
4146
)
42-
47+
if (NOT QGC_DISABLE_UVC)
48+
target_link_libraries(Settings
49+
PUBLIC
50+
Qt5::Multimedia
51+
)
52+
endif ()
4353
target_include_directories(Settings PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
4454

0 commit comments

Comments
 (0)