summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
authorGravatar jinzhongjia2024-07-04 08:32:41 +0800
committerGravatar Jimmi Holst Christensen2024-07-05 09:00:05 +0200
commitd71cc39a94f3e6ccbad00c25d350c9147de4df9f (patch)
treea0d3788a7f56399c97ac19c95b8c3f1d02c9dfe9 /build.zig
parentUpdate to latest zig (diff)
downloadzig-clap-0.9.1.tar.gz
zig-clap-0.9.1.tar.xz
zig-clap-0.9.1.zip
Add compatibility code between zig 0.12 and 0.130.9.1release-0.9.1
The newest version of zig-clap can easily support both 0.12 and 0.13 zig versions with just a few lines of code
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig7
1 files changed, 6 insertions, 1 deletions
diff --git a/build.zig b/build.zig
index 0e35a04..ef4d191 100644
--- a/build.zig
+++ b/build.zig
@@ -1,4 +1,9 @@
1const std = @import("std"); 1const std = @import("std");
2const builtin = @import("builtin");
3
4const current_zig = builtin.zig_version;
5// NOTE: this is just for 12 compatible, when 14 release, we can remove this!
6const ProgressNode = if (current_zig.minor == 12) *std.Progress.Node else std.Progress.Node;
2 7
3pub fn build(b: *std.Build) void { 8pub fn build(b: *std.Build) void {
4 const clap_mod = b.addModule("clap", .{ .root_source_file = b.path("clap.zig") }); 9 const clap_mod = b.addModule("clap", .{ .root_source_file = b.path("clap.zig") });
@@ -63,7 +68,7 @@ fn readMeStep(b: *std.Build) *std.Build.Step {
63 .name = "ReadMeStep", 68 .name = "ReadMeStep",
64 .owner = b, 69 .owner = b,
65 .makeFn = struct { 70 .makeFn = struct {
66 fn make(step: *std.Build.Step, _: std.Progress.Node) anyerror!void { 71 fn make(step: *std.Build.Step, _: ProgressNode) anyerror!void {
67 @setEvalBranchQuota(10000); 72 @setEvalBranchQuota(10000);
68 _ = step; 73 _ = step;
69 const file = try std.fs.cwd().createFile("README.md", .{}); 74 const file = try std.fs.cwd().createFile("README.md", .{});