项目文件夹

文件
egolearner e91b7802f3 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
2026-06-02 16:23:37 +08:00

29 行
1.2 KiB
CMake

set(ANTLR_SRC_DIR ${CMAKE_CURRENT_SOURCE_DIR}/antlr4)
set(ANTLR_PATCH ${CMAKE_CURRENT_SOURCE_DIR}/antlr4.patch)
apply_patch_once("antlr4_fix" "${ANTLR_SRC_DIR}" "${ANTLR_PATCH}")
if(MSVC)
# Replace /Zi with /Z7 for sccache compatibility (/Z7 embeds debug info in .obj, no .pdb).
set(ANTLR_WINDOWS_PATCH ${CMAKE_CURRENT_SOURCE_DIR}/antlr4.windows.patch)
apply_patch_once("antlr4_windows_fix" "${ANTLR_SRC_DIR}" "${ANTLR_WINDOWS_PATCH}")
endif()
if(MSVC)
set(WITH_STATIC_CRT ${ZVEC_USE_STATIC_CRT} CACHE BOOL "" FORCE)
endif()
add_subdirectory(antlr4/runtime/Cpp/)
target_include_directories(antlr4_static SYSTEM INTERFACE
"${CMAKE_CURRENT_SOURCE_DIR}/antlr4/runtime/Cpp/runtime/src/"
)
mark_target_includes_system(antlr4_static)
if(CMAKE_CXX_COMPILER_ID MATCHES "Clang")
target_compile_options(antlr4_static PRIVATE -Wno-unknown-pragmas -Wno-unqualified-std-cast-call)
elseif(CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
target_compile_options(antlr4_static PRIVATE -Wno-unknown-pragmas -Wno-unqualified-std-cast-call -Wno-attributes -Wno-implicit-fallthrough)
elseif (CMAKE_CXX_COMPILER_ID STREQUAL "MSVC")
target_compile_definitions(antlr4_static INTERFACE ANTLR4CPP_STATIC)
endif ()
add_library(antlr4 ALIAS antlr4_static)