zfin-server/build.zig
2026-03-10 17:29:33 -07:00

51 lines
1.5 KiB
Zig

const std = @import("std");
pub fn build(b: *std.Build) void {
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
const zfin_dep = b.dependency("zfin", .{
.target = target,
.optimize = optimize,
});
const httpz_dep = b.dependency("httpz", .{
.target = target,
.optimize = optimize,
});
const imports: []const std.Build.Module.Import = &.{
.{ .name = "zfin", .module = zfin_dep.module("zfin") },
.{ .name = "httpz", .module = httpz_dep.module("httpz") },
};
const exe = b.addExecutable(.{
.name = "zfin-server",
.root_module = b.createModule(.{
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
.imports = imports,
}),
});
b.installArtifact(exe);
// Run step: `zig build run -- <args>`
const run_step = b.step("run", "Run the server");
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);
}
// Tests
const test_step = b.step("test", "Run all tests");
const tests = b.addTest(.{ .root_module = b.createModule(.{
.root_source_file = b.path("src/main.zig"),
.target = target,
.optimize = optimize,
.imports = imports,
}) });
test_step.dependOn(&b.addRunArtifact(tests).step);
}