diff options
Diffstat (limited to 'comments/build.zig')
-rw-r--r-- | comments/build.zig | 18 |
1 files changed, 13 insertions, 5 deletions
diff --git a/comments/build.zig b/comments/build.zig index b7f3bcc..a678527 100644 --- a/comments/build.zig +++ b/comments/build.zig @@ -15,6 +15,8 @@ pub fn build(b: *std.Build) void { // set a preferred release mode, allowing the user to decide how to optimize. const optimize = b.standardOptimizeOption(.{}); + const opts = .{ .target = target, .optimize = optimize }; + const exe = b.addExecutable(.{ .name = "comments", // In this case the main source file is merely a path, however, in more @@ -24,15 +26,21 @@ pub fn build(b: *std.Build) void { .optimize = optimize, }); - const zws = b.addModule("zws", .{ .source_file = .{ .path = "lib/zigwebserver/src/zigwebserver.zig" } }); - exe.addModule("zws", zws); + const zws = b.dependency("zigwebserver", opts); + exe.addModule("zws", zws.module("zigwebserver")); + exe.linkLibrary(zws.artifact("zigwebserver")); exe.linkLibC(); exe.linkSystemLibrary("libpq"); exe.addIncludePath(.{ .path = "/usr/include" }); - const mustache = b.addModule("mustache", .{ .source_file = .{ .path = "lib/mustache-zig/src/mustache.zig" } }); - exe.addModule("mustache", mustache); + const mustache = b.dependency("mustache", opts); + exe.addModule("mustache", mustache.module("mustache")); + exe.linkLibrary(mustache.artifact("mustache-static")); + + const smtp = b.dependency("smtp", opts); + exe.addModule("smtp", smtp.module("smtp")); + exe.linkLibrary(smtp.artifact("smtp")); // This declares intent for the executable to be installed into the // standard location when the user invokes the "install" step (the default @@ -69,7 +77,7 @@ pub fn build(b: *std.Build) void { .target = target, .optimize = optimize, }); - unit_tests.addModule("mustache", mustache); + unit_tests.addModule("mustache", mustache.module("mustache")); const run_unit_tests = b.addRunArtifact(unit_tests); |