diff --git a/.gitignore b/.gitignore index ea8441ad..00ab35e3 100644 --- a/.gitignore +++ b/.gitignore @@ -9,7 +9,7 @@ # Cheers! # -andrewrk -zig-cache/ +.zig-cache/ zig-out/ /release/ /debug/ diff --git a/build.zig b/build.zig index 45908fd2..32258035 100644 --- a/build.zig +++ b/build.zig @@ -14,7 +14,7 @@ pub fn build(b: *std.Build) !void { // or Dawn C++ examples for functional example code. const example = b.addExecutable(.{ .name = "empty", - .root_source_file = .{ .path = "src/main.zig" }, + .root_source_file = b.path("src/main.zig"), .target = target, .optimize = optimize, }); @@ -46,9 +46,9 @@ pub const DownloadBinaryStep = struct { return download_step; } - fn make(step: *std.Build.Step, prog_node: *std.Progress.Node) anyerror!void { + fn make(step: *std.Build.Step, prog_node: std.Progress.Node) anyerror!void { _ = prog_node; - const download_step = @fieldParentPtr(DownloadBinaryStep, "step", step); + const download_step: *DownloadBinaryStep = @fieldParentPtr("step", step); try downloadFromBinary(download_step.b, download_step.target, download_step.options); } }; @@ -90,7 +90,7 @@ pub const Options = struct { install_libs: bool = false, /// The binary release version to use from https://github.com/hexops/mach-gpu-dawn/releases - binary_version: []const u8 = "release-cdd4a1a", + binary_version: []const u8 = "release-cdd4a1a", /// Detects the default options to use for the given target. pub fn detectDefaults(self: Options, target: std.Target) Options { @@ -142,9 +142,9 @@ fn linkFromSource(b: *std.Build, step: *std.Build.Step.Compile, mod: *std.Build. // branch: mach try ensureGitRepoCloned(b.allocator, "https://github.com/hexops/DirectXShaderCompiler", "bb5211aa247978e2ab75bea9f5c985ba3fabd269", sdkPath("/libs/DirectXShaderCompiler")); - step.addIncludePath(.{ .path = sdkPath("/libs/dawn/out/Debug/gen/include") }); - step.addIncludePath(.{ .path = sdkPath("/libs/dawn/include") }); - step.addIncludePath(.{ .path = sdkPath("/src/dawn") }); + step.addIncludePath(.{ .cwd_relative = sdkPath("/libs/dawn/out/Debug/gen/include") }); + step.addIncludePath(.{ .cwd_relative = sdkPath("/libs/dawn/include") }); + step.addIncludePath(.{ .cwd_relative = sdkPath("/src/dawn") }); if (options.separate_libs) { const lib_dawn_common = try buildLibDawnCommon(b, step, options); @@ -221,13 +221,13 @@ fn ensureGitRepoCloned(allocator: std.mem.Allocator, clone_url: []const u8, revi } fn exec(allocator: std.mem.Allocator, argv: []const []const u8, cwd: []const u8) !void { - var child = std.ChildProcess.init(argv, allocator); + var child = std.process.Child.init(argv, allocator); child.cwd = cwd; _ = try child.spawnAndWait(); } fn getCurrentGitRevision(allocator: std.mem.Allocator, cwd: []const u8) ![]const u8 { - const result = try std.ChildProcess.run(.{ .allocator = allocator, .argv = &.{ "git", "rev-parse", "HEAD" }, .cwd = cwd }); + const result = try std.process.Child.run(.{ .allocator = allocator, .argv = &.{ "git", "rev-parse", "HEAD" }, .cwd = cwd }); allocator.free(result.stderr); if (result.stdout.len > 0) return result.stdout[0 .. result.stdout.len - 1]; // trim newline return result.stdout; @@ -235,7 +235,7 @@ fn getCurrentGitRevision(allocator: std.mem.Allocator, cwd: []const u8) ![]const fn ensureGit(allocator: std.mem.Allocator) void { const argv = &[_][]const u8{ "git", "--version" }; - const result = std.ChildProcess.run(.{ + const result = std.process.Child.run(.{ .allocator = allocator, .argv = argv, .cwd = ".", @@ -351,12 +351,12 @@ pub fn linkFromBinary(b: *std.Build, step: *std.Build.Step.Compile, mod: *std.Bu const target_cache_dir = try std.fs.path.join(b.allocator, &.{ commit_cache_dir, zig_triple, release_tag }); const include_dir = try std.fs.path.join(b.allocator, &.{ commit_cache_dir, "include" }); - step.addLibraryPath(.{ .path = target_cache_dir }); + step.addLibraryPath(.{ .cwd_relative = target_cache_dir }); step.linkSystemLibrary("dawn"); step.linkLibCpp(); - step.addIncludePath(.{ .path = include_dir }); - step.addIncludePath(.{ .path = sdkPath("/src/dawn") }); + step.addIncludePath(.{ .cwd_relative = include_dir }); + step.addIncludePath(.{ .cwd_relative = sdkPath("/src/dawn") }); linkLibDawnCommonDependencies(b, step, mod, options); linkLibDawnPlatformDependencies(b, step, mod, options); @@ -390,9 +390,9 @@ pub fn addPathsToModuleFromSource(b: *std.Build, module: *std.Build.Module, opti _ = b; _ = options; - module.addIncludePath(.{ .path = sdkPath("/libs/dawn/out/Debug/gen/include") }); - module.addIncludePath(.{ .path = sdkPath("/libs/dawn/include") }); - module.addIncludePath(.{ .path = sdkPath("/src/dawn") }); + module.addIncludePath(.{ .cwd_relative = sdkPath("/libs/dawn/out/Debug/gen/include") }); + module.addIncludePath(.{ .cwd_relative = sdkPath("/libs/dawn/include") }); + module.addIncludePath(.{ .cwd_relative = sdkPath("/src/dawn") }); } pub fn addPathsToModuleFromBinary(b: *std.Build, module: *std.Build.Module, options: Options) !void { @@ -419,8 +419,8 @@ pub fn addPathsToModuleFromBinary(b: *std.Build, module: *std.Build.Module, opti _ = target_cache_dir; const include_dir = try std.fs.path.join(b.allocator, &.{ commit_cache_dir, "include" }); - module.addIncludePath(.{ .path = include_dir }); - module.addIncludePath(.{ .path = sdkPath("/src/dawn") }); + module.addIncludePath(.{ .cwd_relative = include_dir }); + module.addIncludePath(.{ .cwd_relative = sdkPath("/src/dawn") }); } pub fn ensureBinaryDownloaded( @@ -597,7 +597,7 @@ fn gzipDecompress(allocator: std.mem.Allocator, src_absolute_path: []const u8, d } fn gitBranchContainsCommit(allocator: std.mem.Allocator, branch: []const u8, commit: []const u8) !bool { - const result = try std.ChildProcess.run(.{ + const result = try std.process.Child.run(.{ .allocator = allocator, .argv = &.{ "git", "branch", branch, "--contains", commit }, .cwd = sdkPath("/"), @@ -610,7 +610,7 @@ fn gitBranchContainsCommit(allocator: std.mem.Allocator, branch: []const u8, com } fn getCurrentGitCommit(allocator: std.mem.Allocator) ![]const u8 { - const result = try std.ChildProcess.run(.{ + const result = try std.process.Child.run(.{ .allocator = allocator, .argv = &.{ "git", "rev-parse", "HEAD" }, .cwd = sdkPath("/"), @@ -621,7 +621,7 @@ fn getCurrentGitCommit(allocator: std.mem.Allocator) ![]const u8 { } fn gitClone(allocator: std.mem.Allocator, repository: []const u8, dir: []const u8) !bool { - const result = try std.ChildProcess.run(.{ + const result = try std.process.Child.run(.{ .allocator = allocator, .argv = &.{ "git", "clone", repository, dir }, .cwd = sdkPath("/"), diff --git a/build.zig.zon b/build.zig.zon index 6f27b178..5c1fa96e 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -13,20 +13,20 @@ }, .dependencies = .{ .xcode_frameworks = .{ - .url = "https://pkg.machengine.org/xcode-frameworks/2fca968efa90a4060803c56dd0f027890353f0a9.tar.gz", - .hash = "122010c1a745ea06dee3012fbd3b311bd3d75ec39ded6bf566b36ebe3cd8da482347", + .url = "https://pkg.machengine.org/xcode-frameworks/122b43323db27b2082a2d44ed2121de21c9ccf75.tar.gz", + .hash = "12205d131983601cdb3500f38e9d8adaed5574fb0211b8b39291d2e9b90c6555ce59", }, .direct3d_headers = .{ - .url = "https://pkg.machengine.org/direct3d-headers/bc2fafe176dbd36bff6d1c036488c015bd4c0f7b.tar.gz", - .hash = "12201f3096410a22af7978c7c57636f251669c335919740e42fc1785180435f63f1c", + .url = "https://pkg.machengine.org/direct3d-headers/9417c58f11628b7072f0c63b687282de83592891.tar.gz", + .hash = "12203594c3c97220742be1cc5343547bb25d8947e77bd52c50ef713da676d6f6d31f", }, .vulkan_headers = .{ - .url = "https://pkg.machengine.org/vulkan-headers/e33f2e482893a90bb36d67649ab30d5236ac21ab.tar.gz", - .hash = "122017098e4ca00dac1a9d30d152a6e6e9522843219c6df4489210fb7c8a6e4c7c1a", + .url = "https://pkg.machengine.org/vulkan-headers/ae4bb705e6cad613825d9e7d8ffc29ca595f54cb.tar.gz", + .hash = "122058b98f7d2ac86597363d0c0515c30aea392c605d5976c600196bd2c5b08b95d6", }, .x11_headers = .{ - .url = "https://pkg.machengine.org/x11-headers/ad1c4891f70302c61ba956cfd565758dc1ca9d28.tar.gz", - .hash = "1220ce35d8f1556afd5bf4796a7899d459f9c628b989f247eaf6aa00fbad10a88c9f", + .url = "https://pkg.machengine.org/x11-headers/22bb51a939722a819bf52aba100ac6c25acfbaff.tar.gz", + .hash = "1220ddf168c855cf69b4f8c5284403106a3c681913e34453df10cc5a588d9bd1d005", }, }, }