Skip to content

Commit 60981aa

Browse files
committed
Adding an option to pass additional system headers to include when building Lua
1 parent 188ba36 commit 60981aa

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

build.zig

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ pub fn build(b: *Build) void {
2121
const system_lua = b.option(bool, "system_lua", "Use system lua") orelse false;
2222
const luau_use_4_vector = b.option(bool, "luau_use_4_vector", "Build Luau to use 4-vectors instead of the default 3-vector.") orelse false;
2323
const lua_user_h = b.option(Build.LazyPath, "lua_user_h", "Lazy path to user supplied c header file") orelse null;
24+
const additional_system_headers = b.option(Build.LazyPath, "additional_system_headers", "Lazy path to additional system headers to include when building Lua") orelse null;
2425

2526
if (lang == .luau and shared) {
2627
std.debug.panic("Luau does not support compiling or loading shared modules", .{});
@@ -100,6 +101,13 @@ pub fn build(b: *Build) void {
100101
.optimize = optimize,
101102
});
102103
c_headers.addIncludePath(lib.getEmittedIncludeTree());
104+
105+
// If we've been given additional system headers, add them now
106+
// Useful for things like linking Emscripten headers by including a new sysroot
107+
if (additional_system_headers != null) {
108+
c_headers.addSystemIncludePath(additional_system_headers.?);
109+
}
110+
103111
c_headers.step.dependOn(&install_lib.step);
104112

105113
const ziglua_c = c_headers.createModule();

0 commit comments

Comments
 (0)