addPaths(step) -> addPaths(mod); helps hexops/mach#1154

Signed-off-by: Stephen Gutekanst <stephen@hexops.com>
This commit is contained in:
Stephen Gutekanst 2024-02-01 18:24:26 -07:00
parent 0ea4948b8b
commit 63da35e57c
2 changed files with 7 additions and 15 deletions

View file

@ -10,10 +10,13 @@ pub fn build(b: *std.Build) !void {
.optimize = optimize, .optimize = optimize,
}); });
const module = b.addModule("mach-glfw", .{ var module = b.addModule("mach-glfw", .{
.target = target,
.optimize = optimize,
.root_source_file = .{ .path = "src/main.zig" }, .root_source_file = .{ .path = "src/main.zig" },
}); });
module.linkLibrary(glfw_dep.artifact("glfw")); module.linkLibrary(glfw_dep.artifact("glfw"));
@import("glfw").addPaths(module);
const test_step = b.step("test", "Run library tests"); const test_step = b.step("test", "Run library tests");
const main_tests = b.addTest(.{ const main_tests = b.addTest(.{
@ -23,23 +26,12 @@ pub fn build(b: *std.Build) !void {
.optimize = optimize, .optimize = optimize,
}); });
main_tests.linkLibrary(glfw_dep.artifact("glfw")); main_tests.linkLibrary(glfw_dep.artifact("glfw"));
addPaths(main_tests); @import("glfw").addPaths(&main_tests.root_module);
b.installArtifact(main_tests); b.installArtifact(main_tests);
test_step.dependOn(&b.addRunArtifact(main_tests).step); test_step.dependOn(&b.addRunArtifact(main_tests).step);
} }
pub fn link(b: *std.Build, step: *std.Build.Step.Compile) void {
_ = b;
_ = step;
@panic(".link(b, step) has been replaced by .addPaths(step)");
}
pub fn addPaths(step: *std.Build.Step.Compile) void {
@import("glfw").addPaths(step);
}
comptime { comptime {
const supported_zig = std.SemanticVersion.parse("0.12.0-dev.2063+804cee3b9") catch unreachable; const supported_zig = std.SemanticVersion.parse("0.12.0-dev.2063+804cee3b9") catch unreachable;
if (builtin.zig_version.order(supported_zig) != .eq) { if (builtin.zig_version.order(supported_zig) != .eq) {

View file

@ -12,8 +12,8 @@
}, },
.dependencies = .{ .dependencies = .{
.glfw = .{ .glfw = .{
.url = "https://pkg.machengine.org/glfw/7b1a45feeacf876428bfbd924d4aca9a9a158cd9.tar.gz", .url = "https://pkg.machengine.org/glfw/586e14a964740747ca7913fc17096b3bb3d52409.tar.gz",
.hash = "122052f6e113bb8c74fceb80de8e92b6dce5792213ab703be2584bb638ec30f36edf", .hash = "122091debcee20ff2aaf983a9e8c215d4e50cc6caf44975442218901ea728e7dd79a",
}, },
}, },
} }