summary refs log tree commit diff
path: root/build.zig
diff options
context:
space:
mode:
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig11
1 files changed, 8 insertions, 3 deletions
diff --git a/build.zig b/build.zig
index 11c7deb..07007ad 100644
--- a/build.zig
+++ b/build.zig
@@ -35,16 +35,21 @@ fn addExampleStep(comptime name: []const u8, description: []const u8,
     b.step(name, description).dependOn(&cmd.step);
 }
 
+/// Link given library, executable, or object with shared libraries.
+pub fn link(lib_exe_obj: *LibExeObjStep) void {
+    lib_exe_obj.linkSystemLibrary("openal");
+    lib_exe_obj.linkSystemLibrary("sndfile");
+    lib_exe_obj.linkSystemLibrary("c");
+}
+
 pub fn build(b: *Builder) void {
     // Standard release options allow the person running `zig build` to select
     // between Debug, ReleaseSafe, ReleaseFast, and ReleaseSmall.
     const mode = b.standardReleaseOptions();
 
     const lib = b.addStaticLibrary("zeal", "src/zeal.zig");
-    lib.linkSystemLibrary("openal");
-    lib.linkSystemLibrary("sndfile");
-    lib.linkSystemLibrary("c");
     lib.setBuildMode(mode);
+    link(lib);
     lib.install();
 
     var main_tests = b.addTest("src/zeal.zig");