From c2e895d1748170713c582b182d5790315ac0d0ed Mon Sep 17 00:00:00 2001 From: Nguyễn Gia Phong Date: Fri, 11 Aug 2023 14:04:20 +0900 Subject: Port build recipe to Zig 0.11 --- build.zig | 31 ++++++++++++------------------- 1 file changed, 12 insertions(+), 19 deletions(-) diff --git a/build.zig b/build.zig index a0ba02c..01e1a6e 100644 --- a/build.zig +++ b/build.zig @@ -1,29 +1,22 @@ -const std = @import("std"); +const Build = @import("std").Build; -pub fn build(b: *std.build.Builder) void { - const exe = b.addExecutable("clipbuzz", "src/main.zig"); +pub fn build(b: *Build) void { + const exe = b.addExecutable(.{ + .name = "clipbuzz", + .root_source_file = .{ .path = "src/main.zig" }, + .target = b.standardTargetOptions(.{}), + .optimize = b.standardOptimizeOption(.{}), + }); exe.linkLibC(); exe.linkSystemLibrary("X11"); exe.linkSystemLibrary("Xfixes"); + b.installArtifact(exe); - // 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. - exe.setTarget(b.standardTargetOptions(.{})); - - // Standard release options allow the person running `zig build` to select - // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall. - exe.setBuildMode(b.standardReleaseOptions()); - - exe.install(); - - const run_cmd = exe.run(); + const run_cmd = b.addRunArtifact(exe); run_cmd.step.dependOn(b.getInstallStep()); - if (b.args) |args| { + if (b.args) |args| run_cmd.addArgs(args); - } - const run_step = b.step("run", "Run the app"); + const run_step = b.step("run", "Run clipbuzz"); run_step.dependOn(&run_cmd.step); } -- cgit 1.4.1