Added an option to compile as a dynamic library

This commit is contained in:
Gu://em_ 2026-06-09 21:38:13 +02:00
parent ad6eb69ec7
commit 43b3ca386d

View file

@ -1,6 +1,20 @@
const std = @import("std");
pub fn build(b: *std.Build) void {
// Compilation options
const opt_shared = b.option(
bool,
"shared",
"Build as a dynamic (shared) library",
) orelse false;
const linkage: std.builtin.LinkMode = if (opt_shared)
.static
else
.dynamic;
// Configuration
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{});
@ -14,7 +28,7 @@ pub fn build(b: *std.Build) void {
// Create library
const lib = b.addLibrary(.{
.name = "reticulum-zero",
.linkage = .static,
.linkage = linkage,
.root_module = root_module,
});