Since employing ccache
on our CI server, we find that the bottleneck in terms of build time is now our static analysis pass, that uses clang-tidy
, among other tools. Does anyone know of a way to accelerate clang-tidy
in a similar way to how ccache
does so with a regular compiler?
Running clang-tidy is rather slow - internally it compiles each file and then runs the checks so it will always be some factor slower than compilation.
Ccache is a compiler cache. It speeds up recompilation by caching the result of previous compilations and detecting when the same compilation is being done again. Ccache has been carefully written to always produce exactly the same compiler output that you would get without the cache.
Ccache is a compiler cache. It speeds up recompilation by caching previous compilations and detecting when the same compilation is being done again. Ccache is free software, released under the GNU General Public License version 3 or later.
To install ccache with Homebrew, run brew install ccache . With MacPorts, run port install ccache . You can also download and install yourself, using the instructions in the repository. Make sure ccache can be found in your $PATH .
I found another important detail here:
https://gitlab.kitware.com/cmake/cmake/-/merge_requests/1791/diffs
which is used here:
https://reviews.bitcoinabc.org/D5150?id=15995
So in order to be able to cache the output of the compiler when integrating clang-tidy using the : set(CMAKE_CXX_CLANG_TIDY ...
method you need to use the COMPILER_LAUNCHER method to configure ccache
find_program(CCACHE ccache)
if(CCACHE)
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE})
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE})
endif(CCACHE)
and NOT the launcher rule method:
find_program(CCACHE ccache)
if(CCACHE)
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ${CCACHE})
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK ${CCACHE})
endif(CCACHE)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With