diff options
-rw-r--r-- | .gitignore | 3 | ||||
-rw-r--r-- | build.zig | 32 |
2 files changed, 35 insertions, 0 deletions
@@ -21,3 +21,6 @@ /utils/tinypcminfo /bazel* + +zig-out/ +zig-cache/
\ No newline at end of file diff --git a/build.zig b/build.zig new file mode 100644 index 0000000..0870992 --- /dev/null +++ b/build.zig @@ -0,0 +1,32 @@ +const std = @import("std"); + +pub fn build(b: *std.Build) void { + const target = b.standardTargetOptions(.{}); + const optimize = b.standardOptimizeOption(.{}); + + const lib = b.addStaticLibrary(.{ + .name = "tinyalsa", + .target = target, + .optimize = optimize, + }); + + lib.addCSourceFiles(&.{ + "src/limits.c", + "src/mixer_hw.c", + "src/mixer_plugin.c", + "src/mixer.c", + "src/pcm_plugin.c", + "src/snd_card_plugin.c", + "src/pcm_hw.c", + "src/pcm.c", + }, &.{}); + + lib.addIncludePath(.{ .path = "include" }); + lib.linkLibC(); + lib.installHeadersDirectory("include", "."); + lib.strip = optimize != std.builtin.OptimizeMode.Debug; + lib.want_lto = optimize != std.builtin.OptimizeMode.Debug; + lib.single_threaded = true; + + b.installArtifact(lib); +} |