From a1b12e879c16dcdfbcc5fc8975ba14d692528c6b Mon Sep 17 00:00:00 2001 From: dec05eba Date: Wed, 13 Sep 2023 21:01:06 +0200 Subject: Add build.zig --- .gitignore | 3 +++ build.zig | 32 ++++++++++++++++++++++++++++++++ 2 files changed, 35 insertions(+) create mode 100644 build.zig diff --git a/.gitignore b/.gitignore index 8773c34..e029cde 100644 --- a/.gitignore +++ b/.gitignore @@ -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); +} -- cgit v1.2.3