From a782c7083056558ccfe41ca42857a4680d55a9d9 Mon Sep 17 00:00:00 2001 From: Martin Ashby Date: Mon, 28 Aug 2023 19:37:50 +0100 Subject: Add library output as well as executable --- build.zig | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/build.zig b/build.zig index 8b32d17..087d7ae 100644 --- a/build.zig +++ b/build.zig @@ -16,7 +16,7 @@ pub fn build(b: *std.Build) void { const optimize = b.standardOptimizeOption(.{}); const exe = b.addExecutable(.{ - .name = "zigwebserver", + .name = "zigwebserver-exe", // In this case the main source file is merely a path, however, in more // complicated build scripts, this could be a generated file. .root_source_file = .{ .path = "src/main.zig" }, @@ -24,6 +24,14 @@ pub fn build(b: *std.Build) void { .optimize = optimize, }); + const lib = b.addStaticLibrary(.{ + .name = "zigwebserver", + .root_source_file = .{ .path = "src/zigwebserver.zig" }, + .target = target, + .optimize = optimize, + }); + b.installArtifact(lib); + // for zig module system _ = b.addModule("zigwebserver", .{ .source_file = .{ .path = "src/zigwebserver.zig" } }); -- cgit v1.2.3-ZIG