Skip to content

Commit

Permalink
Adjusted zig cc judgment and avoided zigbuild errors(#1360)
Browse files Browse the repository at this point in the history
Adjusted is_zig_cc judgment and adjusted how supports_path_delimiter is handled.
  • Loading branch information
phoepsilonix committed Jan 11, 2025
1 parent a8c9dc0 commit 2e74353
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1800,7 +1800,10 @@ 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
Expand Down
6 changes: 6 additions & 0 deletions src/tool.rs
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,12 @@ impl Tool {
)
.map(|o| String::from_utf8_lossy(&o).contains("ziglang"))
.unwrap_or_default()
|| {
match path.file_name().map(OsStr::to_string_lossy) {
Some(fname) => fname.contains("zig"),
_ => false,
}
}
}

fn guess_family_from_stdout(
Expand Down

0 comments on commit 2e74353

Please sign in to comment.