From 957f75243fc45fe59b2f0cb60e35c13f4dc2cbaf Mon Sep 17 00:00:00 2001 From: adrien Date: Wed, 20 May 2026 16:03:15 +0200 Subject: [PATCH] Added zig-wgpu import --- .gitignore | 1 + build.zig | 10 +++++++++- build.zig.zon | 7 ++++++- 3 files changed, 16 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 1865cf1..4907a03 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ zig-out .zig-cache mkdocs.yaml +zig-pkg diff --git a/build.zig b/build.zig index e507138..d1ffbfc 100644 --- a/build.zig +++ b/build.zig @@ -4,10 +4,16 @@ pub fn build(b: *std.Build) void { const target = b.standardTargetOptions(.{}); const optimize = b.standardOptimizeOption(.{}); + const zig_wgpu = b.dependency("zig_wgpu", .{ + .target = target, + .optimize = optimize, + }); + // 1. Define the module so other projects can import it - _ = b.addModule("dimal", .{ + const mod = b.addModule("dimal", .{ .root_source_file = b.path("src/main.zig"), }); + mod.addImport("gpu", zig_wgpu.module("zig-wgpu")); const exe_tests = b.addTest(.{ .root_module = b.createModule(.{ @@ -18,6 +24,7 @@ pub fn build(b: *std.Build) void { .test_runner = .{ .path = b.path("test_runner.zig"), .mode = .simple }, }); + exe_tests.root_module.addImport("gpu", zig_wgpu.module("zig-wgpu")); const run_exe_tests = b.addRunArtifact(exe_tests); const test_step = b.step("test", "Run tests"); test_step.dependOn(&run_exe_tests.step); @@ -30,6 +37,7 @@ pub fn build(b: *std.Build) void { .imports = &.{}, }), }); + bench_exe.root_module.addImport("gpu", zig_wgpu.module("zig-wgpu")); b.installArtifact(bench_exe); diff --git a/build.zig.zon b/build.zig.zon index fdf2735..02a9aa5 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -3,7 +3,12 @@ .version = "0.2.2", .fingerprint = 0x9453b1ff1e52d858, .minimum_zig_version = "0.16.0", - .dependencies = .{}, + .dependencies = .{ + .zig_wgpu = .{ + .url = "git+https://git.bouvais.lu/adrien/zig-wgpu?ref=0.2.0#9c329a5a0657b00682958457bb118e2fc977dd63", + .hash = "zig_wgpu-0.2.0-xsLAy56X0QMafD4OTAvoQIJSo5VDBiw3B24DcB6wd1ZO", + }, + }, .paths = .{ "build.zig", "build.zig.zon",