1
0
Fork 0

Use ccache if available

This commit is contained in:
krcroft 2020-03-22 09:22:27 -07:00 committed by Patryk Obara
parent f1b9e5046d
commit 99a47bc590
4 changed files with 21 additions and 5 deletions

View file

@ -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)

View file

@ -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

View file

@ -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}"

View file

@ -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}")\""