File tree Expand file tree Collapse file tree 2 files changed +24
-1
lines changed
Expand file tree Collapse file tree 2 files changed +24
-1
lines changed Original file line number Diff line number Diff line change @@ -205,3 +205,18 @@ jobs:
205205 msiexec /i ${{env.MSI_PATH}} /quiet /qn /norestart
206206 - name : Build and test all crates
207207 run : cargo test -vv
208+
209+ wine :
210+ name : wine
211+ runs-on : ubuntu-latest
212+ steps :
213+ - name : Checkout repository
214+ uses : actions/checkout@v2
215+ with : {submodules: true}
216+ - name : Install Rust
217+ uses : actions-rs/toolchain@v1
218+ with : {toolchain: stable, target: x86_64-pc-windows-gnu, profile: minimal, override: true}
219+ - name : Install dependencies
220+ run : sudo apt-get install wine64 mingw-w64
221+ - name : Build and test
222+ run : env CARGO_TARGET_X86_64_PC_WINDOWS_GNU_RUNNER=wine64 cargo test --features hdf5-sys/static --target x86_64-pc-windows-gnu -- --skip test_compile_fail
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