Skip to content

[CMAKE] Fix feature infos of debug options #768

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

Merged
Merged
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
22 changes: 10 additions & 12 deletions cmake/config-debug.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -13,31 +13,29 @@ set_property(CACHE RTS_DEBUG_PROFILE PROPERTY STRINGS DEFAULT ON OFF)
option(RTS_DEBUG_INCLUDE_DEBUG_LOG_IN_CRC_LOG "Include normal debug log in crc log" OFF)


add_feature_info(DebugLogging RTS_DEBUG_LOGGING "Build with Debug Logging")
add_feature_info(DebugCrashing RTS_DEBUG_CRASHING "Build with Debug Crashing")
add_feature_info(DebugStacktrace RTS_DEBUG_STACKTRACE "Build with Debug Stacktracing")
add_feature_info(DebugProfile RTS_DEBUG_PROFILE "Build with Debug Profiling")
add_feature_info(DebugIncludeDebugLogInCrcLog RTS_DEBUG_INCLUDE_DEBUG_LOG_IN_CRC_LOG "Build with Debug Logging in CRC log")


# Helper macro that handles DEFAULT ON OFF options
macro(define_debug_option OptionName OptionEnabledCompileDef OptionDisabledCompileDef)
macro(define_debug_option OptionName OptionEnabledCompileDef OptionDisabledCompileDef FeatureInfoName FeatureInfoDescription)
if(${OptionName} STREQUAL "DEFAULT")
# Does nothing
elseif(${OptionName} STREQUAL "ON")
target_compile_definitions(core_config INTERFACE ${OptionEnabledCompileDef}=1)
add_feature_info(${FeatureInfoName} TRUE ${FeatureInfoDescription})
elseif(${OptionName} STREQUAL "OFF")
target_compile_definitions(core_config INTERFACE ${OptionDisabledCompileDef}=1)
add_feature_info(${FeatureInfoName} FALSE ${FeatureInfoDescription})
else()
message(FATAL_ERROR "Unhandled option")
endif()
endmacro()


define_debug_option(RTS_DEBUG_LOGGING DEBUG_LOGGING DISABLE_DEBUG_LOGGING )
define_debug_option(RTS_DEBUG_CRASHING DEBUG_CRASHING DISABLE_DEBUG_CRASHING )
define_debug_option(RTS_DEBUG_STACKTRACE DEBUG_STACKTRACE DISABLE_DEBUG_STACKTRACE)
define_debug_option(RTS_DEBUG_PROFILE DEBUG_PROFILE DISABLE_DEBUG_PROFILE )
define_debug_option(RTS_DEBUG_LOGGING DEBUG_LOGGING DISABLE_DEBUG_LOGGING DebugLogging "Build with Debug Logging")
define_debug_option(RTS_DEBUG_CRASHING DEBUG_CRASHING DISABLE_DEBUG_CRASHING DebugCrashing "Build with Debug Crashing")
define_debug_option(RTS_DEBUG_STACKTRACE DEBUG_STACKTRACE DISABLE_DEBUG_STACKTRACE DebugStacktrace "Build with Debug Stacktracing")
define_debug_option(RTS_DEBUG_PROFILE DEBUG_PROFILE DISABLE_DEBUG_PROFILE DebugProfile "Build with Debug Profiling")

add_feature_info(DebugIncludeDebugLogInCrcLog RTS_DEBUG_INCLUDE_DEBUG_LOG_IN_CRC_LOG "Build with Debug Logging in CRC log")


if(RTS_DEBUG_INCLUDE_DEBUG_LOG_IN_CRC_LOG)
target_compile_definitions(core_config INTERFACE INCLUDE_DEBUG_LOG_IN_CRC_LOG)
Expand Down
Loading