2026-02-03 07:52:24 -05:00
|
|
|
#pragma once
|
|
|
|
|
|
|
|
|
|
#include <format>
|
2026-04-09 07:45:00 -04:00
|
|
|
#include <string>
|
2026-02-03 07:52:24 -05:00
|
|
|
|
|
|
|
|
namespace gridfire {
|
|
|
|
|
struct version {
|
2026-04-09 07:45:00 -04:00
|
|
|
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@";
|
2026-02-03 07:52:24 -05:00
|
|
|
|
2026-04-09 07:45:00 -04:00
|
|
|
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;
|
|
|
|
|
}
|
2026-02-03 07:52:24 -05:00
|
|
|
};
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
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);
|
|
|
|
|
}
|
|
|
|
|
};
|