fzig/build.zig
2026-04-06 00:01:53 +02:00

80 lines
2.2 KiB
Zig

const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const lazyValues = b.addModule("lazy_evaluation", .{
.root_source_file = b.path("src/lazy.zig"),
.target = target,
.optimize = optimize,
.imports = &.{},
});
const niceties = b.addModule("niceties", .{
.root_source_file = b.path("src/niceties.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "lazy_evaluation", .module = lazyValues },
},
});
lazyValues.addImport("niceties", niceties);
const partial_application = b.addModule("partial_application", .{
.root_source_file = b.path("src/partial.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "lazy_evaluation", .module = lazyValues },
},
});
const exe = b.addExecutable(.{
.name = "fzig",
.root_module = b.createModule(.{
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
.imports = &.{
.{ .name = "partial_application", .module = partial_application },
.{ .name = "niceties", .module = niceties },
.{ .name = "lazy_evaluation", .module = lazyValues },
},
}),
.use_llvm = false,
.use_lld = false,
.linkage = .static,
});
b.installArtifact(exe);
const run_step = b.step("run", "Run the app");
const run_cmd = b.addRunArtifact(exe);
run_step.dependOn(&run_cmd.step);
run_cmd.step.dependOn(b.getInstallStep());
if (b.args) |args| {
run_cmd.addArgs(args);
}
const exe_tests = b.addTest(.{
.root_module = exe.root_module,
});
const run_exe_tests = b.addRunArtifact(exe_tests);
const test_step = b.step("test", "Run tests");
test_step.dependOn(&run_exe_tests.step);
const exe_check = b.addExecutable(.{
.name = "foo",
.root_module = exe.root_module,
});
const check = b.step("check", "Check if foo compiles");
check.dependOn(&exe_check.step);
}