summary refs log tree commit diff
path: root/build.zig
diff options
context:
space:
mode:
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig13
1 files changed, 10 insertions, 3 deletions
diff --git a/build.zig b/build.zig
index 42a8031..f701451 100644
--- a/build.zig
+++ b/build.zig
@@ -16,7 +16,15 @@
 // You should have received a copy of the GNU Lesser General Public License
 // along with gfz.  If not, see <https://www.gnu.org/licenses/>.
 
-const Builder = @import("std").build.Builder;
+const std = @import("std");
+const Builder = std.build.Builder;
+const LibExeObjStep = std.build.LibExeObjStep;
+
+/// Link given library, executable, or object with shared libraries.
+pub fn link(lib_exe_obj: *LibExeObjStep) void {
+    lib_exe_obj.linkSystemLibrary("glfw");
+    lib_exe_obj.linkSystemLibrary("c");
+}
 
 pub fn build(b: *Builder) void {
     // Standard release options allow the person running `zig build` to select
@@ -24,8 +32,7 @@ pub fn build(b: *Builder) void {
     const mode = b.standardReleaseOptions();
 
     const lib = b.addStaticLibrary("gfz", "src/gfz.zig");
-    lib.linkSystemLibrary("glfw");
-    lib.linkSystemLibrary("c");
+    link(lib);
     lib.setBuildMode(mode);
     lib.install();