-
Notifications
You must be signed in to change notification settings - Fork 257
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
345343c
commit 51be484
Showing
11 changed files
with
452 additions
and
289 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
# Installing Clang | ||
|
||
## Installing Clang on Linux | ||
|
||
Install the latest clang available in your package manager: | ||
|
||
`apt` (Ubuntu/Debian): | ||
```bash | ||
sudo apt install clang | ||
``` | ||
|
||
or install any version from llvm apt: | ||
```bash | ||
wget -O - https://apt.llvm.org/llvm.sh | sudo bash -s - 17 | ||
``` | ||
|
||
### CMake | ||
|
||
The following defines are required to instruct CMake on which compiler to use: | ||
|
||
```bash | ||
cmake -DCMAKE_CXX_COMPILER=clang++ ... | ||
``` | ||
or with specific version: | ||
```bash | ||
cmake -DCMAKE_CXX_COMPILER=clang++-17 ... | ||
``` | ||
|
||
### make | ||
|
||
Set `CXX=clang++` or `CXX=clang++-17` environment variables before running make. | ||
|
||
## Installing Clang on macOS | ||
|
||
On macOS clang is the default compiler and already included in the official Xcode toolchain. No additional setup required. | ||
|
||
## Installing Clang on Windows | ||
|
||
### CMake + Ninja | ||
|
||
Download and install the latest `win64` build from the official LLVM GitHub page: | ||
|
||
https://github.com/llvm/llvm-project/releases | ||
|
||
### Visual Studio | ||
|
||
In MSVC 2019 and 2022, there is built-in support for the Clang toolchain: | ||
|
||
https://learn.microsoft.com/en-us/cpp/build/clang-support-msbuild?view=msvc-170 | ||
https://learn.microsoft.com/en-us/cpp/build/clang-support-cmake?view=msvc-170 | ||
|
||
LLVM/Clang has very good compatibility with the MSVC ABI and is widely used for building large projects on Windows (including Chrome). Therefore, switching to LLVM/Clang should not cause any compatibility problems. | ||
|
||
## Transparent Clang use (experimental) | ||
|
||
Setting `KFR_WITH_CLANG` to `ON` instructs KFR to download Clang from the official GitHub, extract it to the build directory, and set all required CMake variables to enable its usage. | ||
Works on Windows and Linux. | ||
|
||
```bash | ||
cmake -B build -GNinja -DKFR_WITH_CLANG=ON -DCMAKE_BUILD_TYPE=Release | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.