Skip to content

Commit

Permalink
CMake: Move Some Options to CustomOptions.cmake
Browse files Browse the repository at this point in the history
  • Loading branch information
HTRamsey committed Nov 22, 2024
1 parent bf85bee commit fb11f31
Show file tree
Hide file tree
Showing 10 changed files with 93 additions and 50 deletions.
3 changes: 0 additions & 3 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -206,7 +206,6 @@ qt_policy(
# QGroundControl Options
#######################################################

option(QGC_STABLE_BUILD "Stable build option" OFF)
if(NOT QGC_STABLE_BUILD)
add_compile_definitions(DAILY_BUILD)
endif()
Expand All @@ -226,8 +225,6 @@ if(QGC_DEBUG_QML)
add_compile_definitions(QT_QML_DEBUG)
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)
endif()
Expand Down
21 changes: 19 additions & 2 deletions cmake/CustomOptions.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,11 @@ set(QGC_APP_DESCRIPTION "Open Source Ground Control App" CACHE STRING "Descripti
set(QGC_ORG_NAME "QGroundControl.org" CACHE STRING "Org Name")
set(QGC_ORG_DOMAIN "org.qgroundcontrol" CACHE STRING "Domain")

option(QGC_STABLE_BUILD "Stable Build" OFF)

# MacOS
set(QGC_BUNDLE_ID "org.qgroundcontrol.QGroundControl" CACHE STRING "MacOS Bundle ID")
set(QGC_MACOS_ICON_PATH "${CMAKE_SOURCE_DIR}/deploy/mac" CACHE PATH "MacOS Icon Path")
set(QGC_BUNDLE_ID "org.qgroundcontrol.QGroundControl" CACHE STRING "MacOS Bundle ID") # MACOS
set(QGC_MACOS_ICON_PATH "${CMAKE_SOURCE_DIR}/deploy/mac" CACHE PATH "MacOS Icon Path") # MACOS

# APM
option(QGC_DISABLE_APM_MAVLINK "Disable APM Dialect" OFF)
Expand All @@ -17,3 +19,18 @@ 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_ENABLE_BLUETOOTH "Enable Bluetooth Links" ON) # Qt6Bluetooth_FOUND
option(QGC_ZEROCONF_ENABLED "Enable ZeroConf Compatibility" OFF)
option(QGC_AIRLINK_DISABLED "Disable AIRLink" ON)
option(QGC_NO_SERIAL_LINK "Disable Serial Links" OFF) # NOT IOS AND Qt6SerialPort_FOUND

option(QGC_UTM_ADAPTER "Enable UTM Adapter" OFF)
option(QGC_VIEWER3D "Enable Viewer3D" ON) # Qt6Quick3D_FOUND

option(QGC_ENABLE_UVC "Enable UVC Devices" ON) # Qt6Multimedia_FOUND
option(QGC_ENABLE_GST_VIDEOSTREAMING "Enable GStreamer Video Backend" ON)
option(QGC_ENABLE_QT_VIDEOSTREAMING "Enable QtMultimedia Video Backend" OFF) # Qt6Multimedia_FOUND

set(QGC_MAVLINK_GIT_REPO "https://github.com/mavlink/c_library_v2.git" CACHE STRING "URL to MAVLink Git Repo")
set(QGC_MAVLINK_GIT_TAG "4db2f67156d996eae90ef437a73353468d850407" CACHE STRING "Tag of MAVLink Git Repo")
95 changes: 61 additions & 34 deletions cmake/printSummary.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,45 +20,72 @@ include(CMakePrintHelpers)
# include(CMakePrintSystemInformation)
# include(ProcessorCount)

message( STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}" )
message( STATUS "Install prefix: ${CMAKE_INSTALL_PREFIX}" )
message( STATUS "------------------------------------------------------------------" )
message( STATUS "CMake Generator: ${CMAKE_GENERATOR}" )
message( STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}" )
message( STATUS "Compiler info: ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) ; version: ${CMAKE_CXX_COMPILER_VERSION}" )
message( STATUS "CMAKE_CXX_STANDARD: ${CMAKE_CXX_STANDARD}" )
message( STATUS "CMake Generator: ${CMAKE_GENERATOR}" )
message( STATUS "CMAKE_BUILD_TYPE: ${CMAKE_BUILD_TYPE}" )
message( STATUS "Compiler info: ${CMAKE_CXX_COMPILER_ID} (${CMAKE_CXX_COMPILER}) ; version: ${CMAKE_CXX_COMPILER_VERSION}" )
message( STATUS "CMAKE_CXX_STANDARD: ${CMAKE_CXX_STANDARD}" )
message( STATUS " --- Compiler flags --- ")
message( STATUS "General: ${CMAKE_CXX_FLAGS}" )
message( STATUS "General: ${CMAKE_CXX_FLAGS}" )
printList("${COMPILER_OPTIONS}")
message( STATUS "Extra: ${EXTRA_COMPILE_FLAGS}" )
message( STATUS "Debug: ${CMAKE_CXX_FLAGS_DEBUG}" )
message( STATUS "Release: ${CMAKE_CXX_FLAGS_RELEASE}" )
message( STATUS "RelWithDebInfo: ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}" )
message( STATUS "MinSizeRel: ${CMAKE_CXX_FLAGS_MINSIZEREL}" )
message( STATUS "Extra: ${EXTRA_COMPILE_FLAGS}" )
message( STATUS "Debug: ${CMAKE_CXX_FLAGS_DEBUG}" )
message( STATUS "Release: ${CMAKE_CXX_FLAGS_RELEASE}" )
message( STATUS "RelWithDebInfo: ${CMAKE_CXX_FLAGS_RELWITHDEBINFO}" )
message( STATUS "MinSizeRel: ${CMAKE_CXX_FLAGS_MINSIZEREL}" )
message( STATUS " --- Linker flags --- ")
message( STATUS "General: ${CMAKE_EXE_LINKER_FLAGS}" )
message( STATUS "Debug: ${CMAKE_EXE_LINKER_FLAGS_DEBUG}" )
message( STATUS "Release: ${CMAKE_EXE_LINKER_FLAGS_RELEASE}" )
message( STATUS "RelWithDebInfo: ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO}" )
message( STATUS "MinSizeRel: ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL}" )
message( STATUS "General: ${CMAKE_EXE_LINKER_FLAGS}" )
message( STATUS "Debug: ${CMAKE_EXE_LINKER_FLAGS_DEBUG}" )
message( STATUS "Release: ${CMAKE_EXE_LINKER_FLAGS_RELEASE}" )
message( STATUS "RelWithDebInfo: ${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO}" )
message( STATUS "MinSizeRel: ${CMAKE_EXE_LINKER_FLAGS_MINSIZEREL}" )
message( STATUS "" )

message( STATUS "CMake Version: ${CMAKE_VERSION}" )
message( STATUS "CMake Prefix: ${CMAKE_PREFIX_PATH}" )
message( STATUS "CMake Host System Name: ${CMAKE_HOST_SYSTEM_NAME}" )
message( STATUS "CMake Host System Version: ${CMAKE_HOST_SYSTEM_VERSION}" )
message( STATUS "CMake System Name: ${CMAKE_SYSTEM_NAME}" )
message( STATUS "CMake System Version: ${CMAKE_SYSTEM_VERSION}" )
message( STATUS "CMake Source Dir: ${CMAKE_SOURCE_DIR}" )
message( STATUS "CMake Toolchain File: ${CMAKE_TOOLCHAIN_FILE}" )
message( STATUS "CMake Version: ${CMAKE_VERSION}" )
message( STATUS "CMake Prefix: ${CMAKE_PREFIX_PATH}" )
message( STATUS "CMake Host System Name: ${CMAKE_HOST_SYSTEM_NAME}" )
message( STATUS "CMake Host System Version: ${CMAKE_HOST_SYSTEM_VERSION}" )
message( STATUS "CMake System Name: ${CMAKE_SYSTEM_NAME}" )
message( STATUS "CMake System Version: ${CMAKE_SYSTEM_VERSION}" )
message( STATUS "CMake Source Dir: ${CMAKE_SOURCE_DIR}" )
message( STATUS "CMake Toolchain File: ${CMAKE_TOOLCHAIN_FILE}" )

message( STATUS "App Name: ${QGC_APP_NAME}" )
message( STATUS "Org Name: ${QGC_ORG_NAME}" )
message( STATUS "App Domain: ${QGC_ORG_DOMAIN}" )
message( STATUS "App Version: ${QGC_APP_VERSION_STR}" )
message( STATUS "App Name: ${QGC_APP_NAME}" )
message( STATUS "App Copyright: ${QGC_APP_COPYRIGHT}" )
message( STATUS "App Description: ${QGC_APP_DESCRIPTION}" )
message( STATUS "Org Name: ${QGC_ORG_NAME}" )
message( STATUS "App Domain: ${QGC_ORG_DOMAIN}" )
message( STATUS "App Version: ${QGC_APP_VERSION_STR}" )

OptionOutput( "Stable Build: " QGC_STABLE_BUILD )
OptionOutput( "Building Tests: " QGC_BUILD_TESTING AND BUILD_TESTING )
OptionOutput( "Debug QML: " QGC_DEBUG_QML )
OptionOutput( "No Serial Links: " QGC_NO_SERIAL_LINK )
OptionOutput( "Disable APM MAVLink: " QGC_DISABLE_APM_MAVLINK )
OptionOutput( "Build Dependencies: " QGC_BUILD_DEPENDENCIES )
if(MACOS)
message( STATUS "MacOS Bundle ID: ${QGC_BUNDLE_ID}" )
message( STATUS "MacOS Icon Path: ${QGC_MACOS_ICON_PATH}" )
endif()

OptionOutput( "Stable Build: " QGC_STABLE_BUILD )
OptionOutput( "Building Tests: " QGC_BUILD_TESTING AND BUILD_TESTING )
OptionOutput( "Debug QML: " QGC_DEBUG_QML )
OptionOutput( "Build Dependencies: " QGC_BUILD_DEPENDENCIES )

OptionOutput( "Disable APM Dialect: " QGC_DISABLE_APM_MAVLINK )
OptionOutput( "Disable APM Plugin: " QGC_DISABLE_APM_PLUGIN )
OptionOutput( "Disable APM Plugin Factory: " QGC_DISABLE_APM_PLUGIN_FACTORY )

OptionOutput( "Disable PX4 Plugin: " QGC_DISABLE_PX4_PLUGIN )
OptionOutput( "Disable PX4 Plugin Factory: " QGC_DISABLE_PX4_PLUGIN_FACTORY )

OptionOutput( "Enable Bluetooth Links: " QGC_ENABLE_BLUETOOTH )
OptionOutput( "Enable ZeroConf: " QGC_ZEROCONF_ENABLED )
OptionOutput( "Disable AIRLink: " QGC_AIRLINK_DISABLED )
OptionOutput( "Disable Serial Links: " QGC_NO_SERIAL_LINK )

OptionOutput( "Enable UTM Adapter: " QGC_UTM_ADAPTER )
OptionOutput( "Enable Viewer3D: " QGC_VIEWER3D )

OptionOutput( "Enable UVC Devices: " QGC_ENABLE_UVC )
OptionOutput( "Enable GStreamer: " QGC_ENABLE_GST_VIDEOSTREAMING )
OptionOutput( "Enable QtMultimedia: " QGC_ENABLE_QT_VIDEOSTREAMING )

message( STATUS "MAVLink Git Repo: ${QGC_MAVLINK_GIT_REPO}" )
message( STATUS "MAVLink Git Tag: ${QGC_MAVLINK_GIT_TAG}" )
1 change: 0 additions & 1 deletion src/Comms/AirLink/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ find_package(Qt6 REQUIRED COMPONENTS Core)

qt_add_library(AirLink STATIC)

option(QGC_AIRLINK_DISABLED "Enable airlink" ON)
if(NOT QGC_AIRLINK_DISABLED)
find_package(Qt6 REQUIRED COMPONENTS Network QmlIntegration)

Expand Down
2 changes: 0 additions & 2 deletions src/Comms/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,6 @@ endif()

############# Bluetooth

option(QGC_ENABLE_BLUETOOTH "Enable Bluetooth Links" ON)
if(QGC_ENABLE_BLUETOOTH)
find_package(Qt6 REQUIRED COMPONENTS Bluetooth)
target_link_libraries(Comms PUBLIC Qt6::Bluetooth)
Expand All @@ -90,7 +89,6 @@ endif()

############# ZEROConf

option(QGC_ZEROCONF_ENABLED "Enable ZeroConf Compatibility" OFF)
if(QGC_ZEROCONF_ENABLED)
set(BUILD_DOC OFF CACHE INTERNAL "")
set(BUILD_EXAMPLES OFF CACHE INTERNAL "")
Expand Down
15 changes: 13 additions & 2 deletions src/MAVLink/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,20 @@ target_include_directories(MAVLink PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})
############# MAVLink

include(FetchContent)

# TODO:
# FetchContent_Declare(mavlink
# GIT_REPOSITORY https://github.com/mavlink/mavlink.git
# GIT_TAG master
# GIT_SHALLOW TRUE
# )
# set(MAVLINK_DIALECT all)
# set(MAVLINK_VERSION 2.0)
# FetchContent_MakeAvailable(mavlink)

FetchContent_Declare(mavlink
GIT_REPOSITORY https://github.com/mavlink/c_library_v2.git
GIT_TAG 4db2f67156d996eae90ef437a73353468d850407
GIT_REPOSITORY ${QGC_MAVLINK_GIT_REPO}
GIT_TAG ${QGC_MAVLINK_GIT_TAG}
)
FetchContent_MakeAvailable(mavlink)

Expand Down
1 change: 0 additions & 1 deletion src/UTMSP/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@ find_package(Qt6 REQUIRED COMPONENTS Core)
set(UTMSP_RESOURCES)
qt_add_library(UTMSP STATIC)

option(QGC_UTM_ADAPTER "Enable UTM Adapter" OFF)
if(QGC_UTM_ADAPTER)
message(STATUS "UTMSP is Initialized")
add_definitions(-DQGC_UTM_ADAPTER)
Expand Down
1 change: 0 additions & 1 deletion src/VideoManager/VideoReceiver/GStreamer/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@ target_link_libraries(GStreamerReceiver PUBLIC Qt6::Quick)

target_include_directories(GStreamerReceiver PUBLIC ${CMAKE_CURRENT_SOURCE_DIR})

option(QGC_ENABLE_GST_VIDEOSTREAMING "Enable GStreamer Video Streaming Backend" ON)
cmake_print_variables(QGC_ENABLE_GST_VIDEOSTREAMING)
if(NOT QGC_ENABLE_GST_VIDEOSTREAMING)
return()
Expand Down
2 changes: 0 additions & 2 deletions src/VideoManager/VideoReceiver/QtMultimedia/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ find_package(Qt6 REQUIRED COMPONENTS Core)

qt_add_library(QtMultimediaReceiver STATIC)

option(QGC_ENABLE_QT_VIDEOSTREAMING "Enable QtMultimedia Video Streaming Backend" OFF)
cmake_print_variables(QGC_ENABLE_QT_VIDEOSTREAMING)
if(NOT QGC_ENABLE_QT_VIDEOSTREAMING)
return()
Expand Down Expand Up @@ -32,7 +31,6 @@ target_include_directories(QtMultimediaReceiver PUBLIC ${CMAKE_CURRENT_SOURCE_DI

target_compile_definitions(QtMultimediaReceiver PUBLIC QGC_QT_STREAMING)

option(QGC_ENABLE_UVC "Disable UVC Devices" ON)
if(NOT QGC_ENABLE_UVC)
target_compile_definitions(QtMultimediaReceiver PUBLIC QGC_DISABLE_UVC)
return()
Expand Down
2 changes: 0 additions & 2 deletions src/Viewer3D/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,8 +2,6 @@ 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)
message(STATUS "Viewer3D is Initialized")

Expand Down

0 comments on commit fb11f31

Please sign in to comment.