## Summary Improve CMake build system: cleaner separation, compiler caching, and release packaging. ### Toolchain & Build - Clean up `toolchain.cmake` to only contain clang/lld-specific setup (compiler paths, linker selection, llvm tools), allowing other toolchains like GCC to work without it - Add ccache (Linux/macOS) and sccache (Windows) support via toolchain auto-detection - Move project-universal flags (`-ffunction-sections`, `--gc-sections`, `-static-libstdc++`, etc.) to `CMakeLists.txt` so they apply regardless of toolchain - Add `-fno-exceptions` to project compile options; fix `/EHs-c-` for proper MSVC exception disabling - Use MSVC/clang-cl frontend detection instead of `WIN32` for MSVC-specific linker flags - Declare missing options: `CLICE_USE_LIBCXX`, `CLICE_OFFLINE_BUILD`, `CLICE_ENABLE_BENCHMARK`, `CLICE_RELEASE` ### Release Packaging (`cmake/release.cmake`) - Strip debug symbols and produce separate symbol archives (`.debug` / `.dSYM` / `.pdb`) - Windows: copy PDB via `$<TARGET_PDB_FILE:clice>`; macOS: use `copy_directory` for dSYM bundle - Package clice binary + clang resource dir + config into distributable tarball/zip - `cmake/archive.cmake` helper for cross-platform archive creation - Activated via `-DCLICE_RELEASE=ON` (auto-enables LTO) ### Code Cleanup - Replace manual 40+ line source file list with `GLOB_RECURSE` for clice-core - Fix duplicate `include_resolver.cpp` entry - Use build-time `add_custom_target` for clang resource dir copy (instead of configure-time `file(COPY)`) - Gate `scan_benchmark` behind `CLICE_ENABLE_BENCHMARK` option ### CI - Add compiler cache with env var control (`CCACHE_DIR`/`SCCACHE_DIR`) and `actions/cache` for persistence - Proper cache lifecycle: zero-stats before build, show-stats + stop-server after - Stop sccache server before pixi cleanup to fix Windows EBUSY error - Pass `CLICE_ENABLE_BENCHMARK=ON` in benchmark workflow - Platform-specific ccache/sccache dependencies in pixi.toml ## Test plan - [x] Local build (RelWithDebInfo) passes - [x] Local release build (LTO + strip + pack) produces correct archives - [ ] CI: Linux Debug/RelWithDebInfo - [ ] CI: macOS Debug/RelWithDebInfo - [ ] CI: Windows Debug/RelWithDebInfo - [ ] CI: Benchmark (all platforms) --------- Co-authored-by: Claude Opus 4.6 <noreply@anthropic.com>
66 lines
1.8 KiB
YAML
66 lines
1.8 KiB
YAML
name: cmake
|
|
|
|
on:
|
|
workflow_call:
|
|
|
|
env:
|
|
CCACHE_DIR: ${{ github.workspace }}/.cache/ccache
|
|
SCCACHE_DIR: ${{ github.workspace }}/.cache/sccache
|
|
CCACHE_BASEDIR: ${{ github.workspace }}
|
|
SCCACHE_BASEDIRS: ${{ github.workspace }}
|
|
CCACHE_COMPILERCHECK: content
|
|
CCACHE_MAXSIZE: 2G
|
|
SCCACHE_CACHE_SIZE: 2G
|
|
|
|
jobs:
|
|
build:
|
|
strategy:
|
|
fail-fast: false
|
|
matrix:
|
|
os: [windows-2025, ubuntu-24.04, macos-15]
|
|
build_type: [Debug, RelWithDebInfo]
|
|
runs-on: ${{ matrix.os }}
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@v4
|
|
|
|
- uses: ./.github/actions/setup-pixi
|
|
|
|
- name: Restore compiler cache
|
|
uses: actions/cache@v4
|
|
with:
|
|
path: ${{ runner.os == 'Windows' && '.cache/sccache' || '.cache/ccache' }}
|
|
key: ${{ runner.os }}-${{ matrix.build_type }}-ccache-${{ github.sha }}
|
|
restore-keys: |
|
|
${{ runner.os }}-${{ matrix.build_type }}-ccache-
|
|
|
|
- name: Zero cache stats
|
|
run: |
|
|
if [ "$RUNNER_OS" = "Windows" ]; then
|
|
pixi run -- sccache --stop-server || true
|
|
pixi run -- sccache --zero-stats || true
|
|
else
|
|
pixi run -- ccache --zero-stats || true
|
|
fi
|
|
shell: bash
|
|
|
|
- name: Build
|
|
run: pixi run build ${{ matrix.build_type }} ON
|
|
|
|
- name: Unit Test
|
|
run: pixi run unit-test ${{ matrix.build_type }}
|
|
|
|
- name: Integration Test
|
|
run: pixi run integration-test ${{ matrix.build_type }}
|
|
|
|
- name: Print cache stats and stop server
|
|
if: always()
|
|
run: |
|
|
if [ "$RUNNER_OS" = "Windows" ]; then
|
|
pixi run -- sccache --show-stats
|
|
pixi run -- sccache --stop-server || true
|
|
else
|
|
pixi run -- ccache --show-stats
|
|
fi
|
|
shell: bash
|