Use ccache if available
This commit is contained in:
parent
f1b9e5046d
commit
99a47bc590
4 changed files with 21 additions and 5 deletions
|
@ -1,6 +1,6 @@
|
|||
# Tool overrides
|
||||
cc="clang${postfix}"
|
||||
cxx="clang++${postfix}"
|
||||
cc="${ccache}clang${postfix}"
|
||||
cxx="${ccache}clang++${postfix}"
|
||||
|
||||
# Flag additions
|
||||
TYPES+=(debug warnmore profile)
|
||||
|
|
|
@ -13,3 +13,19 @@ libs=("")
|
|||
# Builds for all compilers
|
||||
TYPES=(release)
|
||||
cflags_release=("${cflags[@]}" -DNDEBUG)
|
||||
|
||||
# Use ccache if it's available
|
||||
if command -v ccache &> /dev/null; then
|
||||
ccache="ccache "
|
||||
# share the cache results
|
||||
export CCACHE_UMASK="002"
|
||||
# compress cache results
|
||||
if [[ -z "${CCACHE_HARDLINK:-}" ]]; then
|
||||
export CCACHE_COMPRESS=1
|
||||
fi
|
||||
# cache pre-compiled headers
|
||||
export CCACHE_SLOPPINESS="time_macros"
|
||||
cflags+=(-fpch-preprocess)
|
||||
else
|
||||
ccache=""
|
||||
fi
|
||||
|
|
|
@ -1,7 +1,7 @@
|
|||
# Tool overrides
|
||||
ar="gcc-ar${postfix}"
|
||||
cc="gcc${postfix}"
|
||||
cxx="g++${postfix}"
|
||||
cc="${ccache}gcc${postfix}"
|
||||
cxx="${ccache}g++${postfix}"
|
||||
ld="gcc${postfix}"
|
||||
ranlib="gcc-ranlib${postfix}"
|
||||
|
||||
|
|
|
@ -8,7 +8,7 @@ dependencies=(ldd "${executable}")
|
|||
function pre_build() {
|
||||
cd ../..
|
||||
underline "Environment"
|
||||
echo "[$("${CC}" --version | head -1)]"
|
||||
echo "[$(${CC} --version | head -1)]"
|
||||
for v in "${VARIABLES[@]}"; do
|
||||
vupper=$(upper "${v}")
|
||||
echo "${vupper}=\"$(eval echo \$"${vupper}")\""
|
||||
|
|
Loading…
Add table
Reference in a new issue