@@ -14,22 +14,29 @@ fn main() {
1414 #[ cfg( all( feature = "luau" , feature = "module" , windows) ) ]
1515 compile_error ! ( "Luau does not support `module` mode on Windows" ) ;
1616
17- #[ cfg( all( feature = "module" , feature = "vendored" ) ) ]
18- compile_error ! ( "`vendored` and `module` features are mutually exclusive" ) ;
17+ #[ cfg( any(
18+ all( feature = "vendored" , any( feature = "external" , feature = "module" ) ) ,
19+ all( feature = "external" , any( feature = "vendored" , feature = "module" ) ) ,
20+ all( feature = "module" , any( feature = "vendored" , feature = "external" ) )
21+ ) ) ]
22+ compile_error ! ( "`vendored`, `external` and `module` features are mutually exclusive" ) ;
1923
2024 println ! ( "cargo:rerun-if-changed=build" ) ;
2125
22- let target_os = env:: var ( "CARGO_CFG_TARGET_OS" ) . unwrap ( ) ;
23- if target_os == "windows" && cfg ! ( feature = "module" ) {
24- if !std:: env:: var ( "LUA_LIB_NAME" ) . unwrap_or_default ( ) . is_empty ( ) {
25- // Don't use raw-dylib linking
26- find:: probe_lua ( ) ;
27- return ;
26+ // Check if compilation and linking is handled by external crate
27+ if !cfg ! ( feature = "external" ) {
28+ let target_os = env:: var ( "CARGO_CFG_TARGET_OS" ) . unwrap ( ) ;
29+ if target_os == "windows" && cfg ! ( feature = "module" ) {
30+ if !std:: env:: var ( "LUA_LIB_NAME" ) . unwrap_or_default ( ) . is_empty ( ) {
31+ // Don't use raw-dylib linking
32+ find:: probe_lua ( ) ;
33+ return ;
34+ }
35+
36+ println ! ( "cargo:rustc-cfg=raw_dylib" ) ;
2837 }
2938
30- println ! ( "cargo:rustc-cfg=raw_dylib" ) ;
39+ #[ cfg( not( feature = "module" ) ) ]
40+ find:: probe_lua ( ) ;
3141 }
32-
33- #[ cfg( not( feature = "module" ) ) ]
34- find:: probe_lua ( ) ;
3542}
0 commit comments