53 lines
1.8 KiB
Zig
53 lines
1.8 KiB
Zig
const std = @import("std");
|
|
|
|
pub fn build(b: *std.Build) void {
|
|
const target = b.standardTargetOptions(.{});
|
|
const optimize = b.standardOptimizeOption(.{});
|
|
|
|
const exe = b.addExecutable(.{
|
|
.name = "scratchzig",
|
|
.root_source_file = .{ .path = "src/main.zig" },
|
|
.target = target,
|
|
.optimize = optimize,
|
|
});
|
|
b.installArtifact(exe);
|
|
|
|
const gen = b.addExecutable(.{
|
|
.name = "gen",
|
|
.root_source_file = .{ .path = "src/gen.zig"},
|
|
.target = target,
|
|
.optimize = optimize,
|
|
});
|
|
const run_gen = b.addRunArtifact(gen);
|
|
const foobar_path = run_gen.addOutputFileArg("foobar");
|
|
const install_foobar = b.addInstallFileWithDir(foobar_path, .{ .custom = "res" }, "foobar");
|
|
b.getInstallStep().dependOn(&install_foobar.step);
|
|
|
|
const run_cmd = b.addRunArtifact(exe);
|
|
run_cmd.step.dependOn(b.getInstallStep());
|
|
if (b.args) |args| {
|
|
run_cmd.addArgs(args);
|
|
}
|
|
|
|
// const fizzbuzz = b.addInstallFile(.{ .path = "src/fizzbuzz" } , "res");
|
|
// b.getInstallStep().dependo
|
|
// b.installFile("src/fizzbuzz", "res");
|
|
// b.addInstallFileWithDir(.{ .path = "src/fizzbuzz" }, .{ .custom = "res" }, "fizzbuzz");
|
|
const res = b.addInstallDirectory(.{ .source_dir = .{ .path = "res" }, .install_dir = .{ .prefix = {} }, .install_subdir = "res" });
|
|
b.getInstallStep().dependOn(&res.step);
|
|
|
|
const run_step = b.step("run", "Run the app");
|
|
run_step.dependOn(&run_cmd.step);
|
|
|
|
const exe_unit_tests = b.addTest(.{
|
|
.root_source_file = .{ .path = "src/main.zig" },
|
|
.target = target,
|
|
.optimize = optimize,
|
|
});
|
|
|
|
const run_exe_unit_tests = b.addRunArtifact(exe_unit_tests);
|
|
|
|
const test_step = b.step("test", "Run unit tests");
|
|
test_step.dependOn(&run_exe_unit_tests.step);
|
|
}
|