Skip to content

Commit 4428023

Browse files
authored
Merge pull request #23 from Interrupt/fix-lua-build
Fixing the Lua artifact not being found when building fresh
2 parents 2d08834 + b218ac5 commit 4428023

File tree

2 files changed

+11
-5
lines changed

2 files changed

+11
-5
lines changed

Diff for: build.zig

+6-5
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ pub fn build(b: *std.Build) !void {
2929
const dep_ziglua = b.dependency("ziglua", .{
3030
.target = target,
3131
.optimize = optimize,
32+
.lang = .lua54,
3233
.can_use_jmp = !target.result.isWasm(),
3334
});
3435

@@ -56,11 +57,6 @@ pub fn build(b: *std.Build) !void {
5657
const cimgui_root = dep_cimgui.namedWriteFiles("cimgui").getDirectory();
5758
dep_sokol.artifact("sokol_clib").addIncludePath(cimgui_root);
5859

59-
// C libraries need to depend on the sokol library to make sure the Emscripten SDK is setup first
60-
// when doing web builds
61-
dep_cimgui.artifact("cimgui_clib").step.dependOn(&dep_sokol.artifact("sokol_clib").step);
62-
dep_ziglua.artifact("lua").step.dependOn(&dep_sokol.artifact("sokol_clib").step);
63-
6460
const sokol_item = .{ .module = dep_sokol.module("sokol"), .name = "sokol" };
6561
const ziglua_item = .{ .module = dep_ziglua.module("ziglua"), .name = "ziglua" };
6662
const zmesh_item = .{ .module = dep_zmesh.module("root"), .name = "zmesh" };
@@ -102,6 +98,11 @@ pub fn build(b: *std.Build) !void {
10298
}
10399

104100
for (build_collection.link_libraries) |lib| {
101+
if (target.result.isWasm()) {
102+
// ensure these libs all depend on the emcc C lib
103+
lib.step.dependOn(&dep_sokol.artifact("sokol_clib").step);
104+
}
105+
105106
delve_mod.linkLibrary(lib);
106107
}
107108

Diff for: build.zig.zon

+5
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,11 @@
1414
.url = "git+https://github.com/interrupt/ziglua#3d7532ec73202bddfbeba1933d43fe427ca6d80d",
1515
.hash = "12207a933b3cca4e301c711acbdb045a50c1d90f9525ab6544e409427b9672a6821f",
1616
},
17+
// needed because Lua is a lazy dependency inside of ziglua
18+
.lua54 = .{
19+
.url = "https://www.lua.org/ftp/lua-5.4.6.tar.gz",
20+
.hash = "1220f93ada1fa077ab096bf88a5b159ad421dbf6a478edec78ddb186d0c21d3476d9",
21+
},
1722
.sokol = .{
1823
.url = "git+https://github.com/floooh/sokol-zig.git#d3e21f76498213d6d58179065756f5f2ed9b90cf",
1924
.hash = "122052a192829b377c637ce242ee8c9121e03d8cd10c889758dc6fb176368de7d67b",

0 commit comments

Comments
 (0)