#[solved] Calling a custom compiler from build.zig for certain file types. How would it be done?

1 messages · Page 1 of 1 (latest)

narrow sinew
#

The makefile I'm translating defines: STRINGIFY = $(B)/rend2/stringify$(BINEXT)
which will be called like so in CLI when expanded:
./build/rend2/stringify myfile.ext

How would you achieve this type of thing with the buildsystem?
Is there existing support for alternative compilers?

median parcel
#
const run_step = b.Step.Run.create(b, "compile stringify");
run_step.addFileArg(b.path("./build/rend2/stringify"));
run_step.addFileArg(b.path("myfile.ext"));

It doesn't seem to have an output file arg though, Run steps work better with an output file arg

narrow sinew
narrow sinew
#

I changed it to addSystemCommand and I'm not getting it to run either 😦

narrow sinew
#

I got some progress, but I'm getting the path resolved to be relative to the build.zig file
Is there a way to make it call stringify instead of ./build/stringify?

narrow sinew
#

trial/error got me to addArg instead of addFileArg to declare a command that will be searched for on PATH

narrow sinew
#

[solved] Calling a custom compiler from build.zig for certain file types. How would it be done?

median parcel
#

whatever command needs that file, .step.dependOn(&run.step)

#

oh you got it