fix: fix build
This commit is contained in:
@@ -7,8 +7,10 @@ pub fn build(b: *std.Build) !void {
|
|||||||
const shared = b.option(bool, "build-shared", "Build a shared library") orelse true;
|
const shared = b.option(bool, "build-shared", "Build a shared library") orelse true;
|
||||||
const reuse_alloc = b.option(bool, "reuse-allocator", "Reuse the library allocator") orelse false;
|
const reuse_alloc = b.option(bool, "reuse-allocator", "Reuse the library allocator") orelse false;
|
||||||
|
|
||||||
const lib = b.addLibrary(.{
|
const library_name = "tree-sitter-emm";
|
||||||
.name = "tree-sitter-emm",
|
|
||||||
|
const lib: *std.Build.Step.Compile = b.addLibrary(.{
|
||||||
|
.name = library_name,
|
||||||
.linkage = if (shared) .dynamic else .static,
|
.linkage = if (shared) .dynamic else .static,
|
||||||
.root_module = b.createModule(.{
|
.root_module = b.createModule(.{
|
||||||
.target = target,
|
.target = target,
|
||||||
@@ -50,32 +52,12 @@ pub fn build(b: *std.Build) !void {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
const module = b.addModule("tree_sitter_emm", .{
|
const module = b.addModule(library_name, .{
|
||||||
.root_source_file = b.path("bindings/zig/root.zig"),
|
.root_source_file = b.path("bindings/zig/root.zig"),
|
||||||
.target = target,
|
.target = target,
|
||||||
.optimize = optimize,
|
.optimize = optimize,
|
||||||
});
|
});
|
||||||
module.linkLibrary(lib);
|
module.linkLibrary(lib);
|
||||||
|
|
||||||
const tree_sitter = b.dependency("tree_sitter", .{
|
|
||||||
.target = target,
|
|
||||||
.optimize = optimize,
|
|
||||||
});
|
|
||||||
module.addImport("tree_sitter", tree_sitter.module("tree_sitter"));
|
|
||||||
|
|
||||||
const tests = b.addTest(.{
|
|
||||||
.root_module = b.createModule(.{
|
|
||||||
.root_source_file = b.path("bindings/zig/test.zig"),
|
|
||||||
.target = target,
|
|
||||||
.optimize = optimize,
|
|
||||||
}),
|
|
||||||
});
|
|
||||||
tests.root_module.addImport("tree_sitter", tree_sitter.module("tree_sitter"));
|
|
||||||
tests.root_module.addImport("tree_sitter_emm", module);
|
|
||||||
|
|
||||||
const run_tests = b.addRunArtifact(tests);
|
|
||||||
const test_step = b.step("test", "Run unit tests");
|
|
||||||
test_step.dependOn(&run_tests.step);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
inline fn fileExists(b: *std.Build, filename: []const u8) bool {
|
inline fn fileExists(b: *std.Build, filename: []const u8) bool {
|
||||||
|
|||||||
Reference in New Issue
Block a user