Skip to content

Commit

Permalink
Merge bitcoin#30739: doc: update dev note examples for CMake
Browse files Browse the repository at this point in the history
7de0c99 doc: update dev note examples for CMake (fanquake)

Pull request description:

  Update the examples in the developer notes to work with CMake.
  Also added an explicit `-DCMAKE_EXPORT_COMPILE_COMMANDS=ON` for clarity.

ACKs for top commit:
  davidgumberg:
    Tested ACK bitcoin@7de0c99
  TheCharlatan:
    ACK 7de0c99
  jonatack:
    Tested ACK 7de0c99 on arm64 macOS 14.6.1

Tree-SHA512: 561fe5e777c5b29a4f26309700c03a730c5bbb2f838630abfaa4174112ced66e733c2109cb429a1927f1f3692bf1945f6386bcaffe604a76ea24633932d39171
  • Loading branch information
fanquake committed Aug 29, 2024
2 parents 00ad716 + 7de0c99 commit 8f761ea
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions doc/developer-notes.md
Original file line number Diff line number Diff line change
Expand Up @@ -214,28 +214,28 @@ int main()
To run clang-tidy on Ubuntu/Debian, install the dependencies:
```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
./autogen.sh && ./configure CC=clang CXX=clang++
make clean && bear --config src/.bear-tidy-config -- make -j $(nproc)
cmake -B build -DCMAKE_C_COMPILER=clang -DCMAKE_CXX_COMPILER=clang++ -DCMAKE_EXPORT_COMPILE_COMMANDS=ON
cmake --build build -j $(nproc)
```

The output is denoised of errors from external dependencies.

To run clang-tidy on all source files:

```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:

```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)
Expand Down

0 comments on commit 8f761ea

Please sign in to comment.