Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CMake: Add LGPL Option #11600

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,6 @@ find_package(Qt6
REQUIRED
COMPONENTS
Bluetooth
Charts
Concurrent
Core
Core5Compat
Expand All @@ -188,7 +187,9 @@ find_package(Qt6
Widgets
Xml
OPTIONAL_COMPONENTS
Charts
LinguistTools
Quick3D
SerialPort
HINTS
${QT_LIBRARY_HINTS}
Expand Down Expand Up @@ -217,8 +218,6 @@ if(QGC_BUILD_TESTING)
add_compile_definitions(UNITTEST_BUILD) # TODO: QGC_UNITTEST_BUILD
endif()

# option(QGC_DISABLE_MAVLINK_INSPECTOR "Disable Mavlink Inspector" OFF) # This removes QtCharts which is GPL licensed

cmake_dependent_option(QGC_DEBUG_QML "Build QGroundControl with QML debugging/profiling support." OFF "CMAKE_BUILD_TYPE STREQUAL Debug" OFF)
if(QGC_DEBUG_QML)
message(STATUS "To enable the QML debugger/profiler, run with: '-qmljsdebugger=port:1234'")
Expand All @@ -227,8 +226,9 @@ endif()

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

if(QGC_DISABLE_APM_MAVLINK)
add_compile_definitions(NO_ARDUPILOT_DIALECT)
if(QGC_LGPL_COMPATIBLE)
set(QGC_DISABLE_VIEWER3D ON CACHE INTERNAL "" FORCE)
set(QGC_DISABLE_MAVLINK_INSPECTOR ON CACHE INTERNAL "" FORCE)
endif()

if("${CMAKE_OSX_ARCHITECTURES}" MATCHES "arm64;x86_64" OR "${CMAKE_OSX_ARCHITECTURES}" MATCHES "x86_64;arm64")
Expand Down
2 changes: 2 additions & 0 deletions cmake/CustomOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,5 @@ option(QGC_DISABLE_APM_PLUGIN_FACTORY "Disable APM Plugin Factory" OFF)
# PX4
option(QGC_DISABLE_PX4_PLUGIN "Disable PX4 Plugin" OFF)
option(QGC_DISABLE_PX4_PLUGIN_FACTORY "Disable PX4 Plugin Factory" OFF)

option(QGC_LGPL_COMPATIBLE "Disable Dependencies that are LGPL Incompatible" OFF)
93 changes: 53 additions & 40 deletions src/AnalyzeView/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
find_package(Qt6 REQUIRED COMPONENTS Core Charts Gui Qml QmlIntegration)
find_package(Qt6 REQUIRED COMPONENTS Core Gui Qml QmlIntegration)

qt_add_library(AnalyzeView STATIC
ExifParser.cc
Expand All @@ -11,18 +11,8 @@ qt_add_library(AnalyzeView STATIC
LogDownloadController.h
LogEntry.cc
LogEntry.h
MAVLinkChartController.cc
MAVLinkChartController.h
MAVLinkConsoleController.cc
MAVLinkConsoleController.h
MAVLinkInspectorController.cc
MAVLinkInspectorController.h
MAVLinkMessage.cc
MAVLinkMessage.h
MAVLinkMessageField.cc
MAVLinkMessageField.h
MAVLinkSystem.cc
MAVLinkSystem.h
PX4LogParser.cc
PX4LogParser.h
ULogParser.cc
Expand All @@ -39,7 +29,6 @@ FetchContent_MakeAvailable(ulogparser)

target_link_libraries(AnalyzeView
PRIVATE
Qt6::Charts
Qt6::Gui
Qt6::Qml
ulog_cpp::ulog_cpp
Expand Down Expand Up @@ -69,7 +58,7 @@ target_sources(AnalyzeView
${easyexif_SOURCE_DIR}/exif.h
)

target_include_directories(AnalyzeView
target_include_directories(AnalyzeView
PUBLIC
${CMAKE_CURRENT_SOURCE_DIR}
${easyexif_SOURCE_DIR}
Expand All @@ -79,37 +68,61 @@ target_include_directories(AnalyzeView
# URI QGroundControl.AnalyzeView
# VERSION 1.0
# QML_FILES
# AnalyzePage.qml
# AnalyzeView.qml
# GeoTagPage.qml
# LogDownloadPage.qml
# MAVLinkConsolePage.qml
# MAVLinkInspectorPage.qml
# VibrationPage.qml
# AnalyzePage.qml
# AnalyzeView.qml
# GeoTagPage.qml
# LogDownloadPage.qml
# MAVLinkConsolePage.qml
# MAVLinkInspectorPage.qml
# VibrationPage.qml
# RESOURCES
# FloatingWindow.svg
# GeoTagIcon.svg
# LogDownloadIcon.svg
# MAVLinkConsoleIcon.svg
# MAVLinkInspector.svg
# VibrationPageIcon.png
# FloatingWindow.svg
# GeoTagIcon.svg
# LogDownloadIcon.svg
# MAVLinkConsoleIcon.svg
# MAVLinkInspector.svg
# VibrationPageIcon.png
# OUTPUT_TARGETS AnalyzeView_targets
# IMPORT_PATH ${QT_QML_OUTPUT_DIRECTORY}
# IMPORTS
# QtQuick
# QtQuick.Controls
# QtQuick.Dialogs
# QtQuick.Layouts
# QtQuick.Window
# QtCharts
# Qt.labs.qmlmodels
# QGroundControl
# QGroundControl.Palette
# QGroundControl.Controls
# QGroundControl.Controllers
# QGroundControl.FactSystem
# QGroundControl.FactControls
# QGroundControl.ScreenTools
# QtQuick
# QtQuick.Controls
# QtQuick.Dialogs
# QtQuick.Layouts
# QtQuick.Window
# QtCharts
# Qt.labs.qmlmodels
# QGroundControl
# QGroundControl.Palette
# QGroundControl.Controls
# QGroundControl.Controllers
# QGroundControl.FactSystem
# QGroundControl.FactControls
# QGroundControl.ScreenTools
# DEPENDENCIES
# QtCore
# )

find_package(Qt6 REQUIRED OPTIONAL_COMPONENTS Charts)
cmake_dependent_option(QGC_DISABLE_MAVLINK_INSPECTOR "Disable Mavlink Inspector" OFF "Qt6Charts_FOUND" ON) # This removes QtCharts which is GPL licensed
if(NOT QGC_DISABLE_MAVLINK_INSPECTOR)
target_sources(AnalyzeView
PRIVATE
MAVLinkChartController.cc
MAVLinkChartController.h
MAVLinkInspectorController.cc
MAVLinkInspectorController.h
MAVLinkMessage.cc
MAVLinkMessage.h
MAVLinkMessageField.cc
MAVLinkMessageField.h
MAVLinkSystem.cc
MAVLinkSystem.h
)
target_link_libraries(AnalyzeView
PRIVATE
Qt6::Charts
)
else()
target_compile_definitions(AnalyzeView PUBLIC QGC_DISABLE_MAVLINK_INSPECTOR)
endif()
12 changes: 9 additions & 3 deletions src/AutoPilotPlugins/APM/APMAutoPilotPlugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,9 @@
#include "APMFlightModesComponent.h"
#include "APMRadioComponent.h"
#include "APMSafetyComponent.h"
#ifndef DISABLE_APMTUNINGCOMPONENT
#include "APMTuningComponent.h"
#endif
#include "APMSensorsComponent.h"
#include "APMPowerComponent.h"
#include "APMMotorComponent.h"
Expand Down Expand Up @@ -120,9 +122,11 @@ const QVariantList& APMAutoPilotPlugin::vehicleComponents(void)
_components.append(QVariant::fromValue((VehicleComponent*)_heliComponent));
}

_tuningComponent = new APMTuningComponent(_vehicle, this);
_tuningComponent->setupTriggerSignals();
_components.append(QVariant::fromValue((VehicleComponent*)_tuningComponent));
#ifndef DISABLE_APMTUNINGCOMPONENT
_tuningComponent = new APMTuningComponent(_vehicle, this);
_tuningComponent->setupTriggerSignals();
_components.append(QVariant::fromValue((VehicleComponent*)_tuningComponent));
#endif

if(_vehicle->parameterManager()->parameterExists(-1, "MNT1_TYPE")) {
_cameraComponent = new APMCameraComponent(_vehicle, this);
Expand Down Expand Up @@ -180,8 +184,10 @@ QString APMAutoPilotPlugin::prerequisiteSetup(VehicleComponent* component) const
requiresAirframeCheck = true;
} else if (qobject_cast<const APMSafetyComponent*>(component)) {
requiresAirframeCheck = true;
#ifndef DISABLE_APMTUNINGCOMPONENT
} else if (qobject_cast<const APMTuningComponent*>(component)) {
requiresAirframeCheck = true;
#endif
} else if (qobject_cast<const APMSensorsComponent*>(component)) {
requiresAirframeCheck = true;
}
Expand Down
12 changes: 10 additions & 2 deletions src/AutoPilotPlugins/APM/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,18 @@ qt_add_library(APMAutoPilotPlugin STATIC
APMSubFrameComponent.h
APMSubMotorComponentController.cc
APMSubMotorComponentController.h
APMTuningComponent.cc
APMTuningComponent.h
)

if(NOT QGC_LGPL_COMPATIBLE)
target_sources(APMAutoPilotPlugin
PRIVATE
APMTuningComponent.cc
APMTuningComponent.h
)
else()
target_compile_definitions(APMAutoPilotPlugin PUBLIC DISABLE_APMTUNINGCOMPONENT)
endif()

target_link_libraries(APMAutoPilotPlugin
PRIVATE
APMFirmwarePlugin
Expand Down
12 changes: 10 additions & 2 deletions src/AutoPilotPlugins/PX4/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,6 @@ qt_add_library(PX4AutoPilotPlugin STATIC
PX4RadioComponent.h
PX4SimpleFlightModesController.cc
PX4SimpleFlightModesController.h
PX4TuningComponent.cc
PX4TuningComponent.h
SafetyComponent.cc
SafetyComponent.h
SensorsComponent.cc
Expand All @@ -37,6 +35,16 @@ qt_add_library(PX4AutoPilotPlugin STATIC
SensorsComponentController.h
)

if(NOT QGC_LGPL_COMPATIBLE)
target_sources(PX4AutoPilotPlugin
PRIVATE
PX4TuningComponent.cc
PX4TuningComponent.h
)
else()
target_compile_definitions(PX4AutoPilotPlugin PUBLIC DISABLE_PX4TUNINGCOMPONENT)
endif()

target_link_libraries(PX4AutoPilotPlugin
PRIVATE
Comms
Expand Down
12 changes: 9 additions & 3 deletions src/AutoPilotPlugins/PX4/PX4AutoPilotPlugin.cc
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,9 @@
#include "QGCApplication.h"
#include "FlightModesComponent.h"
#include "PX4RadioComponent.h"
#ifndef DISABLE_PX4TUNINGCOMPONENT
#include "PX4TuningComponent.h"
#endif
#include "PowerComponent.h"
#include "SafetyComponent.h"
#include "SensorsComponent.h"
Expand Down Expand Up @@ -104,9 +106,11 @@ const QVariantList& PX4AutoPilotPlugin::vehicleComponents(void)
_safetyComponent->setupTriggerSignals();
_components.append(QVariant::fromValue(static_cast<VehicleComponent*>(_safetyComponent)));

_tuningComponent = new PX4TuningComponent(_vehicle, this, this);
_tuningComponent->setupTriggerSignals();
_components.append(QVariant::fromValue(static_cast<VehicleComponent*>(_tuningComponent)));
#ifndef DISABLE_PX4TUNINGCOMPONENT
_tuningComponent = new PX4TuningComponent(_vehicle, this, this);
_tuningComponent->setupTriggerSignals();
_components.append(QVariant::fromValue(static_cast<VehicleComponent*>(_tuningComponent)));
#endif

if(_vehicle->parameterManager()->parameterExists(_vehicle->id(), "SYS_VEHICLE_RESP")) {
_flightBehavior = new PX4FlightBehavior(_vehicle, this, this);
Expand Down Expand Up @@ -175,8 +179,10 @@ QString PX4AutoPilotPlugin::prerequisiteSetup(VehicleComponent* component) const
if (_vehicle->parameterManager()->getParameter(-1, "COM_RC_IN_MODE")->rawValue().toInt() != 1) {
requiresAirframeCheck = true;
}
#ifndef DISABLE_PX4TUNINGCOMPONENT
} else if (qobject_cast<const PX4TuningComponent*>(component)) {
requiresAirframeCheck = true;
#endif
} else if (qobject_cast<const PowerComponent*>(component)) {
requiresAirframeCheck = true;
} else if (qobject_cast<const SafetyComponent*>(component)) {
Expand Down
16 changes: 11 additions & 5 deletions src/FlightDisplay/FlyView.qml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ Item {
// These should only be used by MainRootWindow
property var planController: _planController
property var guidedController: _guidedController
property var viewer3DWindow: view3DManagerLoader.active ? view3DManagerLoader.item : null

// Properties of UTM adapter
property bool utmspSendActTrigger: false
Expand Down Expand Up @@ -100,7 +101,7 @@ Item {
pipMode: !_mainWindowIsMap
toolInsets: customOverlay.totalToolInsets
mapName: "FlightDisplayView"
enabled: !viewer3DWindow.isOpen
enabled: view3DManagerLoader.active && !viewer3DWindow.isOpen
}

FlyViewVideo {
Expand Down Expand Up @@ -135,7 +136,7 @@ Item {
mapControl: _mapControl
visible: !QGroundControl.videoManager.fullScreen
utmspActTrigger: utmspSendActTrigger
isViewer3DOpen: viewer3DWindow.isOpen
isViewer3DOpen: view3DManagerLoader.active && viewer3DWindow.isOpen
}

FlyViewCustomLayer {
Expand Down Expand Up @@ -186,9 +187,14 @@ Item {
visible: false
}

Viewer3D{
id: viewer3DWindow
anchors.fill: parent
Loader {
id: view3DManagerLoader
active: QGroundControl.has3DViewer
source: "qrc:/Viewer3D/Viewer3D.qml"
// sourceComponent: Viewer3D {
// id: viewer3DWindow
// anchors.fill: parent
// }
}
}
}
8 changes: 4 additions & 4 deletions src/QGCApplication.cc
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@
#include "AudioOutput.h"
#include "FollowMe.h"
#include "JsonHelper.h"
// #ifdef QGC_VIEWER3D
#ifndef QGC_DISABLE_VIEWER3D
#include "Viewer3DManager.h"
// #endif
#endif
#include "GimbalController.h"
#ifndef NO_SERIAL_LINK
#include "FirmwareUpgradeController.h"
Expand Down Expand Up @@ -341,9 +341,9 @@ void QGCApplication::init()
qmlRegisterSingletonType<ScreenToolsController> ("QGroundControl.ScreenToolsController", 1, 0, "ScreenToolsController", screenToolsControllerSingletonFactory);


// #ifdef QGC_VIEWER3D
#ifndef QGC_DISABLE_VIEWER3D
Viewer3DManager::registerQmlTypes();
// #endif
#endif

qmlRegisterUncreatableType<Autotune> ("QGroundControl.Vehicle", 1, 0, "Autotune", "Reference only");
qmlRegisterUncreatableType<RemoteIDManager> ("QGroundControl.Vehicle", 1, 0, "RemoteIDManager", "Reference only");
Expand Down
1 change: 1 addition & 0 deletions src/QmlControls/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ target_link_libraries(QmlControls
UTMSP
Vehicle
VideoManager
Viewer3D
)

target_include_directories(QmlControls PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
Expand Down
7 changes: 7 additions & 0 deletions src/QmlControls/QGroundControlQmlGlobal.h
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,7 @@ class QGroundControlQmlGlobal : public QGCTool
Q_PROPERTY(int mavlinkSystemID READ mavlinkSystemID WRITE setMavlinkSystemID NOTIFY mavlinkSystemIDChanged)
Q_PROPERTY(bool hasAPMSupport READ hasAPMSupport CONSTANT)
Q_PROPERTY(bool hasMAVLinkInspector READ hasMAVLinkInspector CONSTANT)
Q_PROPERTY(bool has3DViewer READ has3DViewer CONSTANT)


//-------------------------------------------------------------------------
Expand Down Expand Up @@ -218,6 +219,12 @@ class QGroundControlQmlGlobal : public QGCTool
bool hasMAVLinkInspector () { return true; }
#endif

#if defined(QGC_DISABLE_VIEWER3D)
bool has3DViewer () { return false; }
#else
bool has3DViewer () { return true; }
#endif

static QString elevationProviderName ();
static QString elevationProviderNotice ();

Expand Down
Loading
Loading