diff --git a/.github/workflows/build-engine-windows.yml b/.github/workflows/build-engine-windows.yml index 413c3daf21..1845a3539e 100644 --- a/.github/workflows/build-engine-windows.yml +++ b/.github/workflows/build-engine-windows.yml @@ -9,6 +9,7 @@ on: env: BUILD_TYPE: Release + CCACHE_VERSION: 4.8.3 CCACHE_BASEDIR: ${{ github.workspace }} CCACHE_DIR: "${{ github.workspace }}/.ccache" CCACHE_COMPILERTYPE: msvc @@ -24,7 +25,7 @@ jobs: - name: Install dependencies run: | - choco install ccache + choco install ccache --version ${{ env.CCACHE_VERSION }} - name: Get timestamp shell: bash @@ -46,7 +47,7 @@ jobs: run: cmake -E make_directory ${{github.workspace}}\build - name: Configure CMake - run: cmake -B ${{github.workspace}}\build -G "Visual Studio 17 2022" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_CORE_SAMPLES=ON -DBUILD_CORE_TESTS=ON -DBUILD_ENGINE_SAMPLES=ON -DUSE_CLANG_TIDY=OFF + run: cmake -B ${{github.workspace}}\build -G "Visual Studio 17 2022" -DCMAKE_BUILD_TYPE=${{env.BUILD_TYPE}} -DBUILD_CORE_SAMPLES=ON -DBUILD_CORE_TESTS=ON -DBUILD_ENGINE_SAMPLES=ON -DUSE_CLANG_TIDY=OFF -DCCACHE_VERSION="${{env.CCACHE_VERSION}}" - name: CCache Prolog run: |- diff --git a/CMakeLists.txt b/CMakeLists.txt index 136a68d5e5..5d6b4bcc10 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -32,8 +32,13 @@ if(CCACHE_EXE) option(USE_CCACHE "Enable CCache" ON) if(USE_CCACHE) if (CMAKE_HOST_WIN32) + option(CCACHE_VERSION "Pinned CCache Version") + + # find_program only finds Chocolatey's shim which is unable to be used with another name, the original executable must be used. + set(CCACHE_PATH C:/ProgramData/chocolatey/lib/ccache/tools/ccache-${CCACHE_VERSION}-windows-x86_64/ccache.exe) + file(COPY_FILE - "C:/ProgramData/chocolatey/lib/ccache/tools/ccache-4.8.3-windows-x86_64/ccache.exe" ${CMAKE_BINARY_DIR}/cl.exe + ${CCACHE_PATH} ${CMAKE_BINARY_DIR}/cl.exe ONLY_IF_DIFFERENT) set(CMAKE_VS_GLOBALS