Add run option to the build.zig

This commit is contained in:
2026-05-21 21:49:14 +02:00
parent 9d1759fb87
commit d920e2c516
2 changed files with 15 additions and 1 deletions
+8
View File
@@ -51,6 +51,14 @@ pub fn main(init: std.process.Init) !void {
}
```
To see this example in action:
```sh
zig build run
```
which will build examples/example.zig
## How it works
Zigmulator implements an in-memory kernel, disk, network and plugs it into your application via the new IO interface (since Zig 0.16). Multiple programs can run in the same simulation, in which case network traffic is routed between their mocks. This is a bruteforce approach but the only one that allows a complete control of the environment the applications are running in.
+7 -1
View File
@@ -20,5 +20,11 @@ pub fn build(b: *std.Build) void {
});
exe.root_module.addImport("zigmulator", zigmulator);
b.installArtifact(exe);
const run_cmd = b.addRunArtifact(exe);
if (b.args) |args| {
run_cmd.addArgs(args);
}
const run_step = b.step("run", "Run the example");
run_step.dependOn(&run_cmd.step);
}