From c62bae6edcf00322d5b2b87bb5c72985813016a5 Mon Sep 17 00:00:00 2001 From: Stephen Gutekanst Date: Sun, 25 Jun 2023 00:18:03 -0700 Subject: [PATCH] all: update to latest Zig APIs Signed-off-by: Stephen Gutekanst --- libs/glfw/system_sdk.zig | 26 +++++++++++++------------- libs/gpu-dawn/sdk.zig | 8 +++----- 2 files changed, 16 insertions(+), 18 deletions(-) diff --git a/libs/glfw/system_sdk.zig b/libs/glfw/system_sdk.zig index 56419d53..7b8023bf 100644 --- a/libs/glfw/system_sdk.zig +++ b/libs/glfw/system_sdk.zig @@ -52,8 +52,8 @@ pub const Options = struct { .os_tag = .macos, .os_version = .{ .semver = .{ - .min = .{ .major = 13, .minor = 0 }, - .max = .{ .major = 14, .minor = std.math.maxInt(u32) }, + .min = .{ .major = 13, .minor = 0, .patch = std.math.maxInt(u32) }, + .max = .{ .major = 14, .minor = std.math.maxInt(u32), .patch = std.math.maxInt(u32) }, }, }, }, @@ -65,8 +65,8 @@ pub const Options = struct { .os_tag = .macos, .os_version = .{ .semver = .{ - .min = .{ .major = 12, .minor = 0 }, - .max = .{ .major = 12, .minor = std.math.maxInt(u32) }, + .min = .{ .major = 12, .minor = 0, .patch = std.math.maxInt(u32) }, + .max = .{ .major = 12, .minor = std.math.maxInt(u32), .patch = std.math.maxInt(u32) }, }, }, }, @@ -78,24 +78,24 @@ pub const Options = struct { .os_tag = .macos, .os_version = .{ .semver = .{ - .min = .{ .major = 11, .minor = 3 }, - .max = .{ .major = 11, .minor = std.math.maxInt(u32) }, + .min = .{ .major = 11, .minor = 3, .patch = std.math.maxInt(u32) }, + .max = .{ .major = 11, .minor = std.math.maxInt(u32), .patch = std.math.maxInt(u32) }, }, }, }, .{ .name = "sdk-linux-x86_64", .git_addr = "https://github.com/hexops/sdk-linux-x86_64", - .git_revision = "311a0f18a2350c032a40b5917ae25c05cf500683", + .git_revision = "311a0f18a2350c032a40b5917ae25c05cf500683s", .cpu_arch = &.{.x86_64}, .os_tag = .linux, .os_version = .{ .linux = .{ .range = .{ - .min = .{ .major = 3, .minor = 16 }, - .max = .{ .major = 6, .minor = std.math.maxInt(u32) }, + .min = .{ .major = 3, .minor = 16, .patch = std.math.maxInt(u32) }, + .max = .{ .major = 6, .minor = std.math.maxInt(u32), .patch = std.math.maxInt(u32) }, }, - .glibc = .{ .major = 0, .minor = 0 }, + .glibc = .{ .major = 0, .minor = 0, .patch = std.math.maxInt(u32) }, }, }, }, @@ -108,10 +108,10 @@ pub const Options = struct { .os_version = .{ .linux = .{ .range = .{ - .min = .{ .major = 3, .minor = 16 }, - .max = .{ .major = 6, .minor = std.math.maxInt(u32) }, + .min = .{ .major = 3, .minor = 16, .patch = std.math.maxInt(u32) }, + .max = .{ .major = 6, .minor = std.math.maxInt(u32), .patch = std.math.maxInt(u32) }, }, - .glibc = .{ .major = 0, .minor = 0 }, + .glibc = .{ .major = 0, .minor = 0, .patch = std.math.maxInt(u32) }, }, }, }, diff --git a/libs/gpu-dawn/sdk.zig b/libs/gpu-dawn/sdk.zig index ca6c8fef..fff295a7 100644 --- a/libs/gpu-dawn/sdk.zig +++ b/libs/gpu-dawn/sdk.zig @@ -222,7 +222,7 @@ pub fn Sdk(comptime deps: anytype) type { // If min. target macOS version is lesser than the min version we have available, then // our binary is incompatible with the target. - const min_available = std.builtin.Version{ .major = 12, .minor = 0 }; + const min_available = std.SemanticVersion{ .major = 12, .minor = 0, .patch = std.math.maxInt(u32) }; if (target.os.version_range.semver.min.order(min_available) == .lt) break :blk false; break :blk true; }, @@ -427,12 +427,10 @@ pub fn Sdk(comptime deps: anytype) type { const contents = try std.fs.cwd().readFileAlloc(allocator, json_file, std.math.maxInt(usize)); defer allocator.free(contents); - var parser = std.json.Parser.init(allocator, .alloc_if_needed); - defer parser.deinit(); - var tree = try parser.parse(contents); + var tree = try std.json.parseFromSlice(std.json.Value, allocator, contents, .{}); defer tree.deinit(); - var iter = tree.root.object.iterator(); + var iter = tree.value.object.iterator(); while (iter.next()) |f| { const out_path = try std.fs.path.join(allocator, &.{ out_dir, f.key_ptr.* }); defer allocator.free(out_path);