Skip to content

Commit

Permalink
Fix --target getting passed twice to the Android NDK clang on Windows
Browse files Browse the repository at this point in the history
  • Loading branch information
Arc-blroth committed Jul 27, 2022
1 parent 53fb72c commit a26b58c
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,7 @@ pub struct Tool {
family: ToolFamily,
cuda: bool,
removed_args: Vec<OsString>,
has_internal_target_arg: bool,
}

/// Represents the family of tools this tool belongs to.
Expand Down Expand Up @@ -1566,8 +1567,7 @@ impl Build {
// Target flags
match cmd.family {
ToolFamily::Clang => {
if !(target.contains("android")
&& android_clang_compiler_uses_target_arg_internally(&cmd.path))
if !(target.contains("android") && cmd.has_internal_target_arg)
{
if target.contains("darwin") {
if let Some(arch) =
Expand Down Expand Up @@ -2358,6 +2358,7 @@ impl Build {
let file_name = path.to_str().unwrap().to_owned();
let (target, clang) = file_name.split_at(file_name.rfind("-").unwrap());

tool.has_internal_target_arg = true;
tool.path.set_file_name(clang.trim_start_matches("-"));
tool.path.set_extension("exe");
tool.args.push(format!("--target={}", target).into());
Expand Down Expand Up @@ -2898,6 +2899,7 @@ impl Tool {
family: family,
cuda: false,
removed_args: Vec::new(),
has_internal_target_arg: false,
}
}

Expand Down Expand Up @@ -2929,6 +2931,7 @@ impl Tool {
family: family,
cuda: cuda,
removed_args: Vec::new(),
has_internal_target_arg: false,
}
}

Expand Down

0 comments on commit a26b58c

Please sign in to comment.