From 7eda1f6845278a1e36b0650e8b4b77868795c4cb Mon Sep 17 00:00:00 2001 From: LoveSy Date: Fri, 12 Mar 2021 02:07:35 +0800 Subject: [PATCH] [CI] Use ccache to cache github action building * Try ccache * Cache Cmake * No ccache in gradle cache Co-authored-by: vvb2060 --- .github/workflows/core.yml | 8 ++++++++ core/build.gradle.kts | 1 + core/src/main/cpp/CMakeLists.txt | 11 ++++++++++- 3 files changed, 19 insertions(+), 1 deletion(-) diff --git a/.github/workflows/core.yml b/.github/workflows/core.yml index 4a01f028..e34bfb90 100644 --- a/.github/workflows/core.yml +++ b/.github/workflows/core.yml @@ -47,6 +47,14 @@ jobs: gradle-manager-${{ hashFiles('**/*.gradle.kts') }} gradle-core gradle- + - name: Cache Cmake + uses: actions/cache@v2 + with: + path: ~/.ccache + key: ccache-${{ hashFiles('core/src/main/cpp') }} + restore-keys: ccache- + - name: Install ccache + run: sudo apt-get install -y ccache - name: Build with Gradle run: | echo 'org.gradle.caching=true' >> gradle.properties diff --git a/core/build.gradle.kts b/core/build.gradle.kts index 626738e8..cb1156cb 100644 --- a/core/build.gradle.kts +++ b/core/build.gradle.kts @@ -95,6 +95,7 @@ android { arguments("-DRIRU_MODULE_API_VERSION=$moduleMaxRiruApiVersion", "-DRIRU_MODULE_VERSION=$verCode", "-DRIRU_MODULE_VERSION_NAME:STRING=\"$verName\"") + targets("lspd") } } diff --git a/core/src/main/cpp/CMakeLists.txt b/core/src/main/cpp/CMakeLists.txt index b8f4a48f..00cda415 100644 --- a/core/src/main/cpp/CMakeLists.txt +++ b/core/src/main/cpp/CMakeLists.txt @@ -20,6 +20,15 @@ cmake_minimum_required(VERSION 3.4.1) +find_program( CCACHE ccache ) + +if ( CCACHE ) + set( CMAKE_CXX_COMPILER_LAUNCHER ${CCACHE} ) + set( CMAKE_C_COMPILER_LAUNCHER ${CCACHE} ) +else() + message( WARNING "Could not find CCache program." ) +endif() + link_libraries("-ffixed-x18") add_definitions(-DRIRU_MODULE) @@ -28,4 +37,4 @@ add_definitions(-DRIRU_MODULE_VERSION=${RIRU_MODULE_VERSION}) add_definitions(-DRIRU_MODULE_VERSION_NAME=${RIRU_MODULE_VERSION_NAME}) add_subdirectory(main) -add_subdirectory(external) \ No newline at end of file +add_subdirectory(external)