Skip to content

Commit

Permalink
Use addCSourceFiles
Browse files Browse the repository at this point in the history
This is simpler than looping over the files
  • Loading branch information
natecraddock committed Jan 21, 2024
1 parent 168272d commit 373fe7e
Showing 1 changed file with 12 additions and 6 deletions.
18 changes: 12 additions & 6 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -182,9 +182,13 @@ fn buildLua(b: *Build, target: Build.ResolvedTarget, optimize: std.builtin.Optim
.lua54 => &lua_54_source_files,
else => unreachable,
};
for (lua_source_files) |file| {
lib.addCSourceFile(.{ .file = upstream.path(file), .flags = &flags });
}

lib.addCSourceFiles(.{
.dependency = upstream,
.files = lua_source_files,
.flags = &flags,
});

lib.linkLibC();

installHeader(lib, upstream.path("src/lua.h"), "lua.h");
Expand Down Expand Up @@ -226,9 +230,11 @@ fn buildLuau(b: *Build, target: Build.ResolvedTarget, optimize: std.builtin.Opti
if (luau_use_4_vector) "-DLUA_VECTOR_SIZE=4" else "",
};

for (luau_source_files) |file| {
lib.addCSourceFile(.{ .file = upstream.path(file), .flags = &flags });
}
lib.addCSourceFiles(.{
.dependency = upstream,
.files = &luau_source_files,
.flags = &flags,
});
lib.addCSourceFile(.{ .file = .{ .path = "src/luau.cpp" }, .flags = &flags });
lib.linkLibCpp();

Expand Down

0 comments on commit 373fe7e

Please sign in to comment.