Files
GridFire/src/include/gridfire/utils/config.h.in

36 lines
1.2 KiB
C
Raw Normal View History

#pragma once
#include <format>
#include <string>
namespace gridfire {
struct version {
static constexpr int major = @GF_VERSION_MAJOR@;
static constexpr int minor = @GF_VERSION_MINOR@;
static constexpr int patch = @GF_VERSION_PATCH@;
static constexpr const char* tag = "@GF_VERSION_TAG@";
static std::string toString() {
std::string versionStr = std::to_string(major) + "." +
std::to_string(minor) + "." +
std::to_string(patch);
if (std::string(tag) != "") {
versionStr += "-" + std::string(tag);
}
return versionStr;
}
};
}
template <>
struct std::formatter<gridfire::version> : std::formatter<std::string> {
auto format(const gridfire::version& v, auto& ctx) {
std::string versionStr = std::to_string(v.major) + "." +
std::to_string(v.minor) + "." +
std::to_string(v.patch);
if (std::string(v.tag) != "") {
versionStr += "-" + std::string(v.tag);
}
return std::formatter<std::string>::format(versionStr, ctx);
}
};