Skip to content

Commit 2447a2b

Browse files
authored
Merge pull request #705 from Arc-blroth/main
Fix `--target` getting passed twice to the Android NDK clang on Windows
2 parents 5b91c7b + 53564e0 commit 2447a2b

File tree

1 file changed

+5
-3
lines changed

1 file changed

+5
-3
lines changed

src/lib.rs

+5-3
Original file line numberDiff line numberDiff line change
@@ -200,6 +200,7 @@ pub struct Tool {
200200
family: ToolFamily,
201201
cuda: bool,
202202
removed_args: Vec<OsString>,
203+
has_internal_target_arg: bool,
203204
}
204205

205206
/// Represents the family of tools this tool belongs to.
@@ -1824,9 +1825,7 @@ impl Build {
18241825
// Target flags
18251826
match cmd.family {
18261827
ToolFamily::Clang => {
1827-
if !(target.contains("android")
1828-
&& android_clang_compiler_uses_target_arg_internally(&cmd.path))
1829-
{
1828+
if !(target.contains("android") && cmd.has_internal_target_arg) {
18301829
if target.contains("darwin") {
18311830
if let Some(arch) =
18321831
map_darwin_target_from_rust_to_compiler_architecture(target)
@@ -2696,6 +2695,7 @@ impl Build {
26962695
let file_name = path.to_str().unwrap().to_owned();
26972696
let (target, clang) = file_name.split_at(file_name.rfind("-").unwrap());
26982697

2698+
tool.has_internal_target_arg = true;
26992699
tool.path.set_file_name(clang.trim_start_matches("-"));
27002700
tool.path.set_extension("exe");
27012701
tool.args.push(format!("--target={}", target).into());
@@ -3522,6 +3522,7 @@ impl Tool {
35223522
family: family,
35233523
cuda: false,
35243524
removed_args: Vec::new(),
3525+
has_internal_target_arg: false,
35253526
}
35263527
}
35273528

@@ -3582,6 +3583,7 @@ impl Tool {
35823583
family: family,
35833584
cuda: cuda,
35843585
removed_args: Vec::new(),
3586+
has_internal_target_arg: false,
35853587
}
35863588
}
35873589

0 commit comments

Comments
 (0)