#build.zig for C++

1 messages · Page 1 of 1 (latest)

lofty gate
#

I want to use build.zig to:

  1. Build a daemon binary
  2. Build a REPL binary
  3. Build tests
  4. Generate docs

What I am interested in is to build let's say the REPL and only the REPL, I added an option to do so but when I do zig build run-repl it won't run because I have to do: zig build -Dbuild-repl=true run-repl, is there a better way to do the behaviour I am describing?

vernal estuary
lofty gate
#

Sure, 1 sec

#

I mean I could just use a Makefile just to make the commands smaller but idk

vernal estuary
#

Maybe first create the run steps outside the functions, so you have all the sub commands regardless of your options. Then have an additional argument to pass the run step, maybe as an optional. If it's not null, make it depend on run_cmd.

#

Something like that

#

I have to head out now so I can't make you a small POC, so I hope you find the suggestion helpful