#!/bin/bash
CURRENT_DIR=$(dirname $(readlink -f ${BASH_SOURCE[0]}))
export HI_PYTHON=python3.11
WORK_DIR=$(cd ${CURRENT_DIR}/../..; pwd)
CCACHE_LOG_DIR=${WORK_DIR}/output/ccache
[ ! -d "${CCACHE_LOG_DIR}" ] && mkdir -p "${CCACHE_LOG_DIR}"
export CCACHE_LOGFILE="${CCACHE_LOG_DIR}/ccache_$$.log"
export CCACHE_STATSLOG="${CCACHE_LOG_DIR}/stat_ccache.log"
export CCACHE_COMPILERCHECK=content
export CCACHE_SLOPPINESS=include_file_ctime,include_file_mtime,time_macros
export CCACHE_BASEDIR=${WORK_DIR}
export CCACHE_MAXSIZE=200GB
[ -n "${CLOUD_BUILD_RECORD_ID}" ] && export CCACHE_SECONDARY_STORAGE=redis://cloud-cache.turing.huawei.com:6381
export CCACHE_NOINODECACHE=true
export CCACHE_NOHASHDIR=true
export CCACHE_UMASK=002
export LANG=en_US.UTF-8
export LC_ALL=C
if [ "z$enable_ccache_debug" == "ztrue" ] ;then
export CCACHE_DEBUG=true
export CCACHE_DEBUGDIR="${CCACHE_LOG_DIR}/debug"
fi
if [ -z "${set_ccache_env}" ]; then
os_type=$(lsb_release -i | sed 's@Distributor ID:\t@@g')
if [ "${os_type}" != "CentOS" ]; then
extra_options="-- -Orecurse"
fi
if [ "$1" == "default" ]; then
cmake --build . ${extra_options}
else
if [ "${enable_tbuild}" == "true" ]; then
unset CLOUD_BUILD_RECORD_ID
tbuildlite make $1
else
if [ "${enable_custom}" == "false" ] || [ -z "${TARGETS}" ]; then
cmake --build . --target $1 ${extra_options}
else
cmake --build . --target ${TARGETS}
fi
fi
fi
fi