aboutsummaryrefslogtreecommitdiff
path: root/comments/build.zig
diff options
context:
space:
mode:
authorMartin Ashby <martin@ashbysoft.com>2023-08-28 20:22:21 +0100
committerMartin Ashby <martin@ashbysoft.com>2023-08-28 20:22:21 +0100
commit9075971696cae25228779e9deb9dba113b3d1b43 (patch)
tree57fc964986570483f624269f31ac6476e8c9749b /comments/build.zig
parent570d9a2503cfd06303c96f40253f80d8cee84766 (diff)
downloadmfashby.net-9075971696cae25228779e9deb9dba113b3d1b43.tar.gz
mfashby.net-9075971696cae25228779e9deb9dba113b3d1b43.tar.bz2
mfashby.net-9075971696cae25228779e9deb9dba113b3d1b43.tar.xz
mfashby.net-9075971696cae25228779e9deb9dba113b3d1b43.zip
Switch to zig package manager instead of using submodules
Add smtp library Send a notification on comment.
Diffstat (limited to 'comments/build.zig')
-rw-r--r--comments/build.zig18
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);