Do not show debug output in release mode

Reason: Has an impact on the performance
This commit is contained in:
Martin Marmsoler 2023-02-16 19:17:07 +01:00
parent 362bbdd1b3
commit 33d8cdc157
2 changed files with 18 additions and 15 deletions

View File

@ -65,9 +65,6 @@ option(USE_SYSTEM_LUA "Use the system-wide Lua installation" OFF)
option(USE_SYSTEM_HUNSPELL "Use the system-wide hunspell installation" OFF)
option(USE_SYSTEM_CMARK "Use the system-wide cmark installation" OFF)
option(ENABLE_TESTS "Enable Gittyup Unittests" ON)
option(DEBUG_MESSAGES "Enable general debug messages" ON)
option(DEBUG_MESSAGES_REFRESH "Enable debug messages to debug the refresh flow"
ON)
set(LUA_MODULES_PATH
CACHE
@ -97,18 +94,25 @@ if(UNIX)
set(QT_MODULES ${QT_MODULES} DBus)
endif()
option(DEBUG_OUTPUT "Print debug output" ON)
if(NOT DEBUG_OUTPUT)
if(CMAKE_BUILD_TYPE MATCHES Debug)
option(DEBUG_OUTPUT "Print debug output" ON)
option(DEBUG_OUTPUT_GENERAL "Enable general debug messages" ON)
option(DEBUG_OUTPUT_REFRESH "Enable debug messages to debug the refresh flow"
ON)
if(NOT DEBUG_OUTPUT)
add_compile_definitions(QT_NO_DEBUG_OUTPUT)
else()
if(DEBUG_OUTPUT_GENERAL)
add_compile_definitions(DEBUG_OUTPUT_GENERAL)
endif()
if(DEBUG_OUTPUT_REFRESH)
add_compile_definitions(DEBUG_OUTPUT_REFRESH)
endif()
endif()
else()
add_compile_definitions(QT_NO_DEBUG_OUTPUT)
endif()
if(DEBUG_MESSAGES)
add_compile_definitions(DEBUG)
endif()
if(DEBUG_MESSAGES_REFRESH)
add_compile_definitions(DEBUG_REFRESH)
endif()
find_package(
Qt5 5.12
COMPONENTS ${QT_MODULES} LinguistTools

View File

@ -3,8 +3,7 @@
#include <QDebug>
#ifdef DEBUG
#ifdef DEBUG_OUTPUT_GENERAL
#define Debug(x) \
do { \
qDebug() << x; \
@ -13,7 +12,7 @@
#define Debug(x)
#endif
#ifdef DEBUG_REFRESH
#ifdef DEBUG_OUTPUT_REFRESH
#define DebugRefresh(x) \
do { \
qDebug() << Q_FUNC_INFO << QStringLiteral(": ") << x; \