Caching and accelerating meson builds
mold
is an easy win, with the following native file:
1[binaries]
2c_ld = 'mold'
3cpp_ld = 'mold'
4fortran_ld = 'mold'
5[built-in options]
6# mold 1.11.0 or later needed due to https://github.com/rui314/mold/issues/1017
7# --no-as-needed temporarily necessary due to the seeming return of https://github.com/rui314/mold/issues/1017
8c_link_args = ['-fuse-ld=mold', '-Wl,--no-as-needed']
9cpp_link_args = ['-fuse-ld=mold', '-Wl,--no-as-needed']
10fortran_link_args = ['-fuse-ld=mold', '-Wl,--no-as-needed']
ccache
can be used to cache and rebuild quicker as well:
1CC="$(which ccache) $(which gcc)" CXX="$(which ccache) $(which g++)" FCC="$(which ccache) $(which gfortran)" meson setup b2dir --native-file nativeFiles/mold.ini
Or in another native file:
1[binaries]
2c = ['ccache', 'gcc']
3cpp = ['ccache', 'g++']
4fortran = ['ccache', 'gfortran']
This can be called in a cascade:
1meson setup b2dir --native-file nativeFiles/mold.ini --native-file nativeFiles/ccache_gnu.ini
Further improvements come from ccache
with distcc
, or icecream or for a
single binary extension, sccache.
Comments