Skip to content

Commit

Permalink
CMake: Add LGPL Option
Browse files Browse the repository at this point in the history
  • Loading branch information
HTRamsey committed Jun 6, 2024
1 parent b6dd438 commit caebdb0
Show file tree
Hide file tree
Showing 4 changed files with 100 additions and 82 deletions.
11 changes: 8 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,6 @@ find_package(Qt6
REQUIRED
COMPONENTS
Bluetooth
Charts
Concurrent
Core
Core5Compat
Expand All @@ -152,7 +151,9 @@ find_package(Qt6
Widgets
Xml
OPTIONAL_COMPONENTS
Charts
LinguistTools
Quick3D
SerialPort
HINTS
${QT_LIBRARY_HINTS}
Expand Down Expand Up @@ -183,8 +184,6 @@ endif()

# option(QGC_CUSTOM_BUILD "Enable Custom Build" OFF)

# 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 @@ -193,6 +192,12 @@ endif()

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

option(QGC_LGPL_COMPATIBLE "Disable Dependencies that are LGPL Incompatible")
if(QGC_LGPL_COMPATIBLE)
set(QGC_DISABLE_VIEWER3D ON)
set(QGC_DISABLE_MAVLINK_INSPECTOR ON)
endif()

#######################################################
# QGroundControl Resources
#######################################################
Expand Down
151 changes: 82 additions & 69 deletions src/AnalyzeView/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -1,50 +1,45 @@
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
ExifParser.h
GeoTagController.cc
GeoTagController.h
GeoTagWorker.cc
GeoTagWorker.h
LogDownloadController.cc
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
ULogParser.h
ExifParser.cc
ExifParser.h
GeoTagController.cc
GeoTagController.h
GeoTagWorker.cc
GeoTagWorker.h
LogDownloadController.cc
LogDownloadController.h
LogEntry.cc
LogEntry.h
MAVLinkConsoleController.cc
MAVLinkConsoleController.h
MAVLinkMessage.cc
MAVLinkMessage.h
MAVLinkMessageField.cc
MAVLinkMessageField.h
MAVLinkSystem.cc
MAVLinkSystem.h
PX4LogParser.cc
PX4LogParser.h
ULogParser.cc
ULogParser.h
)

target_link_libraries(AnalyzeView
PRIVATE
Qt6::Charts
Qt6::Gui
Qt6::Qml
FactSystem
QGC
QGCLocation
Settings
Utilities
Vehicle
PUBLIC
Qt6::Core
Qt6::QmlIntegration
MAVLink
QmlControls
PRIVATE
Qt6::Gui
Qt6::Qml
FactSystem
QGC
QGCLocation
Settings
Utilities
Vehicle
PUBLIC
Qt6::Core
Qt6::QmlIntegration
MAVLink
QmlControls
)

target_include_directories(AnalyzeView PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
Expand All @@ -53,37 +48,55 @@ target_include_directories(AnalyzeView PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
# 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
)
target_link_libraries(AnalyzeView
PRIVATE
Qt6::Charts
)
else()
target_compile_definitions(AnalyzeView PUBLIC QGC_DISABLE_MAVLINK_INSPECTOR)
endif()
8 changes: 4 additions & 4 deletions src/QGCApplication.cc
Original file line number Diff line number Diff line change
Expand Up @@ -100,9 +100,9 @@
#include "CustomActionManager.h"
#include "AudioOutput.h"
#include "JsonHelper.h"
// #ifdef QGC_VIEWER3D
#ifndef QGC_DISABLE_VIEWER3D
#include "Viewer3DManager.h"
// #endif
#endif
#ifndef NO_SERIAL_LINK
#include "FirmwareUpgradeController.h"
#include "SerialLink.h"
Expand Down Expand Up @@ -344,9 +344,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
12 changes: 6 additions & 6 deletions src/Viewer3D/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ find_package(Qt6 REQUIRED COMPONENTS Core)

qt_add_library(Viewer3D STATIC)

find_package(Qt6 COMPONENTS Quick3D)
cmake_dependent_option(QGC_VIEWER3D "Enable Viewer3D" ON "Qt6Quick3D_FOUND" OFF)
if(QGC_VIEWER3D)
find_package(Qt6 COMPONENTS OPTIONAL_COMPONENTS Quick3D)
cmake_dependent_option(QGC_DISABLE_VIEWER3D "Disable Viewer3D" OFF "Qt6Quick3D_FOUND" ON) # This removes QtQuick3D which is GPL licensed
if(NOT QGC_DISABLE_VIEWER3D)
message(STATUS "Viewer3D is Initialized")

find_package(Qt6 REQUIRED COMPONENTS Core Gui Network Positioning Qml Quick3D Xml)
Expand Down Expand Up @@ -51,9 +51,9 @@ if(QGC_VIEWER3D)
)

target_include_directories(Viewer3D PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

target_compile_definitions(Viewer3D PUBLIC QGC_VIEWER3D)

else()
target_compile_definitions(Viewer3D PUBLIC QGC_DISABLE_VIEWER3D)
endif()
# file(GLOB_RECURSE QML_SOURCES RELATIVE Viewer3DQml Viewer3DQml/*.qml)
# file(GLOB_RECURSE QML_RESOURCES RELATIVE Viewer3DQml Viewer3DQml/*.mesh)
# qt_add_qml_module(Viewer3D
Expand Down

0 comments on commit caebdb0

Please sign in to comment.