-
-
Notifications
You must be signed in to change notification settings - Fork 6
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Build fails on latest Zig #3
Comments
Please see ziglang/zig#14498 I'm not sure what Zig version(s) this library is supposed to target, diff --git a/build.zig b/build.zig
index a168b42d1111..2352797f092e 100644
--- a/build.zig
+++ b/build.zig
@@ -1,36 +1,51 @@
const std = @import("std");
pub fn build(b: *std.build.Builder) void {
- const mode = b.standardReleaseOptions();
+ const optimize = b.standardOptimizeOption(.{});
- const lib = b.addStaticLibrary("ini", "src/lib.zig");
+ const lib = b.addStaticLibrary(.{
+ .name = "ini",
+ .root_source_file = .{ .path = "src/lib.zig" },
+ .target = b.standardTargetOptions(.{}),
+ .optimize = optimize,
+ });
lib.bundle_compiler_rt = true;
lib.addIncludePath("src");
lib.linkLibC();
- lib.setBuildMode(mode);
lib.install();
- const example_c = b.addExecutable("example-c", null);
+ const example_c = b.addExecutable(.{
+ .name = "example-c",
+ .optimize = optimize,
+ });
example_c.addCSourceFile("example/example.c", &[_][]const u8{ "-Wall", "-Wextra", "-pedantic" });
example_c.addIncludePath("src");
example_c.linkLibrary(lib);
example_c.linkLibC();
- example_c.setBuildMode(mode);
example_c.install();
- const example_zig = b.addExecutable("example-zig", "example/example.zig");
- example_zig.addPackagePath("ini", "src/ini.zig");
- example_zig.setBuildMode(mode);
+ const example_zig = b.addExecutable(.{
+ .name = "example-zig",
+ .root_source_file = .{ .path = "example/example.zig" },
+ .optimize = optimize,
+ });
+ example_zig.addAnonymousModule("ini", .{
+ .source_file = .{ .path = "src/ini.zig" },
+ });
example_zig.install();
- var main_tests = b.addTest("src/test.zig");
- main_tests.setBuildMode(mode);
+ var main_tests = b.addTest(.{
+ .root_source_file = .{ .path = "src/test.zig" },
+ .optimize = optimize,
+ });
- var binding_tests = b.addTest("src/lib-test.zig");
+ var binding_tests = b.addTest(.{
+ .root_source_file = .{ .path = "src/lib-test.zig" },
+ .optimize = optimize,
+ });
binding_tests.addIncludePath("src");
binding_tests.linkLibrary(lib);
binding_tests.linkLibC();
- binding_tests.setBuildMode(mode);
const test_step = b.step("test", "Run library tests");
test_step.dependOn(&main_tests.step); |
Can you PR that patch? all my libraries track |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
zig build
fails with latest Zig.The text was updated successfully, but these errors were encountered: