diff --git a/build.zig b/build.zig index d0e2e2d..aee58c2 100644 --- a/build.zig +++ b/build.zig @@ -2,9 +2,10 @@ const std = @import("std"); pub fn build(b: *std.Build) void { const optimize = b.standardOptimizeOption(.{}); + const target = b.standardTargetOptions(.{}); _ = b.addModule("ini", .{ - .source_file = .{ + .root_source_file = .{ .path = "src/ini.zig", }, }); @@ -12,9 +13,10 @@ pub fn build(b: *std.Build) void { const lib = b.addStaticLibrary(.{ .name = "ini", .root_source_file = .{ .path = "src/lib.zig" }, - .target = b.standardTargetOptions(.{}), + .target = target, .optimize = optimize, }); + lib.bundle_compiler_rt = true; lib.addIncludePath(.{ .path = "src" }); lib.linkLibC(); @@ -24,6 +26,7 @@ pub fn build(b: *std.Build) void { const example_c = b.addExecutable(.{ .name = "example-c", .optimize = optimize, + .target = target, }); example_c.addCSourceFile(.{ .file = .{ @@ -45,8 +48,9 @@ pub fn build(b: *std.Build) void { .name = "example-zig", .root_source_file = .{ .path = "example/example.zig" }, .optimize = optimize, + .target = target, }); - example_zig.addModule("ini", b.modules.get("ini").?); + example_zig.root_module.addImport("ini", b.modules.get("ini").?); b.installArtifact(example_zig); diff --git a/src/lib-test.zig b/src/lib-test.zig index 9c61130..94c496c 100644 --- a/src/lib-test.zig +++ b/src/lib-test.zig @@ -78,7 +78,7 @@ test "buffer parser" { } test "file parser" { - var file = c.fopen("example/example.ini", "rb") orelse unreachable; + const file = c.fopen("example/example.ini", "rb") orelse unreachable; defer _ = c.fclose(file); var parser: c.ini_Parser = undefined;