37 lines
1 KiB
Zig
37 lines
1 KiB
Zig
|
|
const std = @import("std");
|
||
|
|
|
||
|
|
pub fn build(b: *std.Build) void {
|
||
|
|
const target = b.standardTargetOptions(.{});
|
||
|
|
const optimize = b.standardOptimizeOption(.{});
|
||
|
|
|
||
|
|
// Create library
|
||
|
|
const reticulumzero = b.addLibrary(.{
|
||
|
|
.name = "reticulum-zero",
|
||
|
|
.linkage = .static,
|
||
|
|
.root_module = b.createModule(.{
|
||
|
|
.root_source_file = b.path("src/root.zig"),
|
||
|
|
.target = target,
|
||
|
|
.optimize = optimize,
|
||
|
|
}),
|
||
|
|
});
|
||
|
|
|
||
|
|
// Output library object
|
||
|
|
b.installArtifact(reticulumzero);
|
||
|
|
|
||
|
|
// Expose library as a module
|
||
|
|
try b.modules.put(b.dupe("reticulum-zero"), reticulumzero.root_module);
|
||
|
|
|
||
|
|
// Set up unit testing
|
||
|
|
const unit_tests = b.addTest(.{
|
||
|
|
.root_source_file = b.path("src/root.zig"),
|
||
|
|
.target = target,
|
||
|
|
.optimize = optimize,
|
||
|
|
});
|
||
|
|
|
||
|
|
const run_unit_tests = b.addRunStep(unit_tests);
|
||
|
|
|
||
|
|
// `zig build test` command
|
||
|
|
const test_step = b.step("test", "Run library unit tests");
|
||
|
|
test_step.dependency(&run_unit_tests.step);
|
||
|
|
}
|