From 3fe56418ade8e83965a51af5d7fa5d547259ade3 Mon Sep 17 00:00:00 2001 From: thewh1teagle <61390950+thewh1teagle@users.noreply.github.com> Date: Mon, 8 Jan 2024 05:52:29 +0200 Subject: [PATCH 1/2] fix windows gnu build --- src/whisper_grammar.rs | 4 +++- sys/build.rs | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/whisper_grammar.rs b/src/whisper_grammar.rs index ab5fe6f..12c233b 100644 --- a/src/whisper_grammar.rs +++ b/src/whisper_grammar.rs @@ -5,8 +5,10 @@ use whisper_rs_sys::{ whisper_gretype_WHISPER_GRETYPE_RULE_REF, }; + #[cfg_attr(not(windows), repr(u32))] -#[cfg_attr(windows, repr(i32))] // windows being *special* again +#[cfg_attr(target_env = "gnu", repr(u32))] // x86_64-pc-windows-gnu +#[cfg_attr(all(windows, not(target_env = "gnu")), repr(i32))] // windows being *special* again #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum WhisperGrammarElementType { /// End of rule definition diff --git a/sys/build.rs b/sys/build.rs index 1628bf5..7def6f1 100644 --- a/sys/build.rs +++ b/sys/build.rs @@ -146,7 +146,7 @@ fn main() { let destination = config.build(); - if env::var("TARGET").unwrap().contains("window") { + if target.contains("window") && !target.contains("gnu") { println!( "cargo:rustc-link-search={}", out.join("build").join("Release").display() From 80755aab33624979801c43018fbd2f8fcf390cd2 Mon Sep 17 00:00:00 2001 From: thewh1teagle <61390950+thewh1teagle@users.noreply.github.com> Date: Tue, 9 Jan 2024 03:27:43 +0200 Subject: [PATCH 2/2] fix: accurate cfg attr per gnu and windows --- src/whisper_grammar.rs | 6 ++---- 1 file changed, 2 insertions(+), 4 deletions(-) diff --git a/src/whisper_grammar.rs b/src/whisper_grammar.rs index 12c233b..c35cb80 100644 --- a/src/whisper_grammar.rs +++ b/src/whisper_grammar.rs @@ -5,10 +5,8 @@ use whisper_rs_sys::{ whisper_gretype_WHISPER_GRETYPE_RULE_REF, }; - -#[cfg_attr(not(windows), repr(u32))] -#[cfg_attr(target_env = "gnu", repr(u32))] // x86_64-pc-windows-gnu -#[cfg_attr(all(windows, not(target_env = "gnu")), repr(i32))] // windows being *special* again +#[cfg_attr(any(not(windows), target_env = "gnu"), repr(u32))] // include windows-gnu +#[cfg_attr(all(windows, not(target_env = "gnu")), repr(i32))] // msvc being *special* again #[derive(Debug, Copy, Clone, PartialEq, Eq, Hash)] pub enum WhisperGrammarElementType { /// End of rule definition