summaryrefslogtreecommitdiff
path: root/build.zig
diff options
context:
space:
mode:
authorRobby Zambito <contact@robbyzambito.me>2025-04-19 23:56:47 -0400
committerRobby Zambito <contact@robbyzambito.me>2025-04-27 18:03:06 -0400
commitee6062334b0d2ed391c8987b6219835e12860706 (patch)
tree421ccd25da3d9868f1c68df5e48c6111ec53495f /build.zig
parent683a2015b0a2d410d012bef404e891da5f6f261e (diff)
Initial C api
Diffstat (limited to 'build.zig')
-rw-r--r--build.zig22
1 files changed, 20 insertions, 2 deletions
diff --git a/build.zig b/build.zig
index a45ac7c..6f7f1e4 100644
--- a/build.zig
+++ b/build.zig
@@ -1,4 +1,5 @@
const std = @import("std");
+const Step = std.Build.Step;
// Although this function looks imperative, note that its job is to
// declaratively construct a build graph that will be executed by an external
@@ -37,13 +38,30 @@ pub fn build(b: *std.Build) void {
exe_mod.addImport("zaprus", lib_mod);
exe_mod.addImport("clap", b.dependency("clap", .{}).module("clap"));
- const lib = b.addLibrary(.{
+ const static_lib = b.addLibrary(.{
.linkage = .static,
.name = "zaprus",
.root_module = lib_mod,
});
- b.installArtifact(lib);
+ b.installArtifact(static_lib);
+
+ const dynamic_lib = b.addLibrary(.{
+ .linkage = .dynamic,
+ .name = "zaprus",
+ .root_module = lib_mod,
+ });
+
+ b.installArtifact(dynamic_lib);
+
+ // C Headers
+ const c_header = b.addInstallFileWithDir(
+ b.path("include/zaprus.h"),
+ .header,
+ "zaprus.h",
+ );
+
+ b.getInstallStep().dependOn(&c_header.step);
// This creates another `std.Build.Step.Compile`, but this one builds an executable
// rather than a static library.