diff --git a/build.zig b/build.zig index 7496b4ac..4062e069 100644 --- a/build.zig +++ b/build.zig @@ -8,17 +8,15 @@ pub fn build(b: *std.Build) !void { const shared = b.option(bool, "build-shared", "Build a shared library") orelse false; const amalgamated = b.option(bool, "amalgamated", "Build using an amalgamated source") orelse false; - const lib: *std.Build.Step.Compile = if (!shared) b.addStaticLibrary(.{ + const lib: *std.Build.Step.Compile = b.addLibrary(.{ .name = "tree-sitter", - .target = target, - .optimize = optimize, - .link_libc = true, - }) else b.addSharedLibrary(.{ - .name = "tree-sitter", - .pic = true, - .target = target, - .optimize = optimize, - .link_libc = true, + .linkage = if (shared) .dynamic else .static, + .root_module = b.createModule(.{ + .target = target, + .optimize = optimize, + .link_libc = true, + .pic = if (shared) true else null, + }), }); if (amalgamated) {