From 9df12950369ee5b1278ca4e8bf6d68bc4ee5c944 Mon Sep 17 00:00:00 2001 From: Meghan Denny Date: Sun, 26 Nov 2023 00:11:00 -0800 Subject: [PATCH] build.zig: update for zig 0.11.0 --- build.zig | 24 +++++++++++------------- 1 file changed, 11 insertions(+), 13 deletions(-) diff --git a/build.zig b/build.zig index d102e72285bc44cea10e17974fd8144642404933..cb207944855bef102100a395983f68953f8f24a0 100644 --- a/build.zig +++ b/build.zig @@ -1,22 +1,20 @@ const std = @import("std"); +const deps = @import("./deps.zig"); pub fn build(b: *std.build.Builder) void { - // Standard target options allows the person running `zig build` to choose - // what target to build for. Here we do not override the defaults, which - // means any target is allowed, and the default is native. Other options - // for restricting supported target set are available. const target = b.standardTargetOptions(.{}); + const mode = b.option(std.builtin.Mode, "mode", "") orelse .Debug; - // Standard release options allow the person running `zig build` to select - // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. - const mode = b.standardReleaseOptions(); + const exe = b.addExecutable(.{ + .name = "zig-flag", + .root_source_file = .{ .path = "src/main.zig" }, + .target = target, + .optimize = mode, + }); + deps.addAllTo(exe); + b.installArtifact(exe); - const exe = b.addExecutable("zig-flag", "src/main.zig"); - exe.setTarget(target); - exe.setBuildMode(mode); - exe.install(); - - const run_cmd = exe.run(); + const run_cmd = b.addRunArtifact(exe); run_cmd.step.dependOn(b.getInstallStep()); if (b.args) |args| { run_cmd.addArgs(args); -- 2.54.0