gpu: add gpu-hello-triangle (dawn) example
Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
parent
29b83b3118
commit
718a66497c
6 changed files with 490 additions and 2 deletions
|
|
@ -1,17 +1,28 @@
|
|||
const std = @import("std");
|
||||
const gpu_dawn = @import("libs/mach-gpu-dawn/build.zig");
|
||||
const glfw = @import("libs/mach-glfw/build.zig");
|
||||
|
||||
pub fn build(b: *std.build.Builder) void {
|
||||
// Standard release options allow the person running `zig build` to select
|
||||
// between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
|
||||
const mode = b.standardReleaseOptions();
|
||||
const target = b.standardTargetOptions(.{});
|
||||
|
||||
const lib = b.addStaticLibrary("gpu", "src/main.zig");
|
||||
lib.setBuildMode(mode);
|
||||
lib.install();
|
||||
gpu_dawn.link(b, lib, .{});
|
||||
|
||||
const main_tests = b.addTest("src/main.zig");
|
||||
main_tests.setBuildMode(mode);
|
||||
|
||||
const test_step = b.step("test", "Run library tests");
|
||||
test_step.dependOn(&main_tests.step);
|
||||
|
||||
const example = b.addExecutable("gpu-hello-triangle", "examples/main.zig");
|
||||
example.setTarget(target);
|
||||
example.setBuildMode(mode);
|
||||
example.install();
|
||||
example.linkLibC();
|
||||
example.addPackagePath("glfw", "libs/mach-glfw/src/main.zig");
|
||||
glfw.link(b, example, .{});
|
||||
gpu_dawn.link(b, example, .{});
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue