mirror of
https://github.com/jedisct1/libsodium.git
synced 2026-08-25 08:37:13 +09:00
Update for Zig 0.15
This commit is contained in:
@@ -174,26 +174,32 @@ pub fn build(b: *std.Build) !void {
|
||||
else => {},
|
||||
}
|
||||
|
||||
const static_lib = b.addStaticLibrary(.{
|
||||
const static_lib = b.addLibrary(.{
|
||||
.name = if (target.result.isMinGW()) "libsodium-static" else "sodium",
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.linkage = .static,
|
||||
.root_module = b.createModule(.{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
}),
|
||||
});
|
||||
const shared_lib = b.addSharedLibrary(.{
|
||||
const shared_lib = b.addLibrary(.{
|
||||
.name = if (target.result.isMinGW()) "libsodium" else "sodium",
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.strip = optimize != .Debug and !target.result.isMinGW(),
|
||||
.linkage = .dynamic,
|
||||
.root_module = b.createModule(.{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.strip = optimize != .Debug and !target.result.isMinGW(),
|
||||
}),
|
||||
});
|
||||
|
||||
// work out which libraries we are building
|
||||
var libs = std.ArrayList(*Compile).init(b.allocator);
|
||||
defer libs.deinit();
|
||||
var libs = std.ArrayList(*Compile){};
|
||||
defer libs.deinit(heap.page_allocator);
|
||||
if (build_static) {
|
||||
try libs.append(static_lib);
|
||||
try libs.append(heap.page_allocator, static_lib);
|
||||
}
|
||||
if (build_shared) {
|
||||
try libs.append(shared_lib);
|
||||
try libs.append(heap.page_allocator, shared_lib);
|
||||
}
|
||||
|
||||
const prebuilt_version_file_path = "builds/msvc/version.h";
|
||||
@@ -259,9 +265,11 @@ pub fn build(b: *std.Build) !void {
|
||||
const exe_name = name[0 .. name.len - 2];
|
||||
var exe = b.addExecutable(.{
|
||||
.name = exe_name,
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.strip = true,
|
||||
.root_module = b.createModule(.{
|
||||
.target = target,
|
||||
.optimize = optimize,
|
||||
.strip = true,
|
||||
}),
|
||||
});
|
||||
exe.linkLibC();
|
||||
exe.linkLibrary(static_lib);
|
||||
@@ -272,7 +280,8 @@ pub fn build(b: *std.Build) !void {
|
||||
if (enable_benchmarks) {
|
||||
exe.root_module.addCMacro("BENCHMARKS", "1");
|
||||
var buf: [16]u8 = undefined;
|
||||
exe.root_module.addCMacro("ITERATIONS", std.fmt.bufPrintIntToSlice(&buf, benchmarks_iterations, 10, .lower, .{}));
|
||||
const n = std.fmt.bufPrint(&buf, "{d}", .{benchmarks_iterations}) catch unreachable;
|
||||
exe.root_module.addCMacro("ITERATIONS", n);
|
||||
}
|
||||
|
||||
b.installArtifact(exe);
|
||||
|
||||
Reference in New Issue
Block a user