Skip to content

Commit

Permalink
Merge pull request #23 from Interrupt/fix-lua-build
Browse files Browse the repository at this point in the history
Fixing the Lua artifact not being found when building fresh
  • Loading branch information
Interrupt committed Jul 2, 2024
2 parents 2d08834 + b218ac5 commit 4428023
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 5 deletions.
11 changes: 6 additions & 5 deletions build.zig
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ pub fn build(b: *std.Build) !void {
const dep_ziglua = b.dependency("ziglua", .{
.target = target,
.optimize = optimize,
.lang = .lua54,
.can_use_jmp = !target.result.isWasm(),
});

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

// C libraries need to depend on the sokol library to make sure the Emscripten SDK is setup first
// when doing web builds
dep_cimgui.artifact("cimgui_clib").step.dependOn(&dep_sokol.artifact("sokol_clib").step);
dep_ziglua.artifact("lua").step.dependOn(&dep_sokol.artifact("sokol_clib").step);

const sokol_item = .{ .module = dep_sokol.module("sokol"), .name = "sokol" };
const ziglua_item = .{ .module = dep_ziglua.module("ziglua"), .name = "ziglua" };
const zmesh_item = .{ .module = dep_zmesh.module("root"), .name = "zmesh" };
Expand Down Expand Up @@ -102,6 +98,11 @@ pub fn build(b: *std.Build) !void {
}

for (build_collection.link_libraries) |lib| {
if (target.result.isWasm()) {
// ensure these libs all depend on the emcc C lib
lib.step.dependOn(&dep_sokol.artifact("sokol_clib").step);
}

delve_mod.linkLibrary(lib);
}

Expand Down
5 changes: 5 additions & 0 deletions build.zig.zon
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,11 @@
.url = "git+https://github.com/interrupt/ziglua#3d7532ec73202bddfbeba1933d43fe427ca6d80d",
.hash = "12207a933b3cca4e301c711acbdb045a50c1d90f9525ab6544e409427b9672a6821f",
},
// needed because Lua is a lazy dependency inside of ziglua
.lua54 = .{
.url = "https://www.lua.org/ftp/lua-5.4.6.tar.gz",
.hash = "1220f93ada1fa077ab096bf88a5b159ad421dbf6a478edec78ddb186d0c21d3476d9",
},
.sokol = .{
.url = "git+https://github.com/floooh/sokol-zig.git#d3e21f76498213d6d58179065756f5f2ed9b90cf",
.hash = "122052a192829b377c637ce242ee8c9121e03d8cd10c889758dc6fb176368de7d67b",
Expand Down

0 comments on commit 4428023

Please sign in to comment.