build.zig (1120B)
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 exe = b.addExecutable(.{ 8 .name = "zipdl", 9 .root_source_file = .{ .path = "src/main.zig" }, 10 .target = target, 11 .optimize = optimize, 12 }); 13 const zip = b.dependency("zip", .{ .target = target, .optimize = optimize }); 14 exe.addModule("zip", zip.module("zip")); 15 16 b.installArtifact(exe); 17 18 const run_cmd = b.addRunArtifact(exe); 19 run_cmd.step.dependOn(b.getInstallStep()); 20 21 if (b.args) |args| { 22 run_cmd.addArgs(args); 23 } 24 25 const run_step = b.step("run", "Run the app"); 26 run_step.dependOn(&run_cmd.step); 27 28 const unit_tests = b.addTest(.{ 29 .root_source_file = .{ .path = "src/main.zig" }, 30 .target = target, 31 .optimize = optimize, 32 }); 33 unit_tests.addModule("zip", zip.module("zip")); 34 35 const run_unit_tests = b.addRunArtifact(unit_tests); 36 37 const test_step = b.step("test", "Run unit tests"); 38 test_step.dependOn(&run_unit_tests.step); 39 }