diff --git a/build.zig b/build.zig index 12f5e40..aa6d968 100644 --- a/build.zig +++ b/build.zig @@ -3,6 +3,7 @@ const std = @import("std"); const Build = std.Build; pub const Language = lua_setup.Language; const Step = std.Build.Step; +const Translator = @import("translate_c").Translator; const lua_setup = @import("build/lua.zig"); const luau_setup = @import("build/luau.zig"); @@ -96,22 +97,22 @@ pub fn build(b: *Build) void { .luau => b.path("build/include/luau_all.h"), else => b.path("build/include/lua_all.h"), }; - const c_headers = b.addTranslateC(.{ - .root_source_file = c_header_path, + const translate_c = b.dependency("translate_c", .{}); + + const t: Translator = .init(translate_c, .{ + .c_source_file = c_header_path, .target = target, .optimize = optimize, }); - c_headers.addIncludePath(lib.getEmittedIncludeTree()); + t.addIncludePath(lib.getEmittedIncludeTree()); // If we've been given additional system headers, add them now // Useful for things like linking Emscripten headers by including a new sysroot if (additional_system_headers != null) { - c_headers.addSystemIncludePath(additional_system_headers.?); + t.addSystemIncludePath(additional_system_headers.?); } - c_headers.step.dependOn(&install_lib.step); - - const ziglua_c = c_headers.createModule(); + const ziglua_c = t.mod; b.modules.put(b.graph.arena, "ziglua-c", ziglua_c) catch @panic("OOM"); zlua.addImport("c", ziglua_c); diff --git a/build.zig.zon b/build.zig.zon index 151c47d..b5090b8 100644 --- a/build.zig.zon +++ b/build.zig.zon @@ -50,5 +50,9 @@ .hash = "N-V-__8AAFB1kwDHb7dLmDsOv91rOkqorfDB_2nJtqnp4F-b", .lazy = true, }, + .translate_c = .{ + .url = "git+https://codeberg.org/ziglang/translate-c#46b5609b5ac4c0a896217d1d984f3ae50e4810b5", + .hash = "translate_c-0.0.0-Q_BUWpf0BgAwrh5AM-acJcslN_YPEhcoCVKbbNjwuUTJ", + }, }, } diff --git a/src/lib.zig b/src/lib.zig index 23b16fa..e2892c8 100644 --- a/src/lib.zig +++ b/src/lib.zig @@ -5461,6 +5461,7 @@ pub fn compile(allocator: Allocator, source: []const u8, options: CompileOptions .coverageLevel = options.coverage_level, .vectorLib = options.vector_lib, .vectorCtor = options.vector_ctor, + .vectorType = options.vector_type, .mutableGlobals = options.mutable_globals, .userdataTypes = options.userdata_types, };