Added an option to compile as a dynamic library
This commit is contained in:
parent
ad6eb69ec7
commit
43b3ca386d
1 changed files with 15 additions and 1 deletions
16
build.zig
16
build.zig
|
|
@ -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,
|
||||
});
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue