File tree Expand file tree Collapse file tree 1 file changed +9
-1
lines changed
Expand file tree Collapse file tree 1 file changed +9
-1
lines changed Original file line number Diff line number Diff line change @@ -57,7 +57,8 @@ fn main() {
5757 }
5858 }
5959
60- let debug_postfix = if cfg ! ( target_os = "windows" ) { "_D" } else { "_debug" } ;
60+ let targeting_windows = env:: var ( "CARGO_CFG_TARGET_OS" ) . unwrap ( ) == "windows" ;
61+ let debug_postfix = if targeting_windows { "_D" } else { "_debug" } ;
6162
6263 if feature_enabled ( "HL" ) {
6364 cfg. define ( "HDF5_BUILD_HL_LIB" , "ON" ) ;
@@ -71,6 +72,13 @@ fn main() {
7172 println ! ( "cargo:hl_library={}" , hdf5_hl_lib) ;
7273 }
7374
75+ if cfg ! ( unix) && targeting_windows {
76+ let wine_exec =
77+ if env:: var ( "CARGO_CFG_TARGET_ARCH" ) . unwrap ( ) == "x86_64" { "wine64" } else { "wine" } ;
78+ // when cross-compiling to windows, use Wine to run code generation programs
79+ cfg. define ( "CMAKE_CROSSCOMPILING_EMULATOR" , wine_exec) ;
80+ }
81+
7482 let dst = cfg. build ( ) ;
7583 println ! ( "cargo:root={}" , dst. display( ) ) ;
7684
You can’t perform that action at this time.
0 commit comments