From 4275023f1677b472bb57c707e71e970acce13e40 Mon Sep 17 00:00:00 2001 From: Frank Denis Date: Wed, 18 Jan 2023 21:00:48 +0100 Subject: [PATCH] On Windows, a ".LIB" file can be either shared or static We were overwriting the static library with the shared one. --- build.zig | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/build.zig b/build.zig index 9ea6126f..eff3b2fc 100644 --- a/build.zig +++ b/build.zig @@ -16,13 +16,17 @@ pub fn build(b: *std.build.Builder) !void { const enable_benchmarks = b.option(bool, "enable_benchmarks", "Whether tests should be benchmarks.") orelse false; const benchmarks_iterations = b.option(u32, "iterations", "Number of iterations for benchmarks.") orelse 200; + const shared = b.addSharedLibrary( + if (target.isWindows()) "sodium_shared" else "sodium", + null, + .unversioned, + ); const static = b.addStaticLibrary("sodium", null); - const shared = b.addSharedLibrary("sodium", null, .unversioned); - static.strip = true; shared.strip = true; + static.strip = true; - const libs_ = [_]*LibExeObjStep{ static, shared }; - const libs = if (target.getOsTag() == .wasi) libs_[0..1] else libs_[0..]; + const libs_ = [_]*LibExeObjStep{ shared, static }; + const libs = if (target.getOsTag() == .wasi) libs_[1..] else libs_[0..]; const prebuilt_version_file_path = "builds/msvc/version.h"; const version_file_path = "include/sodium/version.h";