diff --git a/src/application.cpp b/src/application.cpp index 74776a06..f6f20c0e 100644 --- a/src/application.cpp +++ b/src/application.cpp @@ -20,7 +20,7 @@ #include "helper/console_helpers.hpp" #endif -#ifdef DEBUG_BUILD +#if !defined(NDEBUG) #include "graphics/text.hpp" #endif @@ -58,7 +58,7 @@ Application::Application(std::shared_ptr&& window, const std::vector(SDL_GetPerformanceFrequency()); @@ -84,7 +84,7 @@ void Application::run() { render(); m_renderer.present(); -#ifdef DEBUG_BUILD +#if !defined(NDEBUG) ++frame_counter; const Uint64 current_time = SDL_GetPerformanceCounter(); @@ -244,7 +244,7 @@ void Application::render() const { for (const auto& scene : m_scene_stack) { scene->render(*this); } -#ifdef DEBUG_BUILD +#if !defined(NDEBUG) m_fps_text->render(*this); #endif } @@ -266,7 +266,7 @@ void Application::initialize() { this->load_resources(); -#ifdef DEBUG_BUILD +#if !defined(NDEBUG) m_fps_text = std::make_unique( this, "FPS: ?", font_manager().get(FontId::Default), Color::white(), std::pair{ 0.95, 0.95 }, diff --git a/src/application.hpp b/src/application.hpp index c21f5ca2..676e910c 100644 --- a/src/application.hpp +++ b/src/application.hpp @@ -34,7 +34,7 @@ struct Application final : public EventListener, public ServiceProvider { std::unique_ptr m_font_manager; -#ifdef DEBUG_BUILD +#if !defined(NDEBUG) std::unique_ptr m_fps_text{ nullptr }; #endif diff --git a/src/discord/core.cpp b/src/discord/core.cpp index 350c14ce..5b0c5c4f 100644 --- a/src/discord/core.cpp +++ b/src/discord/core.cpp @@ -50,7 +50,7 @@ void DiscordInstance::after_setup() { core->SetLogHook( -#ifdef DEBUG_BUILD +#if !defined(NDEBUG) discord::LogLevel::Debug #else discord::LogLevel::Error diff --git a/src/game/tetrion.cpp b/src/game/tetrion.cpp index 01e64d75..abff894e 100644 --- a/src/game/tetrion.cpp +++ b/src/game/tetrion.cpp @@ -452,7 +452,7 @@ void Tetrion::lock_active_tetromino(const SimulationStep simulation_step_index) reset_lock_delay(simulation_step_index); // save a snapshot on every freeze (only in debug builds) -#ifdef DEBUG_BUILD +#if !defined(NDEBUG) if (m_recording_writer) { spdlog::debug("adding snapshot at step {}", simulation_step_index); (*m_recording_writer)->add_snapshot(m_tetrion_index, simulation_step_index, core_information()); diff --git a/src/helper/parse_json.hpp b/src/helper/parse_json.hpp index c601a77b..ceb790f1 100644 --- a/src/helper/parse_json.hpp +++ b/src/helper/parse_json.hpp @@ -1,10 +1,11 @@ #pragma once -#ifdef DEBUG_BUILD +#if !defined(NDEBUG) // better json error messages, see https://json.nlohmann.me/api/macros/json_diagnostics/ #define JSON_DIAGNOSTICS 1 // NOLINT(cppcoreguidelines-macro-usage) #endif + #include #include "helper/expected.hpp" diff --git a/src/main.cpp b/src/main.cpp index d23a52a4..0f1a564d 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -41,7 +41,7 @@ int main(int argc, char** argv) { auto combined_logger = std::make_shared("combined_logger", begin(sinks), end(sinks)); spdlog::set_default_logger(combined_logger); -#ifdef DEBUG_BUILD +#if !defined(NDEBUG) spdlog::set_level(spdlog::level::debug); #else spdlog::set_level(spdlog::level::err); diff --git a/src/manager/music_manager.cpp b/src/manager/music_manager.cpp index d040ae02..a60ca0a6 100644 --- a/src/manager/music_manager.cpp +++ b/src/manager/music_manager.cpp @@ -241,7 +241,7 @@ void MusicManager::hook_music_finished() { [[nodiscard]] helper::optional MusicManager::get_volume() const { -#ifdef DEBUG_BUILD +#if !defined(NDEBUG) int result = Mix_VolumeMusic(-1); if (result == 0) { return helper::nullopt; diff --git a/src/scenes/about_page/about_page.cpp b/src/scenes/about_page/about_page.cpp index a8fb3ecb..e7fea40d 100644 --- a/src/scenes/about_page/about_page.cpp +++ b/src/scenes/about_page/about_page.cpp @@ -25,7 +25,7 @@ namespace scenes { auto focus_helper = ui::FocusHelper{ 1 }; -#ifdef DEBUG_BUILD +#if !defined(NDEBUG) m_main_grid.add( service_provider, fmt::format("Git Commit: {}", utils::git_commit()), service_provider->font_manager().get(FontId::Default), Color::white(), diff --git a/src/ui/layouts/focus_layout.cpp b/src/ui/layouts/focus_layout.cpp index e9ea348c..a7707994 100644 --- a/src/ui/layouts/focus_layout.cpp +++ b/src/ui/layouts/focus_layout.cpp @@ -231,7 +231,7 @@ ui::FocusLayout::handle_event_result(const helper::optional