build: generate a BuildInfo translation unit with version, commit, branch, dirty flag and build kind

cmake/BuildInfo.cmake runs on every build and rewrites the generated
BuildInfo.cpp only when something changed, so a new commit recompiles one
file and relinks. The build kind comes from DLU_BUILD_KIND
(release/ci/local) or CI=true, defaulting to local.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
Aaron Kimbrell
2026-09-29 15:43:08 -05:00
parent e74a7ea701
commit 97a6e27d56
4 changed files with 156 additions and 1 deletions

13
dCommon/BuildInfo.cpp.in Normal file
View File

@@ -0,0 +1,13 @@
// Generated by cmake/BuildInfo.cmake on every build. Do not edit.
#include "BuildInfo.h"
namespace BuildInfo {
const uint8_t versionMajor = @VERSION_MAJOR@;
const uint8_t versionMinor = @VERSION_MINOR@;
const uint8_t versionPatch = @VERSION_PATCH@;
const eBuildKind buildKind = eBuildKind::@BUILD_KIND@;
const bool dirty = @BUILD_DIRTY@;
const std::string_view commit = "@BUILD_COMMIT@";
const std::string_view branch = "@BUILD_BRANCH@";
const std::string_view buildString = "@BUILD_STRING@";
}