From 75981bea65ba58a8f65ed608157acf38cade1822 Mon Sep 17 00:00:00 2001 From: Masato TOYOSHIMA Date: Sat, 11 Jan 2025 19:31:02 +0900 Subject: [PATCH] Adjusted zig cc judgment and avoided zigbuild errors(#1360) Adjusted is_zig_cc judgment and adjusted how supports_path_delimiter is handled. --- src/lib.rs | 2 +- src/tool.rs | 7 ++++++- 2 files changed, 7 insertions(+), 2 deletions(-) diff --git a/src/lib.rs b/src/lib.rs index 280ff7bb..3bb3f6a4 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -1800,7 +1800,7 @@ impl Build { cmd.args(self.asm_flags.iter().map(std::ops::Deref::deref)); } - if compiler.supports_path_delimiter() && !is_assembler_msvc { + if compiler.supports_path_delimiter() && !is_assembler_msvc && matches!(compiler.family, ToolFamily::Clang { zig_cc: false }) { // #513: For `clang-cl`, separate flags/options from the input file. // When cross-compiling macOS -> Windows, this avoids interpreting // common `/Users/...` paths as the `/U` flag and triggering diff --git a/src/tool.rs b/src/tool.rs index af43a918..cd615b1b 100644 --- a/src/tool.rs +++ b/src/tool.rs @@ -102,7 +102,12 @@ impl Tool { cargo_output, ) .map(|o| String::from_utf8_lossy(&o).contains("ziglang")) - .unwrap_or_default() + .unwrap_or_default() || { + match path.file_name().map(OsStr::to_string_lossy) { + Some(fname) => fname.contains("zig"), + _ => false, + } + } } fn guess_family_from_stdout(