build.zig (1421B)
1 const std = @import("std"); 2 3 pub fn build(b: *std.Build) void { 4 const target = b.standardTargetOptions(.{}); 5 const optimize = b.standardOptimizeOption(.{}); 6 7 const zul = b.dependency("zul", .{ 8 .target = target, 9 .optimize = optimize, 10 }); 11 12 const exe = b.addExecutable(.{ 13 .name = "magdalena", 14 .root_module = b.createModule(.{ 15 .root_source_file = b.path("src/main.zig"), 16 .target = target, 17 .optimize = optimize, 18 .link_libc = true, 19 .imports = &.{ 20 .{ .name = "zul", .module = zul.module("zul") }, 21 }, 22 }), 23 }); 24 25 b.installArtifact(exe); 26 27 const run_cmd = b.addRunArtifact(exe); 28 run_cmd.step.dependOn(b.getInstallStep()); 29 if (b.args) |args| { 30 run_cmd.addArgs(args); 31 } 32 const run_step = b.step("run", "Run the app"); 33 run_step.dependOn(&run_cmd.step); 34 35 const tests = b.addTest(.{ 36 .root_module = b.createModule(.{ 37 .root_source_file = b.path("src/main.zig"), 38 .target = target, 39 .optimize = optimize, 40 .link_libc = true, 41 .imports = &.{ 42 .{ .name = "zul", .module = zul.module("zul") }, 43 }, 44 }), 45 }); 46 const run_tests = b.addRunArtifact(tests); 47 const test_step = b.step("test", "Run unit tests"); 48 test_step.dependOn(&run_tests.step); 49 }