Actually fix Window ccache support in CI

Add CMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded to CI line
- Needs to be before the first project call

Set required CMake Policy for MSVC ccache debug type
This commit is contained in:
Eric Kilmer
2025-03-12 14:30:17 -04:00
parent 78ed150957
commit a96b7fdcc6
3 changed files with 40 additions and 0 deletions
+3
View File
@@ -56,6 +56,7 @@ jobs:
max_attempts: 3
command: |
choco install ccache doxygen.install graphviz
Add-Content -Path $env:GITHUB_ENV -Value "CCACHE_EXE=$(Resolve-Path C:\ProgramData\chocolatey\lib\ccache\tools\*\ccache.exe)"
vcpkg install zlib:x64-windows-static
- name: Generate cache key
@@ -100,6 +101,8 @@ jobs:
run: cmake "--preset=ci-$("${{ matrix.os }}".split("-")[0])"
-DCMAKE_BUILD_TYPE=${{ matrix.build_type }}
-Dsleigh_RELEASE_TYPE=${{ matrix.release }}
"-DCMAKE_PROJECT_INCLUDE:FILEPATH=${{ github.workspace }}/cmake/ccache-msvc.cmake"
-DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded
- name: Build the project
run: cmake
+3
View File
@@ -8,6 +8,9 @@
cmake_minimum_required(VERSION 3.18)
# For MSVC ccache to use /Z7 with CMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded
cmake_policy(SET CMP0141 NEW)
include(cmake/prelude.cmake)
# Sets "library_root" variable for decompiler cpp root directory
+34
View File
@@ -0,0 +1,34 @@
# This module configures ccache to work with MSVC
# Based on: https://github.com/ccache/ccache/wiki/MS-Visual-Studio
# Only do this for Windows MSVC builds
if(NOT WIN32 OR NOT CMAKE_CXX_COMPILER_ID MATCHES "MSVC")
return()
endif()
# Assume the parent environment has this set
# Chocolatey creates a shim which doesn't work when renamed
set(CCACHE_EXE "$ENV{CCACHE_EXE}")
if(NOT CCACHE_EXE)
message(STATUS "ccache not found - MSVC ccache support disabled")
return()
endif()
message(STATUS "Found ccache - ${CCACHE_EXE}")
message(STATUS "Configuring ccache for MSVC")
file(COPY_FILE
"${CCACHE_EXE}" "${CMAKE_BINARY_DIR}/cl.exe"
ONLY_IF_DIFFERENT)
# By default Visual Studio generators will use /Zi which is not compatible
# with ccache, so tell Visual Studio to use /Z7 instead.
message(STATUS "Setting MSVC debug information format to 'Embedded'")
set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT "$<$<CONFIG:Debug,RelWithDebInfo>:Embedded>")
set(CMAKE_VS_GLOBALS
"CLToolExe=cl.exe"
"CLToolPath=${CMAKE_BINARY_DIR}"
"UseMultiToolTask=true"
"DebugInformationFormat=OldStyle"
)