Skip to content

Commit 63e3aab

Browse files
authored
Merge pull request #205 from natecraddock/push-nxtvsuurtknn
fix(build): move to translate-c dependency
2 parents adcd3bd + cc0d531 commit 63e3aab

3 files changed

Lines changed: 13 additions & 7 deletions

File tree

build.zig

Lines changed: 8 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ const std = @import("std");
33
const Build = std.Build;
44
pub const Language = lua_setup.Language;
55
const Step = std.Build.Step;
6+
const Translator = @import("translate_c").Translator;
67

78
const lua_setup = @import("build/lua.zig");
89
const luau_setup = @import("build/luau.zig");
@@ -96,22 +97,22 @@ pub fn build(b: *Build) void {
9697
.luau => b.path("build/include/luau_all.h"),
9798
else => b.path("build/include/lua_all.h"),
9899
};
99-
const c_headers = b.addTranslateC(.{
100-
.root_source_file = c_header_path,
100+
const translate_c = b.dependency("translate_c", .{});
101+
102+
const t: Translator = .init(translate_c, .{
103+
.c_source_file = c_header_path,
101104
.target = target,
102105
.optimize = optimize,
103106
});
104-
c_headers.addIncludePath(lib.getEmittedIncludeTree());
107+
t.addIncludePath(lib.getEmittedIncludeTree());
105108

106109
// If we've been given additional system headers, add them now
107110
// Useful for things like linking Emscripten headers by including a new sysroot
108111
if (additional_system_headers != null) {
109-
c_headers.addSystemIncludePath(additional_system_headers.?);
112+
t.addSystemIncludePath(additional_system_headers.?);
110113
}
111114

112-
c_headers.step.dependOn(&install_lib.step);
113-
114-
const ziglua_c = c_headers.createModule();
115+
const ziglua_c = t.mod;
115116
b.modules.put(b.graph.arena, "ziglua-c", ziglua_c) catch @panic("OOM");
116117

117118
zlua.addImport("c", ziglua_c);

build.zig.zon

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,5 +50,9 @@
5050
.hash = "N-V-__8AAFB1kwDHb7dLmDsOv91rOkqorfDB_2nJtqnp4F-b",
5151
.lazy = true,
5252
},
53+
.translate_c = .{
54+
.url = "git+https://codeberg.org/ziglang/translate-c#46b5609b5ac4c0a896217d1d984f3ae50e4810b5",
55+
.hash = "translate_c-0.0.0-Q_BUWpf0BgAwrh5AM-acJcslN_YPEhcoCVKbbNjwuUTJ",
56+
},
5357
},
5458
}

src/lib.zig

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5461,6 +5461,7 @@ pub fn compile(allocator: Allocator, source: []const u8, options: CompileOptions
54615461
.coverageLevel = options.coverage_level,
54625462
.vectorLib = options.vector_lib,
54635463
.vectorCtor = options.vector_ctor,
5464+
.vectorType = options.vector_type,
54645465
.mutableGlobals = options.mutable_globals,
54655466
.userdataTypes = options.userdata_types,
54665467
};

0 commit comments

Comments
 (0)