From c00437667202956e42f75a90754d4e62038607f6 Mon Sep 17 00:00:00 2001 From: Kyle Mayes Date: Sun, 17 Feb 2019 10:55:56 -0500 Subject: [PATCH] Changed llvm-config to be first search candidate on macOS --- CHANGELOG.md | 3 +++ build/common.rs | 14 +++++++------- 2 files changed, 10 insertions(+), 7 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 151170b04..969915299 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,5 +1,8 @@ ## [0.28.0] - UNRELEASED +### Changed +- Changed `llvm-config` to be first search candidate on macOS + ### Added - Added support for `clang` 8.0.x diff --git a/build/common.rs b/build/common.rs index 31fbd6838..9e8e7fb2e 100644 --- a/build/common.rs +++ b/build/common.rs @@ -115,6 +115,13 @@ pub fn search_libclang_directories(files: &[String], variable: &str) -> Vec<(Pat let mut found = vec![]; + // Search the `bin` and `lib` directories in directory provided by `llvm-config --prefix`. + if let Ok(output) = run_llvm_config(&["--prefix"]) { + let directory = Path::new(output.lines().next().unwrap()).to_path_buf(); + found.extend(search_directories(&directory.join("bin"), files)); + found.extend(search_directories(&directory.join("lib"), files)); + } + // Search the toolchain directory in the directory provided by `xcode-select --print-path`. if cfg!(target_os="macos") { if let Some(output) = run_command("xcode-select", &["--print-path"]) { @@ -124,13 +131,6 @@ pub fn search_libclang_directories(files: &[String], variable: &str) -> Vec<(Pat } } - // Search the `bin` and `lib` directories in directory provided by `llvm-config --prefix`. - if let Ok(output) = run_llvm_config(&["--prefix"]) { - let directory = Path::new(output.lines().next().unwrap()).to_path_buf(); - found.extend(search_directories(&directory.join("bin"), files)); - found.extend(search_directories(&directory.join("lib"), files)); - } - // Search the directories provided by the `LD_LIBRARY_PATH` environment variable. if let Ok(path) = env::var("LD_LIBRARY_PATH") { for directory in path.split(':').map(Path::new) {