Fix zouter module configuration.

This commit is contained in:
Madeorsk 2024-10-11 12:07:03 +02:00
parent dfc3a01645
commit 23b6afea35
Signed by: Madeorsk
GPG key ID: 677E51CA765BB79F

View file

@ -26,14 +26,22 @@ pub fn build(b: *std.Build) void {
.optimize = optimize,
});
// Add zap dependency.
lib.root_module.addImport("zap", zap.module("zap"));
// This declares intent for the library to be installed into the standard
// location when the user invokes the "install" step (the default step when
// running `zig build`).
b.installArtifact(lib);
// Add zouter module.
const zouter_module = b.addModule("zouter", .{
.root_source_file = b.path("src/root.zig"),
.target = target,
.optimize = optimize,
});
// Add zap dependency.
lib.root_module.addImport("zap", zap.module("zap"));
zouter_module.addImport("zap", zap.module("zap"));
// Creates a step for unit testing. This only builds the test executable
// but does not run it.
const lib_unit_tests = b.addTest(.{
@ -45,7 +53,7 @@ pub fn build(b: *std.Build) void {
// Add zap dependency.
lib_unit_tests.root_module.addImport("zap", zap.module("zap"));
// Add zouter dependency.
lib_unit_tests.root_module.addImport("zouter", &lib.root_module);
lib_unit_tests.root_module.addImport("zouter", zouter_module);
const run_lib_unit_tests = b.addRunArtifact(lib_unit_tests);