summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
authorRobby Zambito <contact@robbyzambito.me>2026-01-24 16:13:35 -0500
committerRobby Zambito <contact@robbyzambito.me>2026-01-24 17:16:06 -0500
commit16fd65e281776bd27d9aefdcfb39fa8b8f7a9fba (patch)
treede77af954753512ccca8d030f8637048696ef4b6 /build.zig
parent8965a4d5d4ce494ae45ea28186379ea7aea9d2e1 (diff)
Add C API
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig17
1 files changed, 17 insertions, 0 deletions
diff --git a/build.zig b/build.zig
index c07def0..1b7e474 100644
--- a/build.zig
+++ b/build.zig
@@ -41,6 +41,23 @@ pub fn build(b: *std.Build) void {
.target = target,
});
+ // Create static library
+ const lib = b.addLibrary(.{
+ .name = "zaprus",
+ .root_module = b.createModule(.{
+ .root_source_file = b.path("src/c_api.zig"),
+ .target = target,
+ .optimize = optimize,
+ .link_libc = true,
+ .imports = &.{
+ .{ .name = "zaprus", .module = mod },
+ },
+ }),
+ });
+
+ b.installArtifact(lib);
+ lib.installHeader(b.path("include/zaprus.h"), "zaprus.h");
+
// Here we define an executable. An executable needs to have a root module
// which needs to expose a `main` function. While we could add a main function
// to the module defined above, it's sometimes preferable to split business