diff --git a/advancedSettings.pro b/advancedSettings.pro index 46d5cee..8298880 100644 --- a/advancedSettings.pro +++ b/advancedSettings.pro @@ -118,3 +118,8 @@ unix { INSTALLS += application } +debugSymbolsAndLogs { + message(Debug symbols and logging enabled.) + CONFIG += force_debug_info + DEFINES += ENABLE_DEBUG_LOGGING +} diff --git a/docs/building_for_linux.md b/docs/building_for_linux.md index 8260af5..8a4d138 100644 --- a/docs/building_for_linux.md +++ b/docs/building_for_linux.md @@ -334,6 +334,7 @@ The following values can be appended to the `CONFIG` internal variable in order | ----- | ------- | | `noX11` | Disables X11 specific features (VR to keyboard input). | | `noDBUS` | Disables DBUS specific features (control media players). | +| `debugSymbolsAndLogs` | Enables debug symbols and debug logging calls (while still having release optimizations). | The values are case sensitive. diff --git a/src/utils/setup.cpp b/src/utils/setup.cpp index 995c592..ba5942b 100644 --- a/src/utils/setup.cpp +++ b/src/utils/setup.cpp @@ -1,4 +1,9 @@ #include "setup.h" +#ifdef ENABLE_DEBUG_LOGGING +constexpr auto debugLoggingEnabled = true; +#else +constexpr auto debugLoggingEnabled = false; +#endif // The default Qt message handler prints to stdout on X11 and to the debugger on // Windows. That is borderline useless for us, therefore we create our own @@ -317,7 +322,15 @@ void setUpLogging() constexpr auto confDisabled = "false"; conf.set( Level::Trace, ConfigurationType::Enabled, confDisabled ); - conf.set( Level::Debug, ConfigurationType::Enabled, confDisabled ); + + if constexpr ( debugLoggingEnabled ) + { + conf.set( Level::Debug, ConfigurationType::Enabled, confEnabled ); + } + else + { + conf.set( Level::Debug, ConfigurationType::Enabled, confDisabled ); + } const auto appDataLocation = std::string( "/" ) + application_strings::applicationOrganizationName