diff --git a/CMakeLists.txt b/CMakeLists.txt index 3c69ea1f9..5a6dd6edf 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -82,7 +82,7 @@ kompute_option(KOMPUTE_OPT_INSTALL "Enable if you want to enable installation." # Build options kompute_option(KOMPUTE_OPT_BUILD_PYTHON "Enable if you want to build python bindings." OFF) -kompute_log_level(KOMPUTE_OPT_LOG_LEVEL "Internally we use spdlog for logging. The log level used can be changed here." "Default") +kompute_log_level(KOMPUTE_OPT_LOG_LEVEL "Internally we use spdlog for logging. The log level used can be changed here. Possible values: 'Trace', 'Debug', 'Info', 'Warn', 'Error', 'Critical', 'Off', 'Default'. If set to 'Off' spdlog will be deactivated completely. If set to 'Default', the log level will be set to 'Info' for release builds and 'Debug' else." "Default") kompute_option(KOMPUTE_OPT_ANDROID_BUILD "Enable android compilation flags required." OFF) kompute_option(KOMPUTE_OPT_DISABLE_VK_DEBUG_LAYERS "Explicitly disable debug layers even on debug." OFF) kompute_option(KOMPUTE_OPT_DISABLE_VULKAN_VERSION_CHECK "Whether to check if your driver supports the Vulkan Header version you are linking against. This might be useful in case you build shared on a different system than you run later." OFF) diff --git a/docs/overview/build-system.rst b/docs/overview/build-system.rst index db652372f..370510115 100644 --- a/docs/overview/build-system.rst +++ b/docs/overview/build-system.rst @@ -37,7 +37,7 @@ This by default configures without any of the extra build tasks (such as buildin * - -DKOMPUTE_OPT_BUILD_PYTHON=ON - Enable if you want to build python bindings. * - -DKOMPUTE_OPT_LOG_LEVEL="Trace" - - Internally we use spdlog for logging. The log level used can be changed here. + - Internally we use spdlog for logging. The log level used can be changed here. Possible values: 'Trace', 'Debug', 'Info', 'Warn', 'Error', 'Critical', 'Off', 'Default'. If set to 'Off' spdlog will be deactivated completely. If set to 'Default', the log level will be set to 'Info' for release builds and 'Debug' else. * - -DKOMPUTE_OPT_ANDROID_BUILD=ON - Enable android compilation flags required. * - -DKOMPUTE_OPT_DISABLE_VK_DEBUG_LAYERS=ON diff --git a/src/logger/CMakeLists.txt b/src/logger/CMakeLists.txt index 86b954794..0f54ef670 100644 --- a/src/logger/CMakeLists.txt +++ b/src/logger/CMakeLists.txt @@ -23,16 +23,14 @@ elseif(${KOMPUTE_OPT_LOG_LEVEL} STREQUAL "Error") elseif(${KOMPUTE_OPT_LOG_LEVEL} STREQUAL "Critical") set(KOMPUTE_OPT_LOG_LEVEL CRITICAL) message(STATUS "Using log level Critical") -elseif(${KOMPUTE_OPT_LOG_LEVEL} STREQUAL Off) +elseif(${KOMPUTE_OPT_LOG_LEVEL} STREQUAL "Off") set(KOMPUTE_OPT_LOG_LEVEL OFF) message(STATUS "Using log level Off") -else() - if((NOT ${KOMPUTE_OPT_LOG_LEVEL} STREQUAL Default) AND(NOT KOMPUTE_OPT_LOG_LEVEL STREQUAL "")) - message(WARNING "Log level '${KOMPUTE_OPT_LOG_LEVEL}' unknown, use -DKOMPUTE_OPT_LOG_LEVEL=[Trace, Debug, Info, Warn, Error, Critical, Off]") - endif() - +elseif(${KOMPUTE_OPT_LOG_LEVEL} STREQUAL "Default") set(KOMPUTE_OPT_LOG_LEVEL $,DEBUG,INFO>) message(STATUS "Setting KOMPUTE_OPT_LOG_LEVEL to according to build type") +else() + message(FATAL_ERROR "Log level '${KOMPUTE_OPT_LOG_LEVEL}' unknown, use -DKOMPUTE_OPT_LOG_LEVEL={Trace, Debug, Info, Warn, Error, Critical, Off, Default} to set it to a correct value.") endif() target_compile_definitions(kp_logger INTERFACE SPDLOG_ACTIVE_LEVEL=SPDLOG_LEVEL_${KOMPUTE_OPT_LOG_LEVEL})