cmake: Add USE_CCACHE option

self explanatory

Signed-off-by: crueter <crueter@eden-emu.dev>
This commit is contained in:
crueter 2026-06-17 15:01:25 -04:00
parent fbeb53c25f
commit 34b7c08c19
No known key found for this signature in database
GPG Key ID: 425ACD2D4830EBC6
2 changed files with 22 additions and 5 deletions

View File

@ -225,14 +225,15 @@ if(NOT EXISTS ${PROJECT_SOURCE_DIR}/.git/hooks/pre-commit)
DESTINATION ${PROJECT_SOURCE_DIR}/.git/hooks)
endif()
# Use ccache for android if available
# Use ccache if the user requests it, or if NDK_CCACHE is set on Android
# =======================================================================
if (NOT $ENV{NDK_CCACHE} EQUAL "")
set(CCACHE_EXE $ENV{NDK_CCACHE})
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_EXE})
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_EXE})
if ($ENV{NDK_CCACHE})
set(USE_CCACHE ON)
set(CCACHE_PATH $ENV{NDK_CCACHE})
endif()
include(UseCcache)
# Check for LTO support
# =======================================================================
if (ENABLE_LTO)

View File

@ -0,0 +1,16 @@
# Copyright Citra Emulator Project / Azahar Emulator Project
# Licensed under GPLv2 or any later version
# Refer to the license.txt file included.
option(USE_CCACHE "Use ccache to speed up subsequent builds" OFF)
set(CCACHE_PATH "ccache" CACHE STRING "Path/name of an installed ccache binary")
if (USE_CCACHE)
find_program(CCACHE_EXE ${CCACHE_PATH})
if (CCACHE_EXE)
message(STATUS "CCache found at: ${CCACHE_EXE}")
set(CMAKE_C_COMPILER_LAUNCHER ${CCACHE_EXE})
set(CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE_EXE})
else()
message(FATAL_ERROR "USE_CCACHE enabled, but no ccache found at ${CCACHE_PATH}")
endif()
endif()