From a81ca0dcf3c811e91c4a81f6f1cb1d66be8ff427 Mon Sep 17 00:00:00 2001 From: Madeorsk Date: Fri, 11 Oct 2024 12:07:03 +0200 Subject: [PATCH] Fix zouter module configuration. --- build.zig | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/build.zig b/build.zig index b075a78..4932fba 100644 --- a/build.zig +++ b/build.zig @@ -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);