@@ -19,21 +19,18 @@ fn main() {
19
19
// target_arch is not working? OS FAMILY and ARCH variables were empty too
20
20
// I think the cross-compilation is broken. We could take these from the environment,
21
21
// since the build script seems to have a different target_arch than the destination.
22
- let target = env:: var ( "TARGET" ) . unwrap_or ( "" . to_string ( ) ) ;
22
+ let target = env:: var ( "TARGET" ) . expect ( "cargo should have set $TARGET" ) ;
23
23
if target != "wasm32-unknown-unknown"
24
- && cfg ! ( not( any(
25
- target_os = "macos" ,
26
- target_os = "windows" ,
27
- target_os = "redox" ,
28
- target_arch = "wasm32" , // this is ignored. Why?
29
- ) ) )
24
+ && !target. contains ( "-macos" )
25
+ && !target. contains ( "-windows" )
26
+ && !target. contains ( "-redox" )
27
+ && !target. starts_with ( "wasm32-" ) // this is ignored. Why?
30
28
&& cfg ! ( not( any( feature = "wayland" , feature = "x11" ) ) )
31
29
{
32
30
panic ! ( "At least one of the x11 or wayland features must be enabled" ) ;
33
31
}
34
32
35
- let env = env:: var ( "TARGET" ) . unwrap ( ) ;
36
- if env. contains ( "darwin" ) {
33
+ if target. contains ( "darwin" ) {
37
34
cc:: Build :: new ( )
38
35
. flag ( "-mmacosx-version-min=10.10" )
39
36
. file ( "src/native/macosx/MacMiniFB.m" )
@@ -42,7 +39,7 @@ fn main() {
42
39
. compile ( "libminifb_native.a" ) ;
43
40
println ! ( "cargo:rustc-link-lib=framework=Metal" ) ;
44
41
println ! ( "cargo:rustc-link-lib=framework=MetalKit" ) ;
45
- } else if !env . contains ( "windows" ) && !env . contains ( "wasm32" ) {
42
+ } else if !target . contains ( "windows" ) && !target . contains ( "wasm32" ) {
46
43
// build scalar on non-windows and non-mac
47
44
cc:: Build :: new ( )
48
45
. file ( "src/native/posix/scalar.c" )
0 commit comments