mirror of https://github.com/qt/qtbase.git
qmake: Add support for a custom cache launcher like sccache
qmake has a feature to prepend 'ccache' to each compiler and linker command. Add a new feature to allow customizing the cache launcher prefix, to be able to use other cache launchers like 'sccache'. Can be done by running: qmake CONFIG+=ccache QMAKE_CACHE_LAUNCHER_PREFIX=sccache Pick-to: 6.8 6.9 6.10 Task-number: QTBUG-139139 Change-Id: Ic14caa7796ac6fca8eb85dbeb51ce8c13a3cfa3f Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
This commit is contained in:
parent
038ccd24f8
commit
4b56619614
|
@ -2,18 +2,22 @@ macx-xcode: return()
|
||||||
|
|
||||||
darwin: load(sdk)
|
darwin: load(sdk)
|
||||||
|
|
||||||
ccache_prefix = ccache
|
launcher_prefix = ccache
|
||||||
|
|
||||||
precompile_header {
|
!isEmpty(QMAKE_CACHE_LAUNCHER_PREFIX) {
|
||||||
|
launcher_prefix = $$QMAKE_CACHE_LAUNCHER_PREFIX
|
||||||
|
}
|
||||||
|
|
||||||
|
precompile_header:contains(launcher_prefix, ccache) {
|
||||||
CCACHE_SLOPPINESS += pch_defines time_macros
|
CCACHE_SLOPPINESS += pch_defines time_macros
|
||||||
|
|
||||||
ccache_prefix = \
|
launcher_prefix = \
|
||||||
CCACHE_SLOPPINESS=\"$$join(CCACHE_SLOPPINESS, ',')\$${CCACHE_SLOPPINESS+,\$$CCACHE_SLOPPINESS}\" \
|
CCACHE_SLOPPINESS=\"$$join(CCACHE_SLOPPINESS, ',')\$${CCACHE_SLOPPINESS+,\$$CCACHE_SLOPPINESS}\" \
|
||||||
# Make sure we build sources directly, not from their preprocessed version,
|
# Make sure we build sources directly, not from their preprocessed version,
|
||||||
# otherwise precompiled headers will not be used during cache misses.
|
# otherwise precompiled headers will not be used during cache misses.
|
||||||
CCACHE_CPP2=true \
|
CCACHE_CPP2=true \
|
||||||
$$ccache_prefix
|
$$launcher_prefix
|
||||||
}
|
}
|
||||||
|
|
||||||
for(tool, $$list(QMAKE_CC QMAKE_CXX QMAKE_LINK QMAKE_LINK_SHLIB QMAKE_LINK_C)): \
|
for(tool, $$list(QMAKE_CC QMAKE_CXX QMAKE_LINK QMAKE_LINK_SHLIB QMAKE_LINK_C)): \
|
||||||
$$tool = $$ccache_prefix $$eval($$tool)
|
$$tool = $$launcher_prefix $$eval($$tool)
|
||||||
|
|
Loading…
Reference in New Issue