This PR makes it possible to reuse the ccache
cache populated during a build in another build directory.
For example, on Ubuntu 24.04:
0$ cmake -B build_1 -DWITH_CCACHE=ON
1$ cmake --build build_1 -t bitcoind
2$ cmake -B build_2 -DWITH_CCACHE=ON
3$ ccache --zero-stats
4$ cmake --build build_2 -t bitcoind
5$ ccache --show-stats
6Cacheable calls: 298 / 298 (100.0%)
7 Hits: 221 / 298 (74.16%)
8 Direct: 59 / 221 (26.70%)
9 Preprocessed: 162 / 221 (73.30%)
10 Misses: 77 / 298 (25.84%)
11<snip>
Further improvements can be made by replacing the config/bitcoin-config.h
header with -D
preprocessor options in the command line, eliminating the need to specifying -I${CMAKE_CURRENT_BINARY_DIR}
.
The “Cache compilations with ccache
” section of the Productivity Notes still applicable.
Please refer to #20353 for historical context.
Addresses this comment:
However, ccache does not hit across two different build dirs, compiling the same commit.