Update for Zig 0.11

This commit is contained in:
Frank Denis 2023-08-12 11:21:37 +02:00
parent 709fed6b73
commit 8aef018182
2 changed files with 15 additions and 12 deletions

View file

@ -24,7 +24,7 @@ Dependencies:
Compilation:
$ zig build -Drelease-safe
$ zig build -Drelease
## Using cmake and gcc or clang:

View file

@ -1,21 +1,24 @@
const std = @import("std");
pub fn build(b: *std.build.Builder) !void {
var target = b.standardTargetOptions(.{});
const mode = b.standardReleaseOptions();
const target = b.standardTargetOptions(.{});
const optimize = b.standardOptimizeOption(.{ .preferred_optimize_mode = .ReleaseSmall });
const minisign = b.addExecutable("minisign", null);
minisign.setTarget(target);
minisign.setBuildMode(mode);
minisign.install();
const minisign = b.addExecutable(.{
.name = "minisign",
.target = target,
.optimize = optimize,
});
minisign.linkLibC();
minisign.addLibraryPath("/opt/homebrew/lib");
minisign.addLibraryPath("/usr/local/lib");
minisign.addLibraryPath(.{ .path = "/opt/homebrew/lib" });
minisign.addLibraryPath(.{ .path = "/usr/local/lib" });
minisign.linkSystemLibrary("sodium");
minisign.addIncludePath("src");
minisign.addSystemIncludePath("/opt/homebrew/include");
minisign.addSystemIncludePath("/usr/local/include");
minisign.addIncludePath(.{ .path = "src" });
minisign.addSystemIncludePath(.{ .path = "/opt/homebrew/include" });
minisign.addSystemIncludePath(.{ .path = "/usr/local/include" });
minisign.defineCMacro("_GNU_SOURCE", "1");
minisign.addCSourceFiles(&.{ "src/base64.c", "src/get_line.c", "src/helpers.c", "src/minisign.c" }, &.{});
b.installArtifact(minisign);
}