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 Jul 4, 2024
1 parent 72ab79c commit cedd3fe
Show file tree
Hide file tree
Showing 4 changed files with 78 additions and 47 deletions.
11 changes: 8 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,6 @@ find_package(Qt6
REQUIRED
COMPONENTS
Bluetooth
Charts
Concurrent
Core
Core5Compat
Expand All @@ -169,7 +168,9 @@ find_package(Qt6
Widgets
Xml
OPTIONAL_COMPONENTS
Charts
LinguistTools
Quick3D
SerialPort
HINTS
${QT_LIBRARY_HINTS}
Expand Down Expand Up @@ -198,8 +199,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 @@ -208,6 +207,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()

#######################################################
# Custom Build Configuration
#######################################################
Expand Down
28 changes: 27 additions & 1 deletion 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,12 +11,17 @@ qt_add_library(AnalyzeView STATIC
LogDownloadController.h
LogEntry.cc
LogEntry.h
<<<<<<< HEAD
MAVLinkChartController.cc
MAVLinkChartController.h
MAVLinkConsoleController.cc
MAVLinkConsoleController.h
MAVLinkInspectorController.cc
MAVLinkInspectorController.h
=======
MAVLinkConsoleController.cc
MAVLinkConsoleController.h
>>>>>>> 993ea034c (CMake: Add LGPL Option)
MAVLinkMessage.cc
MAVLinkMessage.h
MAVLinkMessageField.cc
Expand All @@ -33,7 +38,10 @@ qt_add_library(AnalyzeView STATIC

target_link_libraries(AnalyzeView
PRIVATE
<<<<<<< HEAD
Qt6::Charts
=======
>>>>>>> 993ea034c (CMake: Add LGPL Option)
Qt6::Gui
Qt6::Qml
FactSystem
Expand Down Expand Up @@ -89,3 +97,21 @@ target_include_directories(AnalyzeView PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
# 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
78 changes: 39 additions & 39 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,42 +51,42 @@ if(QGC_VIEWER3D)
)

target_include_directories(Viewer3D PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
else()
target_compile_definitions(Viewer3D PUBLIC QGC_DISABLE_VIEWER3D)
endif()

target_compile_definitions(Viewer3D PUBLIC QGC_VIEWER3D)

# file(GLOB_RECURSE QML_SOURCES RELATIVE Viewer3DQml Viewer3DQml/*.qml)
# file(GLOB_RECURSE QML_RESOURCES RELATIVE Viewer3DQml Viewer3DQml/*.mesh)
# qt_add_qml_module(Viewer3D
# URI QGroundControl.Viewer3D
# VERSION 1.0
# QML_FILES ${QML_SOURCES}
# OUTPUT_TARGETS Viewer3D_targets
# RESOURCES
# Images/city_3d_map_icon.svg
# SampleOsmMap/map_sim_small.osm
# Shaders/earthMaterial.frag
# Shaders/earthMaterial.vert
# ${QML_RESOURCES}
# IMPORT_PATH ${QT_QML_OUTPUT_DIRECTORY}
# IMPORTS
# QtQuick
# QtQuick.Controls
# QtQuick.Dialogs
# QtQuick.Layouts
# QtQuick3D
# QtPositioning
# file(GLOB_RECURSE QML_SOURCES RELATIVE Viewer3DQml Viewer3DQml/*.qml)
# file(GLOB_RECURSE QML_RESOURCES RELATIVE Viewer3DQml Viewer3DQml/*.mesh)
# qt_add_qml_module(Viewer3D
# URI QGroundControl.Viewer3D
# VERSION 1.0
# QML_FILES ${QML_SOURCES}
# OUTPUT_TARGETS Viewer3D_targets
# RESOURCES
# Images/city_3d_map_icon.svg
# SampleOsmMap/map_sim_small.osm
# Shaders/earthMaterial.frag
# Shaders/earthMaterial.vert
# ${QML_RESOURCES}
# IMPORT_PATH ${QT_QML_OUTPUT_DIRECTORY}
# IMPORTS
# QtQuick
# QtQuick.Controls
# QtQuick.Dialogs
# QtQuick.Layouts
# QtQuick3D
# QtPositioning

# QGroundControl
# QGroundControl.Controls
# QGroundControl.Controllers
# QGroundControl.FactSystem
# QGroundControl.FlightDisplay
# QGroundControl.FlightMap
# QGroundControl.Palette
# QGroundControl.ScreenTools
# QGroundControl.Vehicle
# QGroundControl
# QGroundControl.Controls
# QGroundControl.Controllers
# QGroundControl.FactSystem
# QGroundControl.FlightDisplay
# QGroundControl.FlightMap
# QGroundControl.Palette
# QGroundControl.ScreenTools
# QGroundControl.Vehicle

# QGroundControl.Viewer3D
# Viewer3D.Models3D
# )
endif()
# QGroundControl.Viewer3D
# Viewer3D.Models3D
# )

0 comments on commit cedd3fe

Please sign in to comment.