Skip to content

Commit

Permalink
Document llvm@17 usage on Homebrew
Browse files Browse the repository at this point in the history
Signed-off-by: Tom Jakubowski <[email protected]>
  • Loading branch information
tomjakubowski authored and texodus committed May 20, 2024
1 parent 412b7a0 commit 55d3191
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 13 deletions.
1 change: 1 addition & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -295,6 +295,7 @@ jobs:
# Dependencies #
################
################
# Install LLVM - also adds .llvm/bin to the PATH
- name: Install LLVM 17
uses: KyleMayes/install-llvm-action@v2
with:
Expand Down
10 changes: 9 additions & 1 deletion docs/docs/development.md
Original file line number Diff line number Diff line change
Expand Up @@ -147,13 +147,21 @@ yarn jlab_link # run this whenever you need to update a local perspective packag
Install system dependencies through Homebrew:

```bash
brew install cmake
brew install cmake llvm@17
brew link llvm@17 # optional, see below
```

On M1 (Apple Silicon) systems, make sure your brew-installed dependencies are in
`/opt/homebrew` (the default location), and that `/opt/homebrew/bin` is on the
`PATH`.

If you do not want to link the llvm@17 keg, then while developing ensure it is
on your PATH too, like this:

```
PATH=$(brew --prefix llvm@17)/bin:$PATH
```

**Note**: Perspective vendors its C++ extensions, so you may run into trouble
building if you have `brew`-installed versions of libraries, such as
`flatbuffers`.
Expand Down
17 changes: 5 additions & 12 deletions tools/perspective-scripts/lint_cpp.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ export function tidyLint(flags) {
* @param {string} sourceDir
*/
function tidy(buildDir, sourceDir, flags) {
const ctpath = CLANG_TIDY_PATH;
const ctpath = CLANG_TIDY;
// if (!fs.existsSync(ctpath)) {
// console.warn("run-clang-tidy not found, skipping lint");
// return;
Expand All @@ -62,24 +62,17 @@ function tidy(buildDir, sourceDir, flags) {
}
}

const CLANG_TIDY_PATH = fs.existsSync(`${__dirname}/../../.llvm`)
? `${__dirname}/../../.llvm/bin/run-clang-tidy`
: `run-clang-tidy`;

const CLANG_FMT_PATH = fs.existsSync(`${__dirname}/../../.llvm`)
? `${__dirname}/../../.llvm/bin/clang-format`
: `clang-format`;

console.log(`${__dirname}/../../.llvm`);
const CLANG_TIDY = `run-clang-tidy`;
const CLANG_FORMAT = `clang-format`;

function formatLint(dir) {
execSync(`${CLANG_FMT_PATH} -style=file --dry-run -Werror ${dir}`, {
execSync(`${CLANG_FORMAT} -style=file --dry-run -Werror ${dir}`, {
stdio: "inherit",
});
}

function clangFormatFix(dir) {
execSync(`${CLANG_FMT_PATH} -style=file -i ${dir}`, {
execSync(`${CLANG_FORMAT} -style=file -i ${dir}`, {
stdio: "inherit",
});
}
Expand Down

0 comments on commit 55d3191

Please sign in to comment.