Automatically handle switch between standalone fmt, spdlog bundled fmt and no fmt

This commit is contained in:
2021-05-20 18:01:11 +02:00
parent 63dea5443d
commit 69adaaad5f

View File

@@ -12,7 +12,14 @@
#include <regex>
#include <iomanip>
#include <sstream>
#if __has_include("fmt/format.h")
#include <fmt/format.h>
#elif __has_include("spdlog/fmt/fmt.h")
#include <spdlog/fmt/fmt.h>
#else
#warning "Failed to find fmt include"
#define OVKMBS_FMT_MISSING
#endif
#include <magic_enum.hpp>
namespace openVulkanoCpp
@@ -154,6 +161,7 @@ namespace openVulkanoCpp
inline constexpr ByteSize operator"" _EB(unsigned long long int num) { return { num, ByteSizeUnit::EB }; }
}
#ifndef OVKMBS_FMT_MISSING
template<> struct fmt::formatter<openVulkanoCpp::ByteSize>
{
template<typename ParseContext> constexpr auto parse(ParseContext& ctx)
@@ -166,3 +174,4 @@ template<> struct fmt::formatter<openVulkanoCpp::ByteSize>
return format_to(ctx.out(), "{}", bs.Format());
}
};
#endif