Skip to content

Commit

Permalink
update to Zig 2024.1.0-mach
Browse files Browse the repository at this point in the history
Helps hexops/mach#1135

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
  • Loading branch information
emidoots committed Jan 15, 2024
1 parent bf26902 commit 88e3b8d
Show file tree
Hide file tree
Showing 2 changed files with 17 additions and 21 deletions.
26 changes: 11 additions & 15 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -12,39 +12,39 @@ pub fn build(b: *std.Build) !void {
freetype,
zigimg,

pub fn moduleDependency(
pub fn dependency(
dep: @This(),
b2: *std.Build,
target2: std.zig.CrossTarget,
target2: std.Build.ResolvedTarget,
optimize2: std.builtin.OptimizeMode,
) std.Build.ModuleDependency {
) std.Build.Module.Import {
const path = switch (dep) {
.assets => "assets/assets.zig",
.model3d => return std.Build.ModuleDependency{
.model3d => return std.Build.Module.Import{
.name = "model3d",
.module = b2.dependency("mach_model3d", .{
.target = target2,
.optimize = optimize2,
}).module("mach-model3d"),
},
.freetype => return std.Build.ModuleDependency{
.freetype => return std.Build.Module.Import{
.name = "freetype",
.module = b2.dependency("mach_freetype", .{
.target = target2,
.optimize = optimize2,
}).module("mach-freetype"),
},
.zigimg => return std.Build.ModuleDependency{
.zigimg => return std.Build.Module.Import{
.name = "zigimg",
.module = b2.dependency("zigimg", .{
.target = target2,
.optimize = optimize2,
}).module("zigimg"),
},
};
return std.Build.ModuleDependency{
return std.Build.Module.Import{
.name = @tagName(dep),
.module = b2.createModule(.{ .source_file = .{ .path = path } }),
.module = b2.createModule(.{ .root_source_file = .{ .path = path } }),
};
}
};
Expand Down Expand Up @@ -82,11 +82,11 @@ pub fn build(b: *std.Build) !void {
// as soon as any such examples is found. This does means that any
// example which works on wasm should be placed before those who dont.
if (example.std_platform_only)
if (target.getCpuArch() == .wasm32)
if (target.result.cpu.arch == .wasm32)
break;

var deps = std.ArrayList(std.Build.ModuleDependency).init(b.allocator);
for (example.deps) |d| try deps.append(d.moduleDependency(b, target, optimize));
var deps = std.ArrayList(std.Build.Module.Import).init(b.allocator);
for (example.deps) |d| try deps.append(d.dependency(b, target, optimize));
const app = try mach.App.init(
b,
.{
Expand All @@ -107,10 +107,6 @@ pub fn build(b: *std.Build) !void {
.target = target,
.optimize = optimize,
}).artifact("mach-model3d")),
.freetype => @import("mach_freetype").linkFreetype(b.dependency("mach_freetype", .{
.target = target,
.optimize = optimize,
}).builder, app.compile),
else => {},
};

Expand Down
12 changes: 6 additions & 6 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -13,16 +13,16 @@
},
.dependencies = .{
.zigimg = .{
.url = "https://github.com/zigimg/zigimg/archive/7f0e5db486df465b1d838112705ac3c1923d18a8.tar.gz",
.hash = "12207d0872fdffc8f6755638a7a997f8ac77685df742366e88710e3b7ca0e3756f8b",
.url = "https://github.com/zigimg/zigimg/archive/ad6ad042662856f55a4d67499f1c4606c9951031.tar.gz",
.hash = "1220bf6b616ca219f95be1205b12aa8cdb7e09838fcebeae90b48b5ab0a030c5ab45",
},
.mach = .{
.url = "https://pkg.machengine.org/mach/fc24a1148ab4190fb993c9ccbf9b6094d7028606.tar.gz",
.hash = "12209a6b28acfa4bb5d23fa2ab5229acce50e5329e1581bc68f0be3e763dbf222907",
.url = "https://pkg.machengine.org/mach/8da66bef3fdbea3ecec8a6db1c13e6a31c8d4da2.tar.gz",
.hash = "1220082e849c856f05d13ce935ff2957be9ab27a8316226cd6c9585a0a1dfbbe515f",
},
.mach_freetype = .{
.url = "https://pkg.machengine.org/mach-freetype/a6d971285dfe731e49f82e81c81da2b7f5c6a442.tar.gz",
.hash = "1220e0de43cacb583b8f9efddcbe359398cfca17a39e265b56c8f2a10314eb8f7a5f",
.url = "https://pkg.machengine.org/mach-freetype/7546a906b6c4b308b98d36264dfbe32ca24ae579.tar.gz",
.hash = "12205faaaaf547019f0763ac620af77fff2728b8eb4222b62120ee224ce53392cf31",
},
},
}

0 comments on commit 88e3b8d

Please sign in to comment.