Construire clang, clang-tidy & co en trois coups de cuillère à pot
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
Vous pouvez tomber sur des recettes obsolètes y compris sur la documentation officielle de llvm. | |
Voici donc des instructions à jour, jusqu'à ce qu'elles ne le soient plus. | |
```shell | |
git clone https://github.com/llvm/llvm-project.git | |
cd llvm-project | |
mkdir build | |
cd build | |
cmake -DCLANG_ENABLE_STATIC_ANALYZER=1 -DLLVM_ENABLE_ASSERTIONS=On DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=$HOME/local - -DLLVM_ENABLE_PROJECTS="all" -G "Ninja" ../llvm | |
ninja install | |
ninja check-clang | |
``` | |
**C'est tout**. Poursuivez la lecture si les détails vous intéressent, ou par simple masochisme. | |
Précédement, les sous-projets de LLVM étaient imbriqués. Ils sont maintenant tous au niveau de la racine du dépot: | |
clang clang-tools-extra compiler-rt debuginfo-tests libclc libcxx libcxxabi libunwind lld lldb llgo llvm openmp parallel-libs polly pstl README.md | |
You may find obsolete recipes even on the official llvm documentation. | |
So here are up-to-date instructions, until they are not. | |
```shell | |
git clone https://github.com/llvm/llvm-project.git | |
cd llvm-project | |
mkdir build | |
cd build | |
cmake -DCLANG_ENABLE_STATIC_ANALYZER=1 -DLLVM_ENABLE_ASSERTIONS=On DCMAKE_BUILD_TYPE=RelWithDebInfo -DCMAKE_INSTALL_PREFIX=$HOME/local - -DLLVM_ENABLE_PROJECTS="all" -G "Ninja" ../llvm | |
ninja | |
ninja check-clang | |
``` | |
**That's it**. Read ahead if you're interested by the details. | |
LLVM's subprojects used to be nested, now you should see all of them from the root of the repository: | |
build clang clang-tools-extra compiler-rt debuginfo-tests libclc libcxx libcxxabi libunwind lld lldb llgo llvm openmp parallel-libs polly pstl README.md | |
The "llvm" entry isn't the root directory anymore, though still considered the source root. So, the `path/to/llvm/source/root` mentionned in the [documentation][build with cmake] would be `~/llvm-project/llvm` and you would use this one even to simply build clang. | |
L'entrée "llvm" n'est plus le répertoire racine, bien qu'elle soit toujours considérée comme la racine. Ainsi, le `path/to/llvm/source/root` mentionné dans la [documentation][build with cmake][construire avec cmake] serait `~/llvm-project/llvm`, même pour construire simplement clang. | |
Ces étapes respectent ["get started"][get started] avec la touche suivante: | |
* RelWithDebInfo + Assertions plutôt Debug. | |
* Recrutement d'un ninja pour plus de rapidité. | |
* Choix de libc++, la bibliothèqye C++ standard de LLVM (incluse dans 'all') | |
* Installation locale, plus conviviale. | |
Les options sont décrites [ice][build with cmake]. | |
[get started]: https://clang.llvm.org/get_started.html | |
[build with cmake]: https://llvm.org/docs/CMake.html |
Comments
Post a Comment