Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .vscode/launch.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"request": "launch",
"name": "Debug Tests",
"program": "zig-out/bin/test",
"args": ["zig"],
"args": [],
"cwd": "${workspaceFolder}",
"preLaunchTask": "Build Tests"
}
Expand Down
15 changes: 13 additions & 2 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -159,6 +159,16 @@ pub fn build(b: *std.Build) !void {
}

b.installArtifact(exe);
// There must be a better way to feed through the exe install path through to the build system...
{
var exe_name = exe.name;
if (target.result.os.tag == .windows) {
exe_name = "zar.exe";
}
const exe_path = try std.fs.path.join(b.allocator, &[_][]const u8{ b.install_path, "bin", exe_name });
defer b.allocator.free(exe_path);
exe_options.addOption([]const u8, "zar_exe_path", exe_path);
}

const run_cmd = b.addRunArtifact(exe);
run_cmd.step.dependOn(b.getInstallStep());
Expand All @@ -171,11 +181,12 @@ pub fn build(b: *std.Build) !void {

if (build_test_executable_only) {
const test_step = b.step("test", "Run tests");
test_step.dependOn(&tests.step);
// tests.emit_bin = .{ .emit_to = "zig-out/bin/test" };
b.installArtifact(tests);
test_step.dependOn(b.getInstallStep());
} else {
const test_step = b.step("test", "Run tests");
const run_tests = b.addRunArtifact(tests);
test_step.dependOn(b.getInstallStep());
test_step.dependOn(&run_tests.step);
}
}
Loading
Loading