From 7f5b4fd6ec78a7048c9f363284d3dd21954cdcf2 Mon Sep 17 00:00:00 2001 From: snider Date: Mon, 6 Oct 2025 21:15:58 +0100 Subject: [PATCH] Refactor caching logic in CI workflows and update CMake policies for improved build efficiency --- .github/workflows/build-windows-intel.yml | 6 +++++- CMakeLists.txt | 24 +++++++++++------------ cmake/FindCcache.cmake | 4 +--- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/.github/workflows/build-windows-intel.yml b/.github/workflows/build-windows-intel.yml index 8e3a352f..55377cb1 100644 --- a/.github/workflows/build-windows-intel.yml +++ b/.github/workflows/build-windows-intel.yml @@ -22,6 +22,7 @@ jobs: submodules: recursive - name: Cache SDK Folder + id: cache uses: actions/cache@v4 with: path: | @@ -30,11 +31,14 @@ jobs: key: ${{ runner.os }}-${{ runner.arch }}-sdk - uses: actions/setup-python@v5 + if: steps.cache.outputs.cache-hit != 'true' with: python-version: 3.x - - run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]" + - if: steps.cache.outputs.cache-hit != 'true' + run: pip install mkdocs-material mkdocs-git-revision-date-localized-plugin mkdocs-git-committers-plugin-2 mkdocs-git-authors-plugin "mkdocs-material[imaging]" - name: Compile Release + if: steps.cache.outputs.cache-hit != 'true' run: make build-deps CPU_CORES=4 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }} msvc-194: diff --git a/CMakeLists.txt b/CMakeLists.txt index d7ec2173..f5f5cf58 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -6,20 +6,11 @@ set(DISABLE_TOR TRUE CACHE BOOL "Disable TOR library(and related tor-connect sub PROJECT(Lethean) set(VERSION "1.0" CACHE STRING "Build version") - -message("OPENSSL_INCLUDE_DIR: ${OPENSSL_INCLUDE_DIR}") -message("OPENSSL_CRYPTO_LIBRARY: ${OPENSSL_CRYPTO_LIBRARY}") -message("OPENSSL_SSL_LIBRARY: ${OPENSSL_SSL_LIBRARY}") +set(CMAKE_CXX_STANDARD 17) +set(CMAKE_CXX_STANDARD_REQUIRED ON) list(INSERT CMAKE_MODULE_PATH 0 "${CMAKE_CURRENT_SOURCE_DIR}/cmake") -include(DocBuilder) -option (USE_CCACHE "Use ccache if a usable instance is found" ON) -if (USE_CCACHE) - include(FindCcache) -else() - message(STATUS "ccache deselected") -endif() if(POLICY CMP0043) cmake_policy(SET CMP0043 NEW) @@ -37,6 +28,14 @@ if(POLICY CMP0167) cmake_policy(SET CMP0167 OLD) endif() +include(DocBuilder) +option (USE_CCACHE "Use ccache if a usable instance is found" ON) +if (USE_CCACHE) + include(FindCcache) +else() + message(STATUS "ccache deselected") +endif() + #option (USE_CCACHE "Use ccache if a usable instance is found" ON) #if (USE_CCACHE) # include(FindCcache) # Has to be included after the project() macro, to be able to read the CXX variable. @@ -44,8 +43,7 @@ endif() # message(STATUS "ccache deselected") #endif() -set(CMAKE_CXX_STANDARD 17) -set(CMAKE_CXX_STANDARD_REQUIRED ON) + if(CMAKE_SYSTEM_NAME STREQUAL "iOS" OR CMAKE_SYSTEM_NAME STREQUAL "Android") diff --git a/cmake/FindCcache.cmake b/cmake/FindCcache.cmake index 2a677173..f7bea2d0 100644 --- a/cmake/FindCcache.cmake +++ b/cmake/FindCcache.cmake @@ -6,9 +6,7 @@ if (CCACHE_FOUND) cmake_minimum_required(VERSION 3.10) project(test) option (CCACHE "") -if(POLICY CMP0091) - cmake_policy(SET CMP0091 NEW) -endif() +cmake_policy(SET CMP0091 NEW) file(WRITE "${CMAKE_SOURCE_DIR}/test.cpp" "int main() { return 0; }") set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE} cache_dir=${CMAKE_SOURCE_DIR}/build/.ccache") set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CCACHE} cache_dir=${CMAKE_SOURCE_DIR}/build/.ccache")