Here are two good sources of documentation for the build system – particularly for running system utilities and capturing the output:
There is b.run()
, which runs during the configure phase (unlike b.addSystemCommand()
which runs during the make phase [1]). You should be able to accomplish this either way: b.run()
is more straight forward, as the return value of this function will contain captured stdout
of the spawned process, where as b.addSystemCommand()
will only run if it’s depended on. Both methods have the ability to capture stdout
.
Additionally, as @vulpesx pointed out, you could write your own tool, build it, and run it all from withinbuild.zig
.
I guess it boils down to two main scenarios:
b.run()
to collect output during the configure phase- a
std.Build.Step.Run
step (b.addSystemCommand()
,b.addRunArtifact()
) during the make phase
I think? ↩︎