Fix for debug builds

- Include fmt/ostream.h in debug.h to allow formatting filesystem paths
- Avoid including headers via debug.h on non-debug builds
pull/1145/head
Andrew Tribick 2021-10-24 14:40:14 +02:00 committed by Hleb Valoshka
parent ab6bdd75fc
commit ec232b7fad
22 changed files with 48 additions and 23 deletions

View File

@ -14,6 +14,9 @@
#include <cstdlib>
#include <cassert>
#include <algorithm>
#include <fmt/printf.h>
#include <celutil/debug.h>
#include <celmath/mathlib.h>
#include <celutil/gettext.h>

View File

@ -23,6 +23,7 @@
#include <algorithm>
#include <random>
#include <cassert>
#include <fmt/printf.h>
using namespace Eigen;
using namespace std;

View File

@ -24,6 +24,7 @@
#include "render.h"
#include "texture.h"
#include "vecgl.h"
#include <fmt/printf.h>
using namespace Eigen;
using namespace std;

View File

@ -12,6 +12,7 @@
#include <fstream>
#include <iostream>
#include <fmt/ostream.h>
#include <fmt/printf.h>
#include <celengine/glsupport.h>
#include <celutil/debug.h>
#include <celutil/filetype.h>

View File

@ -8,10 +8,12 @@
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
#include <array>
#include <cmath>
#include <cstring>
#include <fstream>
#include <celutil/debug.h>
#include <celutil/fsutils.h>
#include <array>
#include <fstream>
#include "mapmanager.h"
using namespace std;

View File

@ -39,6 +39,7 @@
#include <utility>
#include <memory>
#include <fmt/ostream.h>
#include <fmt/printf.h>
using namespace cmod;

View File

@ -18,6 +18,7 @@
#include "planetgrid.h"
#include "render.h"
#include "vecgl.h"
#include <fmt/printf.h>
using namespace std;
using namespace Eigen;

View File

@ -33,6 +33,8 @@ std::ofstream hdrlog;
#define EXPOSURE_HALFLIFE 0.4f
#endif
#include <fmt/printf.h>
#include "render.h"
#include "boundaries.h"
#include "dsorenderer.h"

View File

@ -17,6 +17,7 @@
#include <celengine/body.h>
#include <celengine/location.h>
#include <celengine/deepskyobj.h>
#include <fmt/printf.h>
using namespace Eigen;
using namespace std;

View File

@ -16,6 +16,7 @@
#include <iomanip>
#include <tuple>
#include <fmt/ostream.h>
#include <fmt/printf.h>
#include <Eigen/Geometry>
#include <celcompat/filesystem.h>
#include <celmath/geomutil.h>

View File

@ -17,6 +17,7 @@
#include "star.h"
#include "texmanager.h"
#include "celephem/orbit.h"
#include <fmt/printf.h>
using namespace Eigen;
using namespace std;

View File

@ -25,6 +25,7 @@
#include "multitexture.h"
#include "meshmanager.h"
#include "tokenizer.h"
#include <fmt/printf.h>
using namespace Eigen;
using namespace std;
@ -1491,4 +1492,3 @@ Star* StarDatabase::findWhileLoading(AstroCatalog::IndexNumber catalogNumber) co
// Star not found
return nullptr;
}

View File

@ -8,6 +8,7 @@
// of the License, or (at your option) any later version.
#include <cstring>
#include <fmt/printf.h>
#include <celutil/debug.h>
#include <cassert>
#include <config.h>

View File

@ -14,6 +14,7 @@
#include <fstream>
#include <iostream>
#include <fmt/printf.h>
#include <Eigen/Core>
#include "glsupport.h"

View File

@ -16,6 +16,7 @@
#include <fstream>
#include <cassert>
#include <celutil/debug.h>
#include <fmt/printf.h>
using namespace std;

View File

@ -14,6 +14,7 @@
#include "samporbit.h"
#include "xyzvbinary.h"
#include <fmt/ostream.h>
#include <fmt/printf.h>
#include <celengine/astro.h>
#include <celmath/mathlib.h>
#include <celutil/bytes.h>

View File

@ -10,6 +10,7 @@
// of the License, or (at your option) any later version.
#include <celutil/debug.h>
#include <fmt/printf.h>
#include "scriptobject.h"

View File

@ -8,6 +8,7 @@
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
#include <cstring>
#include <iostream>
#include <fstream>
#include <algorithm>

View File

@ -12,6 +12,7 @@
#include <png.h>
#include <zlib.h>
#include <fmt/ostream.h>
#include <fmt/printf.h>
#include <celengine/image.h>
#include <celutil/debug.h>
#include <celutil/gettext.h>
@ -266,4 +267,3 @@ bool SavePNGImage(const fs::path& filename, Image& image)
image.getPixels(),
image.hasAlpha());
}

View File

@ -8,6 +8,8 @@
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
#include <fmt/printf.h>
#include "modelfile.h"
#include <celutil/bytes.h>
#include <cassert>

View File

@ -1,8 +1,11 @@
#include <string>
#include <fmt/printf.h>
#include <celutil/debug.h>
#include "celx.h"
#include "celx_internal.h"
#include "celx_category.h"
#include "celx_category.h"
#include "celx_object.h"
#include <celengine/category.h>
#include <celengine/selection.h>

View File

@ -7,29 +7,21 @@
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
#ifndef _DEBUG_H_
#define _DEBUG_H_
#pragma once
#ifdef DPRINTF
#undef DPRINTF // OSX has DPRINTF
#endif // DPRINTF
#if defined(_DEBUG) || defined(DEBUG)
#ifdef _MSC_VER
#include <windows.h>
#endif
#include <iostream>
#include <fmt/printf.h>
#include <fmt/ostream.h>
#ifdef DPRINTF
#undef DPRINTF // OSX has DPRINTF
#endif // DPRINTF
// verbosity choices
#define LOG_LEVEL_ERROR 0
#define LOG_LEVEL_WARNING 1
#define LOG_LEVEL_INFO 2
#define LOG_LEVEL_VERBOSE 3
#define LOG_LEVEL_DEBUG 4
#if !defined(_DEBUG) && !defined(DEBUG)
#define DPRINTF(level, ...) static_cast<void>(level);
#else
extern int debugVerbosity;
template <typename... T>
void DPRINTF(int level, const char *format, const T & ... args)
@ -50,9 +42,16 @@ void DPRINTF(int level, const char *format, const T & ... args)
#endif
}
}
#else
#define DPRINTF(level, ...) static_cast<void>(level);
#endif /* DEBUG */
// verbosity choices
#define LOG_LEVEL_ERROR 0
#define LOG_LEVEL_WARNING 1
#define LOG_LEVEL_INFO 2
#define LOG_LEVEL_VERBOSE 3
#define LOG_LEVEL_DEBUG 4
extern void SetDebugVerbosity(int);
extern int GetDebugVerbosity();
#endif // _DEBUG_H_