microsoft / microsoft/vscode-cmake-tools

Write note in README/docs that if you want to use a custom build LLVM/Clang with "clang-cl", you need to symlink it to VS "\VC\Tools\Llvm"

Open
#1,814 8 comments 2 reactions 0 assignees View on GitHub
enhancement Feature: kits stale-exempt
Dominant language
TypeScript
Stars
1.7k
Forks
546
Avg merge
2d 16h
Merged PRs (30d)
32

Description

I couldn't get this extension detecting my custom built LLVM 13 `clang-cl.exe`.

It detected everything else, including the Visual Studio `clang-cl` you are forced to install if you want LLVM/`clang` compatibility, and the regular `clang.exe` for my LLVM 13, but not the `clang-cl.exe`

Then I found a comment from someone referencing a commit which was meant to fix an issue with `clang-cl` detection, and I found that it appeared to be checking that the path to the binary was inside of a Visual Studio install LLVM tools:

```ts
const clangArch = (vs_arch === "amd64") ? "x64\\" : "";
if (binPath.startsWith(`${vs.installationPath}\\VC\\Tools\\Llvm\\${clangArch}bin`) &&
```

So I tried this:
```ps1
mklink /D `
"C:\Program Files (x86)\Microsoft Visual Studio\2019\Preview\VC\Tools\Llvm\x64\bin\13" `
"C:\Users\rayga\Projects\tmp\llvm-project\llvm-13.0.0-msbuild-vs2019-x64-rel\bin"
```

And then:
![image](https://user-images.githubusercontent.com/26604994/116166745-a82d1c80-a6cc-11eb-85f8-9286bb2650ea.png)

Out of curiosity, why can't this do:
```ts
const pathString = await spawn(['echo', isWindows ? '%PATH%' : '$PATH'])
const pathBinaries = pathString.split(";")
const clangClBinaries = pathBinaries.filter(it => it.endsWith(isWindows ? "clang-cl.exe" : "clang-cl"))
```

Instead of requiring it to be inside of Visual Studio?

https://github.com/microsoft/vscode-cmake-tools/blob/42933885019e9538678cd6dca45836bfd86f96c8/src/kit.ts#L925-L989

Contributor guide

Open the contributing guide

Research direction

Start with the README/docs location and review the clang-cl detection logic referenced in src/kit.ts lines 925-989. Add a note explaining the required Visual Studio VC\Tools\Llvm symlink for custom-built clang-cl.exe, and consider the documented PATH-based alternative raised in the issue; done means the workaround is clear to users.

Written by the indexing model from the issue text.

Assessment

Tech stack
cmake, typescript, vscode
Domain
build-system, documentation
Issue type
Documentation
Difficulty
1/5
Estimated time
Under an hour
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.