From dd3e38c8dd8f55347510f4924a7d3d73c03aab6b Mon Sep 17 00:00:00 2001 From: Imbus <> Date: Mon, 6 May 2024 15:06:25 +0200 Subject: [PATCH] Zig build system --- .gitignore | 2 ++ build.zig | 21 +++++++++++++++++++++ 2 files changed, 23 insertions(+) create mode 100644 build.zig diff --git a/.gitignore b/.gitignore index 0dec590..d28b788 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,5 @@ build release docs +zig-out +zig-cache diff --git a/build.zig b/build.zig new file mode 100644 index 0000000..7e286f5 --- /dev/null +++ b/build.zig @@ -0,0 +1,21 @@ +const std = @import("std"); + +// Compile our C source with zig +pub fn build(b: *std.Build) void { + const target = b.standardTargetOptions(.{}); + const optimize = b.standardOptimizeOption(.{ .preferred_optimize_mode = .ReleaseFast }); + + const exe = b.addExecutable(.{ + .name = "ctree", + .target = target, + .optimize = optimize, + .strip = true, + }); + + const sources = &.{ "src/main.c", "src/tree.c" }; + + exe.linkLibC(); + exe.addCSourceFiles(.{ .files = sources }); + + b.installArtifact(exe); +}