Add file extension for clang in libafl_cc/build.rs (#1237)

* Add CLANG and CLANG_PP env vars

Add CLANG and CLANG_PP env variables for Windows. Resolves issue if clang and llvm-config are not in the same location.

* Just add clang".exe" for windows

User should have llvm-config and clang.exe clang++.exe in the same directory anyways.

* Ran cargo fmt
This commit is contained in:
Tomas Duchac 2023-05-04 09:52:51 +00:00 committed by GitHub
parent 6929c89b86
commit 53659f8a5c
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23

View File

@ -150,7 +150,7 @@ fn build_pass(
Some(r)
} else if cfg!(windows) {
let r = Command::new(bindir_path.join("clang-cl"))
let r = Command::new(bindir_path.join("clang-cl.exe"))
.arg("-v")
.args(cxxflags)
.arg(src_dir.join(src_file))
@ -234,8 +234,16 @@ pub const LIBAFL_CC_LLVM_VERSION: Option<usize> = None;
let llvm_bindir = exec_llvm_config(&["--bindir"]);
let bindir_path = Path::new(&llvm_bindir);
let clang = bindir_path.join("clang");
let clangcpp = bindir_path.join("clang++");
let clang;
let clangcpp;
if cfg!(windows) {
clang = bindir_path.join("clang.exe");
clangcpp = bindir_path.join("clang++.exe");
} else {
clang = bindir_path.join("clang");
clangcpp = bindir_path.join("clang++");
}
if !clang.exists() {
println!("cargo:warning=Failed to find clang frontend.");