From d7da244475beb2d8408341e56ad0d4720e4d95cd Mon Sep 17 00:00:00 2001 From: Ilyas <80899241+TYFALY@users.noreply.github.com> Date: Sun, 20 Sep 2026 16:49:59 +0100 Subject: [PATCH] Add automatic sccache/ccache detection to CMake and remove deprecated Ninja setup action (#734) * remove outdated ninja setup action * Remove deprecated ninja setup action The seanmiddleditch/gha-setup-ninja action has been archived by its maintainer, who explicitly states that Ninja is now pre-installed on all GitHub-hosted runners. This removes the action from all three build jobs (Windows, macOS, Linux) and removes ninja from the package install lists on macOS and Linux. * Add automatic ccache/sccache detection to CMakeLists.txt Detects sccache (preferred on Windows/MSVC) or ccache at configure time and sets CMAKE_C_COMPILER_LAUNCHER / CMAKE_CXX_COMPILER_LAUNCHER automatically. Works for local builds without manual flags. Priority: sccache > ccache (sccache handles MSVC PDBs better). * Delete github-actions-version-research.md * Respect user-specified CMAKE_C_COMPILER_LAUNCHER / CMAKE_CXX_COMPILER_LAUNCHER Only auto-detect sccache/ccache if no launcher was explicitly provided via -DCMAKE_C_COMPILER_LAUNCHER=... or -DCMAKE_CXX_COMPILER_LAUNCHER=... * Preserve explicit compiler launcher settings per language --------- Co-authored-by: nmzik --- .github/workflows/build.yml | 6 +----- CMakeLists.txt | 16 ++++++++++++++++ 2 files changed, 17 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 7f479eb6a..aa3013ffb 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,9 +43,6 @@ jobs: - name: Setup Visual Studio environment uses: ilammy/msvc-dev-cmd@v1 - - name: Setup Ninja - uses: seanmiddleditch/gha-setup-ninja@v5 - - name: Locate vcpkg id: vcpkg shell: pwsh @@ -155,7 +152,7 @@ jobs: - name: Install build dependencies shell: bash - run: brew install glslang ninja + run: brew install glslang - name: Install Qt 6.10.3 uses: jurplel/install-qt-action@v4 @@ -318,7 +315,6 @@ jobs: libxrandr-dev \ libxss-dev \ lld \ - ninja-build \ pkg-config \ wayland-protocols diff --git a/CMakeLists.txt b/CMakeLists.txt index 46104ee04..29e717e27 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -12,6 +12,22 @@ endif() project(Kyty) +find_program(SCCACHE_PROGRAM sccache) +find_program(CCACHE_PROGRAM ccache) + +foreach(lang IN ITEMS C CXX) + # An explicitly empty launcher disables caching for this language. + if(NOT DEFINED CMAKE_${lang}_COMPILER_LAUNCHER) + if(SCCACHE_PROGRAM) + set(CMAKE_${lang}_COMPILER_LAUNCHER "${SCCACHE_PROGRAM}") + message(STATUS "sccache enabled for ${lang}: ${SCCACHE_PROGRAM}") + elseif(CCACHE_PROGRAM) + set(CMAKE_${lang}_COMPILER_LAUNCHER "${CCACHE_PROGRAM}") + message(STATUS "ccache enabled for ${lang}: ${CCACHE_PROGRAM}") + endif() + endif() +endforeach() + set(KYTY_SOURCE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/src") set(KYTY_TESTS_DIR "${CMAKE_CURRENT_SOURCE_DIR}/tests") set(KYTY_THIRD_PARTY_DIR "${CMAKE_CURRENT_SOURCE_DIR}/3rdparty")