Add run option to the build.zig
This commit is contained in:
@@ -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
|
## 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.
|
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.
|
||||||
|
|||||||
@@ -20,5 +20,11 @@ pub fn build(b: *std.Build) void {
|
|||||||
});
|
});
|
||||||
exe.root_module.addImport("zigmulator", zigmulator);
|
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);
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user