From ad73ea6508318aad88684a6a7b35f823d393ea51 Mon Sep 17 00:00:00 2001 From: torque Date: Mon, 15 Jan 2024 22:10:15 -0800 Subject: [PATCH] build: update for 0.12.0-dev.2208+4debd4338 I am hoping that by starting to roll over to zig 0.12 now it will be easier to migrate when the release actually happens. Unfortunately, the build system API changed fairly significantly and supporting both 0.11 and 0.12-dev is not very interesting. --- build.zig | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/build.zig b/build.zig index 8fb785d..f284544 100644 --- a/build.zig +++ b/build.zig @@ -5,7 +5,7 @@ pub fn build(b: *std.Build) void { const optimize = b.standardOptimizeOption(.{}); const nice = b.addModule("nice", .{ - .source_file = .{ .path = "src/nice.zig" }, + .root_source_file = .{ .path = "src/nice.zig" }, }); const tests = b.addTest(.{ @@ -15,7 +15,7 @@ pub fn build(b: *std.Build) void { .optimize = optimize, }); - tests.addModule("nice", nice); + tests.root_module.addImport("nice", nice); const run_main_tests = b.addRunArtifact(tests); const test_step = b.step("test", "Run tests"); @@ -29,7 +29,7 @@ pub fn build(b: *std.Build) void { } const ExampleOptions = struct { - target: std.zig.CrossTarget, + target: std.Build.ResolvedTarget, nice_mod: *std.Build.Module, }; @@ -44,7 +44,7 @@ const examples = [_]Example{ .{ .name = "reify", .file = "examples/reify.zig" }, }; -pub fn add_examples(b: *std.build, options: ExampleOptions) void { +pub fn add_examples(b: *std.Build, options: ExampleOptions) void { const example_step = b.step("examples", "build examples"); inline for (examples) |example| { @@ -55,7 +55,7 @@ pub fn add_examples(b: *std.build, options: ExampleOptions) void { .optimize = .Debug, }); - ex_exe.addModule("nice", options.nice_mod); + ex_exe.root_module.addImport("nice", options.nice_mod); const install = b.addInstallArtifact(ex_exe, .{}); example_step.dependOn(&install.step); }