mirror of
https://git.robbyzambito.me/zaprus
synced 2025-12-20 16:24:50 +00:00
Initial C api
This commit is contained in:
22
build.zig
22
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.
|
||||
|
||||
Reference in New Issue
Block a user