0
0
Fork 0
mirror of https://github.com/bitcoin/bitcoin.git synced 2025-02-08 10:31:50 -05:00

doc: update dev note examples for CMake

This commit is contained in:
fanquake 2024-08-28 15:13:34 +01:00
parent 0c90fc6443
commit 7de0c99804
No known key found for this signature in database
GPG key ID: 2EEB9F5CC09526C1

View file

@ -214,14 +214,14 @@ int main()
To run clang-tidy on Ubuntu/Debian, install the dependencies: To run clang-tidy on Ubuntu/Debian, install the dependencies:
```sh ```sh
apt install clang-tidy bear clang apt install clang-tidy clang
``` ```
Then, pass clang as compiler to configure, and use bear to produce the `compile_commands.json`: Configure with clang as the compiler:
```sh ```sh
./autogen.sh && ./configure CC=clang CXX=clang++ cmake -B build -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
make clean && bear --config src/.bear-tidy-config -- make -j $(nproc) cmake --build build -j $(nproc)
``` ```
The output is denoised of errors from external dependencies. The output is denoised of errors from external dependencies.
@ -229,13 +229,13 @@ The output is denoised of errors from external dependencies.
To run clang-tidy on all source files: To run clang-tidy on all source files:
```sh ```sh
( cd ./src/ && run-clang-tidy -j $(nproc) ) ( cd ./src/ && run-clang-tidy -p ../build -j $(nproc) )
``` ```
To run clang-tidy on the changed source lines: To run clang-tidy on the changed source lines:
```sh ```sh
git diff | ( cd ./src/ && clang-tidy-diff -p2 -j $(nproc) ) git diff | ( cd ./src/ && clang-tidy-diff -p2 -path ../build -j $(nproc) )
``` ```
Coding Style (Python) Coding Style (Python)