#Using system command in build step

1 messages · Page 1 of 1 (latest)

jade walrus
#

Hi there! I've seen both

const run_exe = b.addRunArtifact(exe);
const run_step = b.step("run", "Run the application");
run_step.dependOn(&run_exe.step);

and

const tool_run = b.addSystemCommand(&.{"ls"});
tool_run.addArgs(&.{
  "-a"
});
tool_run.addFileArg(b.path("zig-out/bin"));

but I don't know how I could combine both of these to make a system command manually callable through the zig build system.

I specifically want to have a zig build flash command that allows me to flash a built elf-file to a microcontroller.

Can someone help me out with this?

cunning sluice
#
const flash_step = b.step("flash", "Flash the mcu");
flash_step.dependOn(&tool_run.step);