Add automatic sccache/ccache detection to CMake and remove deprecated Ninja setup action #734

Manually merged
github merged 7 commits from gh-pr/734/head into gh-pr/734/base 2026-11-26 09:31:04 +00:00
Owner

@⁠TYFALY on GitHub · 2026-09-20 15:20 UTC · original
TYFALY:main → main · +17 −5 · 2 files · 7 commits · merged 2026-09-20 15:50 UTC

Summary

  • CMake: Added automatic detection for sccache (prioritized) and ccache in CMakeLists.txt via CMAKE_<LANG>_COMPILER_LAUNCHER. Falls back silently if neither compiler launcher is found in PATH.
  • CI Workflow: Removed the archived seanmiddleditch/gha-setup-ninja action and redundant package manager installs for Ninja across Windows, macOS, and Linux runners in .github/workflows/build.yml.

Testing & Verification

Verified build functionality across all target runners in CI:

  • Windows (Clang-CL): 64.29% cache hit rate (531 hits / 295 misses)
  • macOS (Clang): 83.09% cache hit rate (678 hits / 138 misses)
  • Linux (Clang): 78.85% cache hit rate (686 hits / 184 misses)

Zero compilation failures or runtime issues across all three operating systems.

AI Disclosure

AI was used for research on CMake compiler launcher configurations . All CMake modifications and GitHub Actions workflow runs were manually reviewed, verified, and tested prior to PR submission.

**@⁠TYFALY** on GitHub · 2026-09-20 15:20 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/734) `TYFALY:main` → `main` · +17 −5 · 2 files · 7 commits · merged 2026-09-20 15:50 UTC #### Summary - **CMake**: Added automatic detection for `sccache` (prioritized) and `ccache` in `CMakeLists.txt` via `CMAKE_<LANG>_COMPILER_LAUNCHER`. Falls back silently if neither compiler launcher is found in `PATH`. - **CI Workflow**: Removed the archived `seanmiddleditch/gha-setup-ninja` action and redundant package manager installs for Ninja across Windows, macOS, and Linux runners in `.github/workflows/build.yml`. #### Testing & Verification Verified build functionality across all target runners in CI: - **Windows (Clang-CL)**: 64.29% cache hit rate (531 hits / 295 misses) - **macOS (Clang)**: 83.09% cache hit rate (678 hits / 138 misses) - **Linux (Clang)**: 78.85% cache hit rate (686 hits / 184 misses) Zero compilation failures or runtime issues across all three operating systems. #### AI Disclosure AI was used for research on CMake compiler launcher configurations . All CMake modifications and GitHub Actions workflow runs were manually reviewed, verified, and tested prior to PR submission.
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.
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).
Only auto-detect sccache/ccache if no launcher was explicitly provided
via -DCMAKE_C_COMPILER_LAUNCHER=... or -DCMAKE_CXX_COMPILER_LAUNCHER=...
github-bot locked as GitHub sync and limited conversation to collaborators 2026-11-26 09:31:04 +00:00
github manually merged commit 7fabac0ee0 into gh-pr/734/base 2026-11-26 09:31:04 +00:00
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-09-20 15:23 UTC · original · edited 2026-09-20 15:48 UTC

Review Change StackReview Change Stack

No actionable comments were generated in the recent review. 🎉

ℹ️ Recent review info
⚙️ Run configuration

Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 237f13da-4411-419a-96bf-ae8395fbf679

📥 Commits

Reviewing files that changed from the base of the PR and between f48a0f97c3 and 7fabac0ee0.

📒 Files selected for processing (1)
  • CMakeLists.txt

Included review availability: Your plan provides up to 10 included reviews per hour; 8 remain after this review.


📝 Walkthrough

Walkthrough

CMake preserves explicitly configured compiler launchers. When a launcher is undefined, CMake selects sccache before ccache independently for C and C++. The build workflows no longer install Ninja explicitly on Windows, macOS, or Linux. No exported or public declarations changed.

Suggested reviewers: nmzik

Priority: ⬇️ Low

Change: Feature

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Title check ✅ Passed The title clearly summarizes both primary changes: automatic sccache/ccache detection in CMake and removal of deprecated Ninja setup.
Description check ✅ Passed The description directly explains the CMake launcher detection, Ninja workflow cleanup, and cross-platform verification.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0…
Linked Issues check ✅ Passed Check skipped because no linked issues were found for this pull request.
Out of Scope Changes check ✅ Passed Check skipped because no linked issues were found for this pull request.

Comment @coderabbitai help to get the list of available commands.

**@⁠coderabbitai[bot]** on GitHub · 2026-09-20 15:23 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/734#issuecomment-5750713581) · edited 2026-09-20 15:48 UTC <!-- This is an auto-generated comment: summarize by coderabbit.ai --> <!-- review_stack_entry_start --> <a href="https://app.coderabbit.ai/change-stack/KytyPS5/KytyPS5/pull/734#gh-light-mode-only"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui.svg" alt="Review Change Stack" width="202" height="32"></a><a href="https://app.coderabbit.ai/change-stack/KytyPS5/KytyPS5/pull/734#gh-dark-mode-only"><img src="https://storage.googleapis.com/coderabbit_public_assets/review-stack-in-coderabbit-ui-dark.svg" alt="Review Change Stack" width="202" height="32"></a> <!-- review_stack_entry_end --> <!-- recent_review_start --> No actionable comments were generated in the recent review. 🎉 <details> <summary>ℹ️ Recent review info</summary> <details> <summary>⚙️ Run configuration</summary> **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml **Review profile**: CHILL **Plan**: Advanced **Run ID**: `237f13da-4411-419a-96bf-ae8395fbf679` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between f48a0f97c381a5427cb7c556b65797dc84038ee1 and 7fabac0ee0ef773ed2d9914a94c771a809a21198. </details> <details> <summary>📒 Files selected for processing (1)</summary> * `CMakeLists.txt` </details> **Included review availability:** Your plan provides up to 10 included reviews per hour; 8 remain after this review. </details> --- <!-- recent_review_end --> <!-- walkthrough_start --> <details> <summary>📝 Walkthrough</summary> ## Walkthrough CMake preserves explicitly configured compiler launchers. When a launcher is undefined, CMake selects `sccache` before `ccache` independently for C and C++. The build workflows no longer install Ninja explicitly on Windows, macOS, or Linux. No exported or public declarations changed. **Suggested reviewers:** `nmzik` </details> <!-- walkthrough_end --> <!-- change_assessment_start --> **Priority:** ⬇️ Low <!-- change_assessment_commit:"7fabac0ee0ef773ed2d9914a94c771a809a21198" --> **Change:** Feature <!-- change_assessment_end --> <!-- pre_merge_checks_walkthrough_start --> <details> <summary>🚥 Pre-merge checks | ✅ 5</summary> <details> <summary>✅ Passed checks (5 passed)</summary> | Check name | Status | Explanation | | :------------------------: | :------- | :-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | Title check | ✅ Passed | The title clearly summarizes both primary changes: automatic sccache/ccache detection in CMake and removal of deprecated Ninja setup. | | Description check | ✅ Passed | The description directly explains the CMake launcher detection, Ninja workflow cleanup, and cross-platform verification. | | Docstring Coverage | ✅ Passed | No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check. Docstring coverage is scoped to functions touched by this diff. Analyzed 0 functions across 0… | | Linked Issues check | ✅ Passed | Check skipped because no linked issues were found for this pull request. | | Out of Scope Changes check | ✅ Passed | Check skipped because no linked issues were found for this pull request. | </details> </details> <!-- pre_merge_checks_walkthrough_end --> <!-- tips_start --> --- <sub>Comment `@coderabbitai help` to get the list of available commands.</sub> <!-- tips_end -->
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-09-20 15:23 UTC · original · edited 2026-09-20 15:44 UTC
On CMakeLists.txt line 24 (outdated):

@@ -12,6 +12,19 @@ endif()
 
 project(Kyty)
 
+find_program(SCCACHE_PROGRAM sccache)
+find_program(CCACHE_PROGRAM ccache)
+
+if(SCCACHE_PROGRAM)
+    set(CMAKE_C_COMPILER_LAUNCHER "${SCCACHE_PROGRAM}")
+    set(CMAKE_CXX_COMPILER_LAUNCHER "${SCCACHE_PROGRAM}")
+    message(STATUS "sccache enabled: ${SCCACHE_PROGRAM}")
+elseif(CCACHE_PROGRAM)
+    set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")
+    set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}")

🎯 Functional Correctness | 🟠 Major | ⚡ Quick win

Preserve explicitly configured compiler launchers.

When a caller sets CMAKE_C_COMPILER_LAUNCHER or CMAKE_CXX_COMPILER_LAUNCHER, these unconditional assignments replace the requested launcher whenever sccache or ccache is available. This can break configured builds that use a tool such as distcc. Guard each language-specific assignment with if(NOT DEFINED ...). CMake uses these variables to initialize compiler-launcher properties for subsequently created targets. (cmake.org)

✅ Addressed in commits 46c38c8 to f48a0f9

**@⁠coderabbitai[bot]** on GitHub · 2026-09-20 15:23 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/734#discussion_r4057287201) · edited 2026-09-20 15:44 UTC On `CMakeLists.txt` line 24 (outdated): ```diff @@ -12,6 +12,19 @@ endif() project(Kyty) +find_program(SCCACHE_PROGRAM sccache) +find_program(CCACHE_PROGRAM ccache) + +if(SCCACHE_PROGRAM) + set(CMAKE_C_COMPILER_LAUNCHER "${SCCACHE_PROGRAM}") + set(CMAKE_CXX_COMPILER_LAUNCHER "${SCCACHE_PROGRAM}") + message(STATUS "sccache enabled: ${SCCACHE_PROGRAM}") +elseif(CCACHE_PROGRAM) + set(CMAKE_C_COMPILER_LAUNCHER "${CCACHE_PROGRAM}") + set(CMAKE_CXX_COMPILER_LAUNCHER "${CCACHE_PROGRAM}") ``` _🎯 Functional Correctness_ | _🟠 Major_ | _⚡ Quick win_ **Preserve explicitly configured compiler launchers.** When a caller sets `CMAKE_C_COMPILER_LAUNCHER` or `CMAKE_CXX_COMPILER_LAUNCHER`, these unconditional assignments replace the requested launcher whenever `sccache` or `ccache` is available. This can break configured builds that use a tool such as `distcc`. Guard each language-specific assignment with `if(NOT DEFINED ...)`. CMake uses these variables to initialize compiler-launcher properties for subsequently created targets. ([cmake.org](https://cmake.org/cmake/help/latest/variable/CACHE.html?utm_source=openai)) <!-- fingerprinting:phantom:triton:caracal --> <!-- cr-indicator-types:potential_issue --> <!-- cr-comment:v1:2168aeaad7add4ef704e8dde --> <!-- This is an auto-generated comment by CodeRabbit --> ✅ Addressed in commits 46c38c8 to f48a0f9
Author
Owner

@⁠coderabbitai[bot] on GitHub · 2026-09-20 15:23 UTC · original · reviewed

Actionable comments posted: 1


ℹ️ Review info
⚙️ Run configuration

Configuration used: Repository: KytyPS5/KytyPS5/.coderabbit.yaml

Review profile: CHILL

Plan: Advanced

Run ID: 450cb949-a086-484d-a027-65b6925365e5

📥 Commits

Reviewing files that changed from the base of the PR and between c3cc8454b9 and 41ead67a29.

📒 Files selected for processing (2)
  • .github/workflows/build.yml
  • CMakeLists.txt

Included review availability: Your plan provides up to 10 included reviews per hour; 9 remain after this review.

**@⁠coderabbitai[bot]** on GitHub · 2026-09-20 15:23 UTC · [original](https://github.com/KytyPS5/KytyPS5/pull/734#pullrequestreview-5260928531) · **reviewed** **Actionable comments posted: 1** --- <details> <summary>ℹ️ Review info</summary> <details> <summary>⚙️ Run configuration</summary> **Configuration used**: Repository: KytyPS5/KytyPS5/.coderabbit.yaml **Review profile**: CHILL **Plan**: Advanced **Run ID**: `450cb949-a086-484d-a027-65b6925365e5` </details> <details> <summary>📥 Commits</summary> Reviewing files that changed from the base of the PR and between c3cc8454b9f9563e6b7e092bdbe2a1b15d241a37 and 41ead67a29b9303f8b734d7e122a13b3d976512b. </details> <details> <summary>📒 Files selected for processing (2)</summary> * `.github/workflows/build.yml` * `CMakeLists.txt` </details> **Included review availability:** Your plan provides up to 10 included reviews per hour; 9 remain after this review. </details> <!-- This is an auto-generated comment by CodeRabbit for review status -->
This discussion has been locked. Commenting is limited to contributors.
No description provided.