Make the the short git SHA available within the program

This commit is contained in:
Karl Seguin
2025-02-25 08:00:36 +08:00
parent 488c7e6c27
commit d501cbf765
2 changed files with 11 additions and 2 deletions

View File

@@ -58,6 +58,15 @@ pub fn build(b: *std.Build) !void {
.optimize = mode,
});
try common(b, exe, options);
{
var opt = b.addOptions();
opt.addOption(
[]const u8,
"git_commit",
b.option([]const u8, "git_commit", "Current git commit") orelse "dev",
);
exe.root_module.addImport("build_info", opt.createModule());
}
b.installArtifact(exe);
// run