Skip to content

Commit a26b58c

Browse files
committed
Fix --target getting passed twice to the Android NDK clang on Windows
1 parent 53fb72c commit a26b58c

File tree

1 file changed

+5
-2
lines changed

1 file changed

+5
-2
lines changed

src/lib.rs

+5-2
Original file line numberDiff line numberDiff line change
@@ -192,6 +192,7 @@ pub struct Tool {
192192
family: ToolFamily,
193193
cuda: bool,
194194
removed_args: Vec<OsString>,
195+
has_internal_target_arg: bool,
195196
}
196197

197198
/// Represents the family of tools this tool belongs to.
@@ -1566,8 +1567,7 @@ impl Build {
15661567
// Target flags
15671568
match cmd.family {
15681569
ToolFamily::Clang => {
1569-
if !(target.contains("android")
1570-
&& android_clang_compiler_uses_target_arg_internally(&cmd.path))
1570+
if !(target.contains("android") && cmd.has_internal_target_arg)
15711571
{
15721572
if target.contains("darwin") {
15731573
if let Some(arch) =
@@ -2358,6 +2358,7 @@ impl Build {
23582358
let file_name = path.to_str().unwrap().to_owned();
23592359
let (target, clang) = file_name.split_at(file_name.rfind("-").unwrap());
23602360

2361+
tool.has_internal_target_arg = true;
23612362
tool.path.set_file_name(clang.trim_start_matches("-"));
23622363
tool.path.set_extension("exe");
23632364
tool.args.push(format!("--target={}", target).into());
@@ -2898,6 +2899,7 @@ impl Tool {
28982899
family: family,
28992900
cuda: false,
29002901
removed_args: Vec::new(),
2902+
has_internal_target_arg: false,
29012903
}
29022904
}
29032905

@@ -2929,6 +2931,7 @@ impl Tool {
29292931
family: family,
29302932
cuda: cuda,
29312933
removed_args: Vec::new(),
2934+
has_internal_target_arg: false,
29322935
}
29332936
}
29342937

0 commit comments

Comments
 (0)