Skip to content

Commit

Permalink
Changed llvm-config to be first search candidate on macOS
Browse files Browse the repository at this point in the history
  • Loading branch information
KyleMayes committed Feb 17, 2019
1 parent 3a4c7d5 commit c004376
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 7 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

Expand Down
14 changes: 7 additions & 7 deletions build/common.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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"]) {
Expand All @@ -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) {
Expand Down

0 comments on commit c004376

Please sign in to comment.