Skip to content

Commit

Permalink
Fix Android clang compiler path when building with Windows host (#489)
Browse files Browse the repository at this point in the history
* Fix android clang compiler path when building with Windows host

* Only use the cmd clang compiler if the exe clang doesn't exist
  • Loading branch information
Osspial authored Apr 22, 2020
1 parent 5bb26a6 commit 4c6e7c6
Showing 1 changed file with 9 additions and 0 deletions.
9 changes: 9 additions & 0 deletions src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1981,10 +1981,19 @@ impl Build {
.replace("thumbv7", "arm");
let gnu_compiler = format!("{}-{}", target, gnu);
let clang_compiler = format!("{}-{}", target, clang);
// On Windows, the Android clang compiler is provided as a `.cmd` file instead
// of a `.exe` file. `std::process::Command` won't run `.cmd` files unless the
// `.cmd` is explicitly appended to the command name, so we do that here.
let clang_compiler_cmd = format!("{}-{}.cmd", target, clang);

// Check if gnu compiler is present
// if not, use clang
if Command::new(&gnu_compiler).spawn().is_ok() {
gnu_compiler
} else if host.contains("windows")
&& Command::new(&clang_compiler).spawn().is_err()
{
clang_compiler_cmd
} else {
clang_compiler
}
Expand Down

0 comments on commit 4c6e7c6

Please sign in to comment.