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: Compilation:
$ zig build -Drelease-safe $ zig build -Drelease
## Using cmake and gcc or clang: ## Using cmake and gcc or clang:

View file

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