@@ -14,22 +14,29 @@ fn main() {
14
14
#[ cfg( all( feature = "luau" , feature = "module" , windows) ) ]
15
15
compile_error ! ( "Luau does not support `module` mode on Windows" ) ;
16
16
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" ) ;
19
23
20
24
println ! ( "cargo:rerun-if-changed=build" ) ;
21
25
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" ) ;
28
37
}
29
38
30
- println ! ( "cargo:rustc-cfg=raw_dylib" ) ;
39
+ #[ cfg( not( feature = "module" ) ) ]
40
+ find:: probe_lua ( ) ;
31
41
}
32
-
33
- #[ cfg( not( feature = "module" ) ) ]
34
- find:: probe_lua ( ) ;
35
42
}
0 commit comments