feat(ci): enable sccache on Windows and propagate compiler launcher to ExternalProject (#439)
feat(ci): enable sccache on Windows and propagate compiler launcher to ExternalProject Windows CI builds were ~6-9x slower than other platforms (35-40 min vs 4-7 min) due to missing compiler cache. This commit enables sccache for Windows and ensures all ExternalProject_Add dependencies (Arrow, lz4) receive the compiler launcher on every platform. Changes: MSVC /Zi → /Z7 compatibility: - Replace /Zi with /Z7 in root CMakeLists.txt for DEBUG and RELWITHDEBINFO configurations (MSVC cache variable level) - Patch rocksdb, antlr4, and googletest source CMakeLists to replace hardcoded /Zi with /Z7 at the source, eliminating D9025 warnings - Clear COMPILE_PDB_NAME on googletest targets to prevent CMake from adding /Fd<path>, which causes sccache to look for nonexistent .pdb - Remove /FS (forced synchronous PDB writes) from Arrow ExternalProject MSVC flags — unnecessary with /Z7 Windows CI workflow: - Add mozilla-actions/sccache-action@v0.0.10 - Set SCCACHE_GHA_ENABLED=true to use GitHub Actions Cache backend - Pass CMAKE_C/CXX_COMPILER_LAUNCHER=sccache via --config-settings Compiler launcher propagation: - Propagate CMAKE_C/CXX_COMPILER_LAUNCHER to Arrow ExternalProject on all platforms (Windows, Linux, macOS, Android, iOS) - Propagate to lz4 ExternalProject on Windows via CMAKE_ARGS, using CMP0141=NEW + CMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded for /Z7
This commit is contained in:
@@ -20,6 +20,9 @@ jobs:
|
||||
- platform: windows-2022
|
||||
- platform: windows-2025
|
||||
|
||||
env:
|
||||
SCCACHE_GHA_ENABLED: "true"
|
||||
|
||||
steps:
|
||||
- name: Show env info
|
||||
run: |
|
||||
@@ -38,6 +41,9 @@ jobs:
|
||||
git submodule foreach --recursive 'git reset --hard && git clean -ffdx'
|
||||
shell: powershell
|
||||
|
||||
- name: Setup sccache
|
||||
uses: mozilla-actions/sccache-action@v0.0.10
|
||||
|
||||
- name: Set up Python
|
||||
uses: actions/setup-python@v6
|
||||
with:
|
||||
@@ -76,7 +82,9 @@ jobs:
|
||||
$env:CMAKE_BUILD_PARALLEL_LEVEL = "$env:NPROC"
|
||||
python -m pip install -v . `
|
||||
--no-build-isolation `
|
||||
--config-settings='cmake.define.BUILD_TOOLS=ON'
|
||||
--config-settings='cmake.define.BUILD_TOOLS=ON' `
|
||||
--config-settings='cmake.define.CMAKE_C_COMPILER_LAUNCHER=sccache' `
|
||||
--config-settings='cmake.define.CMAKE_CXX_COMPILER_LAUNCHER=sccache'
|
||||
shell: powershell
|
||||
|
||||
- name: Run C++ Tests
|
||||
@@ -96,7 +104,9 @@ jobs:
|
||||
cd "$env:GITHUB_WORKSPACE\examples\c++"
|
||||
mkdir build
|
||||
cd build
|
||||
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release
|
||||
cmake .. -G Ninja -DCMAKE_BUILD_TYPE=Release `
|
||||
-DCMAKE_C_COMPILER_LAUNCHER=sccache `
|
||||
-DCMAKE_CXX_COMPILER_LAUNCHER=sccache
|
||||
cmake --build . --config Release --parallel $env:NPROC
|
||||
|
||||
# Copy zvec.dll next to the example executables so Windows can find it.
|
||||
@@ -125,4 +135,9 @@ jobs:
|
||||
.\db-example.exe
|
||||
.\core-example.exe
|
||||
.\ailego-example.exe
|
||||
shell: powershell
|
||||
|
||||
- name: Show sccache statistics
|
||||
if: always()
|
||||
run: sccache --show-stats
|
||||
shell: powershell
|
||||
Reference in New Issue
Block a user