Panic when try to build for wasm32 without vendored feature (except luau)

This commit is contained in:
Alex Orlenko
2024-01-03 11:33:42 +00:00
parent c0a0983025
commit cf153f38de
2 changed files with 6 additions and 3 deletions
-3
View File
@@ -60,9 +60,6 @@ ffi = { package = "mlua-sys", version = "0.4.0", path = "mlua-sys" }
[target.'cfg(unix)'.dependencies]
libloading = { version = "0.8", optional = true }
[target.'cfg(target_arch = "wasm32")'.dependencies]
ffi = { package = "mlua-sys", version = "0.4.0", path = "mlua-sys", features = ["vendored"] }
[dev-dependencies]
trybuild = "1.0"
futures = "0.3.5"
+6
View File
@@ -4,6 +4,12 @@ use std::env;
use std::ops::Bound;
pub fn probe_lua() {
let target_arch = env::var("CARGO_CFG_TARGET_ARCH").unwrap();
if target_arch == "wasm32" && cfg!(not(feature = "vendored")) {
panic!("Please enable `vendored` feature to build for wasm32");
}
let lib_dir = env::var("LUA_LIB").unwrap_or_default();
let lua_lib = env::var("LUA_LIB_NAME").unwrap_or_default();