Skip to content

Commit

Permalink
Fix Windows build (#3)
Browse files Browse the repository at this point in the history
* Specific no default and opaque type attempt

* Allow enums repr themselves

* OSX one thread, Windows GNU

* Trial MinGW

* Use ctor to call blosc2 init/destory in testing
  • Loading branch information
milesgranger authored Apr 10, 2023
1 parent 91d4287 commit e26c937
Show file tree
Hide file tree
Showing 6 changed files with 45 additions and 7,931 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ jobs:
- name: Build
run: cargo build
- name: Test
run: cargo test
run: cargo test -- --test-threads 1

windows:
runs-on: windows-latest
Expand All @@ -34,10 +34,16 @@ jobs:
submodules: recursive
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: "x86_64-pc-windows-gnu"
- name: Set up MinGW
uses: egor-tensin/setup-mingw@v2
with:
platform: x64
- name: Build
run: cargo build
run: cargo build --target x86_64-pc-windows-gnu
- name: Test
run: cargo test
run: cargo test --target x86_64-pc-windows-gnu

linux:
runs-on: ubuntu-latest
Expand Down
3 changes: 3 additions & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,3 +10,6 @@ name = "blosc2"

[dependencies]
blosc2-sys = { path = "blosc2-sys" }

[dev-dependencies]
ctor = "0.2.0"
5 changes: 4 additions & 1 deletion blosc2-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,12 @@ fn main() {
println!("cargo:rustc-link-search={}/lib", lib.display());
println!("cargo:rustc-link-lib=static=blosc2");

let out = PathBuf::from(&(format!("{}/src/ffi.rs", env!("CARGO_MANIFEST_DIR"))));
let out = PathBuf::from(&(format!("{}/bindings.rs", std::env::var("OUT_DIR").unwrap())));
bindgen::Builder::default()
.header(&format!("{}/include/blosc2.h", lib.display()))
.layout_tests(false)
.no_default("tagMONITORINFOEXA") // Windows specific, no default [u8;40usize]
.opaque_type("_IMAGE_TLS_DIRECTORY64") // Windows specific, error[E0588]: packed type cannot transitively contain a #[repr(align)] type
.derive_default(true)
.derive_copy(true)
.derive_debug(true)
Expand Down
Loading

0 comments on commit e26c937

Please sign in to comment.