Skip to content

Commit

Permalink
Review comments
Browse files Browse the repository at this point in the history
  • Loading branch information
LegNeato committed Oct 31, 2022
1 parent dedad5e commit ec229a1
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 6 deletions.
19 changes: 14 additions & 5 deletions README.md
Expand Up @@ -67,7 +67,7 @@ For example, the official LLVM packages from [apt.llvm.org](https://apt.llvm.org
nix-shell
```

- **OS X:** XCode command-line tools and recent LLVM (we recommend the Homebrew version) are required.
- **macOS:** Xcode command-line tools and recent LLVM (we recommend the Homebrew version) are required.

```sh
xcode-select --install
Expand All @@ -91,11 +91,20 @@ like this, for example:
LLVM_CONFIG_PATH=llvm-config-14 cargo install c2rust
```

On OS X with Homebrew LLVM, you need to point the build system at the LLVM installation as follows:
On macOS with Homebrew LLVM, you need to point the build system at the LLVM installation. The path for the installation is architecture dependent:

```sh
LLVM_CONFIG_PATH=/opt/homebrew/opt/llvm/bin/llvm-config cargo install c2rust
```
- **Intel Macs:**

```sh
LLVM_CONFIG_PATH=/usr/local/opt/llvm/bin/llvm-config cargo install c2rust
```


- **Arm Macs:**

```sh
LLVM_CONFIG_PATH=/opt/homebrew/opt/llvm/bin/llvm-config cargo install c2rust
```

On Linux with Linuxbrew LLVM, you need to point the build system at the LLVM installation as follows:

Expand Down
11 changes: 11 additions & 0 deletions c2rust-analyze/tests/filecheck.rs
Expand Up @@ -6,24 +6,35 @@ use std::process::{Command, Stdio};
fn detect_filecheck() -> Option<&'static str> {
let candidates = [
"FileCheck",
// Intel macOS homebrew location.
"/usr/local/opt/llvm/bin/FileCheck",
// Arm macOS homebrew location.
"/opt/homebrew/opt/llvm/bin/FileCheck",
"FileCheck-14",
"/usr/local/opt/llvm@14/bin/FileCheck",
"/opt/homebrew/opt/llvm@14/bin/FileCheck",
"FileCheck-13",
"/usr/local/opt/llvm@13/bin/FileCheck",
"/opt/homebrew/opt/llvm@13/bin/FileCheck",
"FileCheck-12",
"/usr/local/opt/llvm@12/bin/FileCheck",
"/opt/homebrew/opt/llvm@12/bin/FileCheck",
"FileCheck-11",
"/usr/local/opt/llvm@11/bin/FileCheck",
"/opt/homebrew/opt/llvm@11/bin/FileCheck",
"FileCheck-10",
"/usr/local/opt/llvm@10/bin/FileCheck",
"/opt/homebrew/opt/llvm@10/bin/FileCheck",
"FileCheck-9",
"/usr/local/opt/llvm@9/bin/FileCheck",
"/opt/homebrew/opt/llvm@9/bin/FileCheck",
"FileCheck-8",
"/usr/local/opt/llvm@8/bin/FileCheck",
"/opt/homebrew/opt/llvm@8/bin/FileCheck",
"FileCheck-7",
"FileCheck-7.0",
"/usr/local/opt/llvm@7/bin/FileCheck",
"/opt/homebrew/opt/llvm@7/bin/FileCheck",
];

for filecheck in candidates {
Expand Down
10 changes: 9 additions & 1 deletion c2rust-build-paths/src/lib.rs
Expand Up @@ -98,14 +98,22 @@ pub fn find_llvm_config() -> Option<PathBuf> {
"llvm-config-7",
"llvm-config-7.0",
"llvm-config",
// Homebrew install locations on MacOS
// Homebrew install locations on Intel macOS
"/usr/local/opt/llvm@13/bin/llvm-config",
"/usr/local/opt/llvm@12/bin/llvm-config",
"/usr/local/opt/llvm@11/bin/llvm-config",
"/usr/local/opt/llvm@10/bin/llvm-config",
"/usr/local/opt/llvm@9/bin/llvm-config",
"/usr/local/opt/llvm@8/bin/llvm-config",
"/usr/local/opt/llvm/bin/llvm-config",
// Homebrew install locations on Arm macOS
"/opt/homebrew/opt/llvm@13/bin/llvm-config",
"/opt/homebrew/opt/llvm@12/bin/llvm-config",
"/opt/homebrew/opt/llvm@11/bin/llvm-config",
"/opt/homebrew/opt/llvm@10/bin/llvm-config",
"/opt/homebrew/opt/llvm@9/bin/llvm-config",
"/opt/homebrew/opt/llvm@8/bin/llvm-config",
"/opt/homebrew/opt/llvm/bin/llvm-config",
]
.iter()
.map(Path::new)
Expand Down

0 comments on commit ec229a1

Please sign in to comment.