Skip to content

Commit

Permalink
CMake: Add Print Summary
Browse files Browse the repository at this point in the history
  • Loading branch information
HTRamsey committed Sep 21, 2024
1 parent b00a7e5 commit 2f5db7a
Show file tree
Hide file tree
Showing 2 changed files with 66 additions and 14 deletions.
16 changes: 2 additions & 14 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -106,20 +106,6 @@ endif()

set(BUILD_SHARED_LIBS OFF)

# include(CMakePrintSystemInformation)
# include(ProcessorCount)
cmake_print_variables(
CMAKE_VERSION
CMAKE_PREFIX_PATH
CMAKE_HOST_SYSTEM_NAME
CMAKE_HOST_SYSTEM_VERSION
CMAKE_SYSTEM_NAME
CMAKE_SYSTEM_VERSION
CMAKE_CURRENT_SOURCE_DIR
CMAKE_BUILD_TYPE
CMAKE_TOOLCHAIN_FILE
)

#######################################################
# Qt6 Configuration
#######################################################
Expand Down Expand Up @@ -527,3 +513,5 @@ elseif(WIN32)
elseif(MACOS)
install(SCRIPT "${CMAKE_SOURCE_DIR}/cmake/CreateMacDMG.cmake")
endif()

include(printSummary)
64 changes: 64 additions & 0 deletions cmake/printSummary.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# output chosen build options
macro( OptionOutput _outputstring )
if( ${ARGN} )
set( _var "YES" )
else( ${ARGN} )
set( _var "NO" )
endif( ${ARGN} )
message( STATUS "${_outputstring}${_var}" )
endmacro( OptionOutput _outputstring )

function(printList items)
foreach (item ${items})
message("\t ${item}")
endforeach()
endfunction()

get_property(COMPILER_OPTIONS DIRECTORY ${CMAKE_SOURCE_DIR} PROPERTY COMPILE_OPTIONS)

include(CMakePrintHelpers)
# include(CMakePrintSystemInformation)
# include(ProcessorCount)

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 " --- Compiler 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 " --- 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 "" )

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}" )

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 )

0 comments on commit 2f5db7a

Please sign in to comment.