From 4936130b917916f33d28942d36dd7c3cdefea345 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Sat, 5 Aug 2023 10:25:10 +0200 Subject: [PATCH] Build shared libraries again, even on Windows --- build.zig | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/build.zig b/build.zig index 12388832..33faf033 100644 --- a/build.zig +++ b/build.zig @@ -22,7 +22,13 @@ pub fn build(b: *std.build.Builder) !void { .optimize = optimize, }); - const libs = [_]*LibExeObjStep{static}; + const shared = b.addSharedLibrary(.{ + .name = if (target.isWindows()) "sodium_shared" else "sodium", + .target = target, + .optimize = optimize, + }); + + const libs = [_]*LibExeObjStep{ static, shared }; const prebuilt_version_file_path = "builds/msvc/version.h"; const version_file_path = "include/sodium/version.h"; @@ -33,7 +39,7 @@ pub fn build(b: *std.build.Builder) !void { for (libs) |lib| { b.installArtifact(lib); - if (optimize != .Debug) { + if (optimize != .Debug and !target.isWindows() and lib != static) { lib.strip = true; } lib.linkLibC();