Skip to content

Commit

Permalink
feat: add windows-gnu to rust tests (#531)
Browse files Browse the repository at this point in the history
  • Loading branch information
Rjected authored Jan 23, 2025
1 parent d1168fc commit af3c0b8
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 2 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/rust-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ jobs:
target: x86_64-unknown-linux-gnu
- host: windows-latest
target: x86_64-pc-windows-msvc
- host: windows-latest
target: x86_64-pc-windows-gnu
- host: macos-14
target: aarch64-apple-darwin
- host: macos-latest
Expand Down
9 changes: 7 additions & 2 deletions bindings/rust/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,12 @@ fn main() {
// an int. There is a bug in bindgen associated with this. It assumes that a bool in C is
// the same size as a bool in Rust. This is the root cause of the issues on Windows. If/when
// this is fixed in bindgen, it should be safe to remove this compiler flag.
cc.flag("/std:c11");

// This flag is for MSVC
cc.flag_if_supported("/std:c11");

// This is for GCC
cc.flag_if_supported("-std=c11");
}

cc.include(c_src_dir.clone());
Expand Down Expand Up @@ -155,7 +160,7 @@ fn make_bindings(
#[cfg(feature = "generate-bindings")]
fn replace_ckzg_ret_repr(mut bindings: String) -> String {
let target = env::var("TARGET").unwrap_or_default();
let repr_to_replace = if target.contains("windows") {
let repr_to_replace = if target.contains("windows") && target.contains("msvc") {
"#[repr(i32)]"
} else {
"#[repr(u32)]"
Expand Down

0 comments on commit af3c0b8

Please sign in to comment.