Initial library structure, build system and packet implementation
This commit is contained in:
parent
f02cd37a40
commit
dad6a6819c
5 changed files with 381 additions and 0 deletions
36
build.zig
Normal file
36
build.zig
Normal file
|
|
@ -0,0 +1,36 @@
|
|||
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);
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue