gpu-dawn: update to latest Zig build API

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2023-02-08 01:22:57 -07:00 committed by Stephen Gutekanst
parent 46a805bc90
commit 0f71895634
2 changed files with 84 additions and 59 deletions

View file

@ -1,11 +1,11 @@
const std = @import("std");
const Builder = std.build.Builder;
const Build = std.Build;
const glfw = @import("libs/mach-glfw/build.zig");
const system_sdk = @import("libs/mach-glfw/system_sdk.zig");
const gpu_dawn_sdk = @import("sdk.zig");
pub fn build(b: *Builder) !void {
const mode = b.standardReleaseOptions();
pub fn build(b: *Build) !void {
const optimize = b.standardOptimizeOption(.{});
const target = b.standardTargetOptions(.{});
const gpu_dawn = gpu_dawn_sdk.Sdk(.{
.glfw_include_dir = "libs/mach-glfw/upstream/glfw/include",
@ -19,11 +19,14 @@ pub fn build(b: *Builder) !void {
// Just to demonstrate/test linking. This is not a functional example, see the mach/gpu examples
// or Dawn C++ examples for functional example code.
const example = b.addExecutable("dawn-example", "src/main.zig");
example.setBuildMode(mode);
example.setTarget(target);
const example = b.addExecutable(.{
.name = "dawn-example",
.root_source_file = .{ .path = "src/main.zig" },
.target = target,
.optimize = optimize,
});
try gpu_dawn.link(b, example, options);
try glfw.link(b, example, .{ .system_sdk = .{ .set_sysroot = false } });
example.addPackage(glfw.pkg);
example.addModule("glfw", glfw.module(b));
example.install();
}