From 64dc7b577231d011e76e9dd05d928d77958bae96 Mon Sep 17 00:00:00 2001 From: Emil Lerch Date: Mon, 14 Aug 2023 08:49:23 -0700 Subject: [PATCH] add thoughts on adding git rev --- build.zig | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/build.zig b/build.zig index c38e4cd..567b3e2 100644 --- a/build.zig +++ b/build.zig @@ -13,6 +13,16 @@ pub fn build(b: *Builder) !void { // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. const optimize = b.standardOptimizeOption(.{}); + // TODO: Embed the current git version in the code. We can do this + // by looking for .git/HEAD (if it exists, follow the ref to /ref/heads/whatevs, + // grab that commit, and use b.addOptions/exe.addOptions to generate the + // Options file. See https://github.com/ziglang/zig/issues/14979 for usage + // example. + // + // From there, I'm not sure what the generated file looks like or quite how + // to use, but that should be easy. It may also give some ideas on the + // code gen piece itself, though it might be nice to leave as a seperate + // executable const exe = b.addExecutable(.{ .name = "demo", .root_source_file = .{ .path = "src/main.zig" },