examples: add ported boids example
Ported from https://github.com/austinEng/webgpu-samples/
This commit is contained in:
parent
9e945ce951
commit
a7727c6b54
4 changed files with 336 additions and 12 deletions
27
build.zig
27
build.zig
|
|
@ -23,19 +23,22 @@ pub fn build(b: *std.build.Builder) void {
|
|||
const test_step = b.step("test", "Run library tests");
|
||||
test_step.dependOn(&main_tests.step);
|
||||
|
||||
const example = b.addExecutable("hello-triangle", "examples/triangle/main.zig");
|
||||
example.setTarget(target);
|
||||
example.setBuildMode(mode);
|
||||
example.addPackage(pkg);
|
||||
example.addPackage(gpu.pkg);
|
||||
example.addPackage(glfw.pkg);
|
||||
link(b, example, options);
|
||||
example.install();
|
||||
|
||||
const example_run_cmd = example.run();
|
||||
example_run_cmd.step.dependOn(b.getInstallStep());
|
||||
const example_run_step = b.step("run-example", "Run the example");
|
||||
example_run_step.dependOn(&example_run_cmd.step);
|
||||
inline for ([_][] const u8{"triangle", "boids"}) |name| {
|
||||
const example = b.addExecutable("example-" ++ name, "examples/" ++ name ++ "/main.zig");
|
||||
example.setTarget(target);
|
||||
example.setBuildMode(mode);
|
||||
example.addPackage(pkg);
|
||||
example.addPackage(gpu.pkg);
|
||||
example.addPackage(glfw.pkg);
|
||||
link(b, example, options);
|
||||
example.install();
|
||||
|
||||
const example_run_cmd = example.run();
|
||||
example_run_cmd.step.dependOn(b.getInstallStep());
|
||||
const example_run_step = b.step("run-example-" ++ name, "Run the example");
|
||||
example_run_step.dependOn(&example_run_cmd.step);
|
||||
}
|
||||
}
|
||||
|
||||
pub const Options = struct {
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue