update to latest Zig

Helps hexops/mach#902

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2023-09-17 13:44:52 -07:00
parent 3cabe193fe
commit 321efd4065
2 changed files with 37 additions and 47 deletions

View file

@ -10,47 +10,37 @@ pub fn build(b: *Build) !void {
.source_file = .{ .path = "src/main.zig" }, .source_file = .{ .path = "src/main.zig" },
}); });
// TODO: uncomment this once hexops/mach#902 is fixed const lib = b.addStaticLibrary(.{
// we cannot call b.dependency inside pub fn build if we want to use this package via the Zig .name = "mach-glfw",
// package manager. .root_source_file = .{ .path = "stub.c" },
_ = target; .target = target,
_ = optimize; .optimize = optimize,
});
link(b, lib);
b.installArtifact(lib);
// const lib = b.addStaticLibrary(.{ const test_step = b.step("test", "Run library tests");
// .name = "mach-glfw", const main_tests = b.addTest(.{
// .root_source_file = .{ .path = "stub.c" }, .name = "glfw-tests",
// .target = target, .root_source_file = .{ .path = "src/main.zig" },
// .optimize = optimize, .target = target,
// }); .optimize = optimize,
// lib.linkLibrary(@import("glfw").lib(b, lib.optimize, lib.target)); });
// lib.linkLibrary(b.dependency("vulkan_headers", .{
// .target = lib.target,
// .optimize = lib.optimize,
// }).artifact("vulkan-headers"));
// if (lib.target_info.target.os.tag == .macos) {
// @import("xcode_frameworks").addPaths(b, lib);
// }
// b.installArtifact(lib);
// const test_step = b.step("test", "Run library tests"); main_tests.linkLibrary(lib);
// const main_tests = b.addTest(.{ link(b, main_tests);
// .name = "glfw-tests", b.installArtifact(main_tests);
// .root_source_file = .{ .path = "src/main.zig" },
// .target = target,
// .optimize = optimize,
// });
// main_tests.linkLibrary(lib); test_step.dependOn(&b.addRunArtifact(main_tests).step);
// try link(b, main_tests);
// b.installArtifact(main_tests);
// test_step.dependOn(&b.addRunArtifact(main_tests).step);
} }
pub fn link(b: *std.Build, step: *std.build.CompileStep) !void { pub fn link(b: *std.Build, step: *std.build.CompileStep) void {
step.linkLibrary(@import("glfw").lib(b, step.optimize, step.target));
@import("glfw").addPaths(step);
if (step.target.toTarget().isDarwin()) @import("xcode_frameworks").addPaths(b, step); if (step.target.toTarget().isDarwin()) @import("xcode_frameworks").addPaths(b, step);
@import("glfw").addPaths(step);
step.linkLibrary(b.dependency("glfw", .{
.target = step.target,
.optimize = step.optimize,
}).artifact("glfw"));
step.linkLibrary(b.dependency("vulkan_headers", .{ step.linkLibrary(b.dependency("vulkan_headers", .{
.target = step.target, .target = step.target,
.optimize = step.optimize, .optimize = step.optimize,

View file

@ -3,28 +3,28 @@
.version = "0.2.0", .version = "0.2.0",
.dependencies = .{ .dependencies = .{
.xcode_frameworks = .{ .xcode_frameworks = .{
.url = "https://github.com/hexops/xcode-frameworks-pkg/archive/d486474a6af7fafd89e8314e0bf7eca4709f811b.tar.gz", .url = "https://github.com/hexops/xcode-frameworks-pkg/archive/f8b854f9a1f4b4602b4f998ee42588d524d44e52.tar.gz",
.hash = "1220293eae4bf67a7c27a18a8133621337cde91a97bc6859a9431b3b2d4217dfb5fb", .hash = "1220ab440d1b8484038d619f743ef6a71e3683d13152eae941aa2d6bcb12fcea3135",
}, },
.glfw = .{ .glfw = .{
.url = "https://pkg.machengine.org/glfw/bad964824403ba34c935a90013024957dae795aa.tar.gz", .url = "https://pkg.machengine.org/glfw/92abc63294d389c8f2a546686b6c072930b029e0.tar.gz",
.hash = "1220fe0763e9722d56d3f93f8740e077fccf338d9697f08239d79a1ee27ae5833e62", .hash = "12205a6ce386007b97e22ef4b78a4f68c98af2cd6e1fde82589191fda79b9de54d0d",
}, },
.direct3d_headers = .{ .direct3d_headers = .{
.url = "https://pkg.machengine.org/direct3d-headers/c02ba4ba3f9473560e41487090ee6bfbbc44c75b.tar.gz", .url = "https://pkg.machengine.org/direct3d-headers/563ee4b888784df0614c1bb9c8fc9fc48fa18f2a.tar.gz",
.hash = "1220b4a3be5bd4d0c4a206c909b07579070f4fa8c83dd82170ed1db846b0eea1ae9d", .hash = "1220c7fc160384063b9584c6dc766cfcc9a06a392f7549c40cb2ec94e50d9d5110ae",
}, },
.vulkan_headers = .{ .vulkan_headers = .{
.url = "https://pkg.machengine.org/vulkan-headers/0212dd8b71531d0cec8378ce8fb1721a0df7420a.tar.gz", .url = "https://pkg.machengine.org/vulkan-headers/fc495148a910ac7817ce0ec2d5948231806f2ac0.tar.gz",
.hash = "1220a8b642edf8ef522e468cfe9a1803507472461b1041be717294ca484d1361afb0", .hash = "12209aeba80369fa8638b82179b47e6742adb98a3a5b01bc518565504a922baad3e4",
}, },
.wayland_headers = .{ .wayland_headers = .{
.url = "https://pkg.machengine.org/wayland-headers/509275fb6222181a97026c884d411bd013da680b.tar.gz", .url = "https://pkg.machengine.org/wayland-headers/82bf14ba6604794c00fd8c3a4818ec32c7cedeba.tar.gz",
.hash = "12202cf6230788d948e5ee2afa26d4f6cc4994ae1bf0c1c832535b920717a1174223", .hash = "12206781cb884fc8e524e90bea3c4a451e1dc78761b534f5dfb40973771a2fd07c22",
}, },
.x11_headers = .{ .x11_headers = .{
.url = "https://pkg.machengine.org/x11-headers/991ad9bf599df04aaa5332e536712a8476838ee3.tar.gz", .url = "https://pkg.machengine.org/x11-headers/26d12e9fc0d893085bcb711088a4a19afdff1adc.tar.gz",
.hash = "12205bd95b9cc9cb08dd6b55f5842d8fae67a12eed01092c54f021060931815f711e", .hash = "1220371a61d8bb57fce8ee1741f623cc19b0edd7d1b4adc9918663f8a7ef08aa4f3f",
}, },
}, },
} }