Initial implementation of ccache caching for builds

Signed-off-by: Jesse Vincent <jesse@keyboard.io>
pull/591/head
Jesse Vincent 6 years ago
parent 6e9ee55552
commit f87d7bce64

@ -29,6 +29,7 @@ build_paths() {
OUTPUT_DIR="${OUTPUT_DIR:-output/${LIBRARY}}"
OUTPUT_PATH="${OUTPUT_PATH:-${SOURCEDIR}/${OUTPUT_DIR}}"
STABLE_TEMP_DIR="${STABLE_TEMP_DIR:-/tmp/kaleidoscope-${USER}}"
CCACHE_WRAPPER_DIR="${CCACHE_WRAPPER_DIR:-${STABLE_TEMP_DIR}/ccache/bin}"
CORE_CACHE_PATH="${CORE_CACHE_PATH:-${STABLE_TEMP_DIR}/arduino-cores}"
@ -45,6 +46,24 @@ build_filenames () {
ELF_FILE_PATH="${OUTPUT_PATH}/${OUTPUT_FILE_PREFIX}.elf"
}
enable_ccache () {
if [ `which ccache` ]; then
if ! [ -d $CCACHE_WRAPPER_DIR ]; then
mkdir -p $CCACHE_WRAPPER_DIR
ln -s `which ccache` ${CCACHE_WRAPPER_DIR}/${COMPILER_PREFIX}gcc
ln -s `which ccache` ${CCACHE_WRAPPER_DIR}/${COMPILER_PREFIX}g++
ln -s ${AVR_NM} ${CCACHE_WRAPPER_DIR}/${COMPILER_PREFIX}nm
ln -s ${AVR_OBJCOPY} ${CCACHE_WRAPPER_DIR}/${COMPILER_PREFIX}objcopy
ln -s ${AVR_AR} ${CCACHE_WRAPPER_DIR}/${COMPILER_PREFIX}ar
ln -s ${AVR_SIZE} ${CCACHE_WRAPPER_DIR}/${COMPILER_PREFIX}size
fi
export CCACHE_PATH=${COMPILER_PATH}/
CCACHE_ENABLE="-prefs compiler.path=${CCACHE_WRAPPER_DIR}/"
fi
}
firmware_size () {
if [ "${BOARD}" = "virtual" ]; then
echo "[Size not computed for virtual build]"
@ -193,6 +212,8 @@ compile () {
build_version
build_paths
build_filenames
enable_ccache
install -d "${OUTPUT_PATH}"
echo "Building ${OUTPUT_DIR}/${SKETCH} (${LIB_VERSION}) ..."
@ -247,6 +268,7 @@ compile () {
-build-path "${BUILD_PATH}" \
-ide-version "${ARDUINO_IDE_VERSION}" \
-prefs "compiler.cpp.extra_flags=-std=c++11 -Woverloaded-virtual -Wno-unused-parameter -Wno-unused-variable -Wno-ignored-qualifiers ${ARDUINO_CFLAGS} ${LOCAL_CFLAGS}" \
$CCACHE_ENABLE \
-warnings all \
${ARDUINO_VERBOSE} \
${ARDUINO_AVR_GCC_PREFIX_PARAM} \

@ -147,6 +147,7 @@ COMPILER_PREFIX="${COMPILER_PREFIX:-avr-}"
AVR_SIZE="${AVR_SIZE:-${COMPILER_PATH}/${COMPILER_PREFIX}size}"
AVR_SIZE_FLAGS="${AVR_SIZE_FLAGS:--C --mcu=${MCU}}"
AVR_OBJDUMP="${AVR_OBJDUMP:-${COMPILER_PATH}/${COMPILER_PREFIX}objdump}"
AVR_OBJCOPY="${AVR_OBJCOPY:-${COMPILER_PATH}/${COMPILER_PREFIX}objcopy}"
AVR_NM="${AVR_NM:-${COMPILER_PATH}/${COMPILER_PREFIX}nm}"
AVR_AR="${AVR_AR:-${COMPILER_PATH}/${COMPILER_PREFIX}ar}"
AVR_GCC="${AVR_GCC:-${COMPILER_PATH}/${COMPILER_PREFIX}gcc}"

Loading…
Cancel
Save