среда, 19 февраля 2014 г.

Ускорение компиляции cmake cotire

Для ускорения компиляции при использовании cmake существует инструмент
https://github.com/sakra/cotire. Но возникли проблемы его применения совместно с ccache. Не получилось настроить, чтобы ccache кешировал precompiled header, сгенерированный cotire. В итоге пересборка проходит долго, столько же времени, сколько занимает сборка при отсутствии ccache. Пока остановились на использовании связки distcc + ccache, без cotire.

ccache и precompiled header

ccache поддерживает работу в precompiled header

Precompiled headers

ccache has support for GCC’s precompiled headers. However, you have to do some things to make it work properly:

You must set CCACHE_SLOPPINESS to time_macros. The reason is that ccache can’t tell whether __TIME__ or __DATE__ is used when using a precompiled header.

You must either:

use the -include compiler option to include the precompiled header (i.e., don’t use #include in the source code to include the header); or

add the -fpch-preprocess compiler option when compiling.

If you don’t do this, either the non-precompiled version of the header file will be used (if available) or ccache will fall back to running the real compiler and increase the statistics counter “preprocessor error” (if the non-precompiled header file is not available).

http://ccache.samba.org/manual.html#_precompiled_headers