aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authordec05eba <dec05eba@protonmail.com>2023-09-13 21:01:06 +0200
committerdec05eba <dec05eba@protonmail.com>2023-09-13 21:01:06 +0200
commita1b12e879c16dcdfbcc5fc8975ba14d692528c6b (patch)
treeb8d3d6a7cc6ac1598b21a9570db29df006de8e8d
parent2ca2386c1f41f3820e22281de570b19380682086 (diff)
Add build.zigHEADmaster
-rw-r--r--.gitignore3
-rw-r--r--build.zig32
2 files changed, 35 insertions, 0 deletions
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);
+}