Pass -DFMT_HEADER_ONLY as a compiler flag

Moving the definition of the FMT_HEADER_ONLY macro from a file to the
compiler makes all code relying on this macro independent of a single
file

Also cleanup some unused fmt includes
This commit is contained in:
nobounce 2023-08-29 11:47:25 +02:00 committed by Steffen Winter
parent d48f722eb9
commit 310d96443c
No known key found for this signature in database
GPG Key ID: D4053C3600EF3B1F
4 changed files with 4 additions and 4 deletions

View File

@ -131,6 +131,7 @@ target_compile_definitions(btop PRIVATE
_GLIBCXX_ASSERTIONS _LIBCPP_ENABLE_ASSERTIONS=1
# Only has an effect with optimizations enabled
$<$<NOT:$<CONFIG:Debug>>:_FORTIFY_SOURCE=2>
FMT_HEADER_ONLY
)
# Enable GPU support

View File

@ -183,7 +183,7 @@ override GOODFLAGS := $(foreach flag,$(TESTFLAGS),$(strip $(shell echo "int main
override REQFLAGS := -std=c++20
WARNFLAGS := -Wall -Wextra -pedantic
OPTFLAGS := -O2 -ftree-vectorize -flto=$(LTO)
LDCXXFLAGS := -pthread -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS -D_FILE_OFFSET_BITS=64 $(GOODFLAGS) $(ADDFLAGS)
LDCXXFLAGS := -pthread -DFMT_HEADER_ONLY -D_FORTIFY_SOURCE=2 -D_GLIBCXX_ASSERTIONS -D_FILE_OFFSET_BITS=64 $(GOODFLAGS) $(ADDFLAGS)
override CXXFLAGS += $(REQFLAGS) $(LDCXXFLAGS) $(OPTFLAGS) $(WARNFLAGS)
override LDFLAGS += $(LDCXXFLAGS) $(OPTFLAGS) $(WARNFLAGS)
INC := $(foreach incdir,$(INCDIRS),-isystem $(incdir)) -I$(SRCDIR)

View File

@ -9,6 +9,7 @@
#include <string_view>
#include <fmt/core.h>
#include <fmt/ostream.h>
#include "btop_shared.hpp"
#include "btop_tools.hpp"

View File

@ -38,11 +38,9 @@ tab-size = 4
#define HOST_NAME_MAX 64
#endif
#endif
#define FMT_HEADER_ONLY
#include "fmt/core.h"
#include "fmt/format.h"
#include "fmt/ostream.h"
#include "fmt/ranges.h"
using std::array;
using std::atomic;