Add option to enable compiler cache (if found).

master
Nicky 2022-01-17 18:24:06 +01:00
parent 5929d4780d
commit 55ce47676b
1 changed files with 22 additions and 2 deletions

View File

@ -42,6 +42,7 @@ WANTS_TESTBUILD=$FALSE
WANTS_TRACY=$FALSE
WANTS_BUILD=$FALSE
WANTS_CRASHREPORTING=$FALSE
WANTS_CACHE=$FALSE
TARGET_PLATFORM="darwin" # darwin, windows, linux
BTYPE="Release"
CHANNEL="" # will be overwritten later with platform-specific values unless manually specified.
@ -85,6 +86,7 @@ showUsage()
echo " --jobs <num> : Build with <num> jobs in parallel (Linux and Darwin only)"
echo " --ninja : Build using Ninja"
echo " --vscode : Exports compile commands for VSCode (Linux only)"
echo " --compiler-cache : Try to detect and use compiler cache (needs also --ninja for OSX and Windows)"
echo
echo "All arguments not in the above list will be passed through to LL's configure/build."
echo
@ -94,7 +96,7 @@ getArgs()
# $* = the options passed in from main
{
if [ $# -gt 0 ]; then
while getoptex "clean build config version package no-package fmodstudio openal ninja vscode jobs: platform: kdu opensim no-opensim singlegrid: avx avx2 tracy crashreporting testbuild: help chan: btype:" "$@" ; do
while getoptex "clean build config version package no-package fmodstudio openal ninja vscode compiler-cache jobs: platform: kdu opensim no-opensim singlegrid: avx avx2 tracy crashreporting testbuild: help chan: btype:" "$@" ; do
#ensure options are valid
if [ -z "$OPTOPT" ] ; then
@ -133,6 +135,7 @@ getArgs()
jobs) JOBS="$OPTARG";;
ninja) WANTS_NINJA=$TRUE;;
vscode) WANTS_VSCODE=$TRUE;;
compiler-cache) WANTS_CACHE=$TRUE;;
help) showUsage && exit 0;;
@ -324,6 +327,7 @@ echo -e " BUILD: `b2a $WANTS_BUILD`" |
echo -e " CONFIG: `b2a $WANTS_CONFIG`" | tee -a $LOG
echo -e " NINJA: `b2a $WANTS_NINJA`" | tee -a $LOG
echo -e " VSCODE: `b2a $WANTS_VSCODE`" | tee -a $LOG
echo -e " COMPILER CACHE: `b2a $WANTS_CACHE`" | tee -a $LOG
echo -e " PASSTHRU: $LL_ARGS_PASSTHRU" | tee -a $LOG
echo -e " BTYPE: $BTYPE" | tee -a $LOG
if [ $TARGET_PLATFORM == "linux" -o $TARGET_PLATFORM == "darwin" ] ; then
@ -545,8 +549,24 @@ if [ $WANTS_CONFIG -eq $TRUE ] ; then
TARGET="Ninja"
fi
CACHE_OPT=""
if [ $WANTS_CACHE -eq $TRUE ]
then
if [ `which ccache 2>/dev/null` ]
then
echo "Found ccache"
CACHE_OPT="-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
fi
if [ `which buildcache 2>/dev/null` ]
then
echo "Found buildcache"
CACHE_OPT="-DCMAKE_C_COMPILER_LAUNCHER=buildcache -DCMAKE_CXX_COMPILER_LAUNCHER=buildcache"
fi
fi
cmake -G "$TARGET" ../indra $CHANNEL ${GITHASH} $FMODSTUDIO $OPENAL $KDU $OPENSIM $SINGLEGRID $AVX_OPTIMIZATION $AVX2_OPTIMIZATION $TRACY_PROFILER $TESTBUILD $PACKAGE \
$UNATTENDED -DLL_TESTS:BOOL=OFF -DADDRESS_SIZE:STRING=$AUTOBUILD_ADDRSIZE -DCMAKE_BUILD_TYPE:STRING=$BTYPE \
$UNATTENDED -DLL_TESTS:BOOL=OFF -DADDRESS_SIZE:STRING=$AUTOBUILD_ADDRSIZE -DCMAKE_BUILD_TYPE:STRING=$BTYPE $CACHE_OPT \
$CRASH_REPORTING -DVIEWER_SYMBOL_FILE:STRING="${VIEWER_SYMBOL_FILE:-}" -DROOT_PROJECT_NAME:STRING=Firestorm $LL_ARGS_PASSTHRU ${VSCODE_FLAGS:-} | tee $LOG
if [ $TARGET_PLATFORM == "windows" ] ; then