From 6132d7bce3b7ccef283949e17cba04672c18ce94 Mon Sep 17 00:00:00 2001 From: Renz Christian Bagaporo Date: Mon, 6 May 2019 19:57:45 +0800 Subject: [PATCH 1/2] cmake: restore ccache use when present Closes https://github.com/espressif/esp-idf/issues/3116 --- tools/cmake/project.cmake | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/tools/cmake/project.cmake b/tools/cmake/project.cmake index 034566e7f..1bf088c3f 100644 --- a/tools/cmake/project.cmake +++ b/tools/cmake/project.cmake @@ -83,6 +83,15 @@ macro(project name) # Now the configuration is loaded, set the toolchain appropriately idf_set_toolchain() + # Enable ccache if it's on the path + if(NOT CCACHE_DISABLE) + find_program(CCACHE_FOUND ccache) + if(CCACHE_FOUND) + message(STATUS "ccache will be used for faster builds") + set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE ccache) + endif() + endif() + __project(${name} C CXX ASM) set(IDF_BUILD_ARTIFACTS ON) From 261c5bf6a898dd8b5655dfe7c98d60f9caecf5bb Mon Sep 17 00:00:00 2001 From: Renz Christian Bagaporo Date: Mon, 6 May 2019 19:58:06 +0800 Subject: [PATCH 2/2] ci: check that build uses ccache when present --- tools/ci/test_build_system_cmake.sh | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/tools/ci/test_build_system_cmake.sh b/tools/ci/test_build_system_cmake.sh index 1c0b0b3e3..2740d6448 100755 --- a/tools/ci/test_build_system_cmake.sh +++ b/tools/ci/test_build_system_cmake.sh @@ -372,6 +372,13 @@ EOF grep "$PWD/components/bootloader/subproject/main/bootloader_start.c" build/bootloader/compile_commands.json \ || failure "Custom bootloader source files should be built instead of the original's" rm -rf components + + print_status "Check ccache is used to build when present" + touch ccache && chmod +x ccache # make sure that ccache is present for this test + (export PATH=$PWD:$PATH && idf.py reconfigure | grep "ccache will be used for faster builds") || failure "ccache should be used when present" + (export PATH=$PWD:$PATH && idf.py reconfigure --no-ccache | grep -c "ccache will be used for faster builds" | grep -wq 0) \ + || failure "ccache should not be used even when present if --no-ccache is specified" + rm -f ccache print_status "All tests completed" if [ -n "${FAILURES}" ]; then