From 07a2a47ba54cf3c1da99ef3e296c90d402dc02c9 Mon Sep 17 00:00:00 2001 From: Purple4pur Date: Mon, 9 Oct 2023 16:08:02 +0800 Subject: [PATCH] fix build.zig in examples to install executable correctly --- examples/build.zig | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/examples/build.zig b/examples/build.zig index 4d079f9dd..8f16c7510 100644 --- a/examples/build.zig +++ b/examples/build.zig @@ -71,11 +71,15 @@ fn add_module(comptime module: []const u8, b: *std.Build, target: std.zig.CrossT }, } - b.installArtifact(exe); - var run = b.addRunArtifact(exe); - run.cwd = module; - b.step(name, name).dependOn(&run.step); - all.dependOn(&exe.step); + const install_cmd = b.addInstallArtifact(exe, .{}); + + const run_cmd = b.addRunArtifact(exe); + run_cmd.step.dependOn(&install_cmd.step); + + const run_step = b.step(name, name); + run_step.dependOn(&run_cmd.step); + + all.dependOn(&install_cmd.step); } return all; }