Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
22 changes: 15 additions & 7 deletions mlua-sys/build/main_inner.rs
Original file line number Diff line number Diff line change
Expand Up @@ -26,14 +26,22 @@ fn main() {
// Check if compilation and linking is handled by external crate
if cfg!(not(feature = "external")) {
let target_os = env::var("CARGO_CFG_TARGET_OS").unwrap();
if target_os == "windows" && cfg!(feature = "module") {
if !std::env::var("LUA_LIB_NAME").unwrap_or_default().is_empty() {
// Don't use raw-dylib linking
find::probe_lua();
return;
}
if cfg!(feature = "module") {
if target_os == "windows" {
if !std::env::var("LUA_LIB_NAME").unwrap_or_default().is_empty() {
// Don't use raw-dylib linking
find::probe_lua();
return;
}

println!("cargo:rustc-cfg=raw_dylib");
println!("cargo:rustc-cfg=raw_dylib");
} else if target_os == "macos" {
// macOS linker requires explicit opt-in to allow undefined
// symbols in dylibs. Lua C modules resolve these symbols at
// load time from the host interpreter.
println!("cargo:rustc-cdylib-link-arg=-undefined");
println!("cargo:rustc-cdylib-link-arg=dynamic_lookup");
}
}

#[cfg(not(feature = "module"))]
Expand Down
Loading