Skip to content

Commit

Permalink
Fix C module loading on windows
Browse files Browse the repository at this point in the history
  • Loading branch information
leso-kn authored and hishamhm committed Aug 26, 2024
1 parent ef92399 commit bcb9f8a
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions main.js
Original file line number Diff line number Diff line change
Expand Up @@ -173,21 +173,21 @@ async function install_plain_lua_windows(luaExtractPath, luaInstallPath, luaVers
}
})

objs["lua"] = [ ...objs["lua"], ...objs["lib"] ]
objs["luac"] = [ ...objs["luac"], ...objs["lib"] ]

let luaXYZ = luaVersion.split(".")
let libFile = "lua" + luaXYZ[0] + luaXYZ[1] + ".lib"
let dllFile = "lua" + luaXYZ[0] + luaXYZ[1] + ".dll"

objs["lua"] = [ ...objs["lua"], libFile ]
objs["luac"] = [ ...objs["luac"], ...objs["lib"] ]

await msvc_link(luaExtractPath, "link /nologo /DLL", dllFile, objs["lib"]);
await msvc_link(luaExtractPath, "link /nologo", "luac.exe", objs["luac"]);
await msvc_link(luaExtractPath, "link /nologo", "lua.exe", objs["lua"]);

const luaHpp = (await exists(pathJoin(src, "lua.hpp"))) ? "lua.hpp" : "../etc/lua.hpp"
const headers = [ "lua.h", "luaconf.h", "lualib.h", "lauxlib.h", luaHpp ]

await install_files(pathJoin(luaInstallPath, "bin"), luaExtractPath, [ "lua.exe", "luac.exe" ])
await install_files(pathJoin(luaInstallPath, "bin"), luaExtractPath, [ "lua.exe", "luac.exe", dllFile ])
await install_files(pathJoin(luaInstallPath, "lib"), luaExtractPath, [ dllFile, libFile ])
await install_files(pathJoin(luaInstallPath, "include"), src, headers)
}
Expand Down

0 comments on commit bcb9f8a

Please sign in to comment.