1
0
Fork 0
forked from lthn/blockchain

Add caching for MSVC 194 build and set CMake policy CMP0091 to NEW

This commit is contained in:
snider 2025-10-06 20:53:48 +01:00
parent bf58c56ab1
commit e51eaf6a05
2 changed files with 31 additions and 1 deletions

View file

@ -11,8 +11,35 @@ on:
type: string
jobs:
msvc-194-cache:
name: cache-msvc-194-x86_64
runs-on: windows-latest
steps:
- name: Checkout Project
uses: actions/checkout@v4.2.2
with:
fetch-depth: 0
submodules: recursive
- name: Cache SDK Folder
uses: actions/cache@v4
with:
path: |
${{ github.workspace }}/build/sdk
${{ github.workspace }}/build/bin
key: ${{ runner.os }}-${{ runner.arch }}-sdk
- uses: actions/setup-python@v5
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]"
- name: Compile Release
run: make build-deps CPU_CORES=4 TESTNET=${{ inputs.chain-network == 'testnet' && '1' || '0' }}
msvc-194:
name: msvc-194-x86_64
needs: msvc-194-cache
runs-on: windows-latest
steps:
- name: Checkout Project

View file

@ -6,12 +6,15 @@ if (CCACHE_FOUND)
cmake_minimum_required(VERSION 3.10)
project(test)
option (CCACHE "")
if(POLICY CMP0091)
cmake_policy(SET CMP0091 NEW)
endif()
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")
add_executable(main test.cpp)
]=])
try_compile(RET "${TEST_PROJECT}/build" "${TEST_PROJECT}" "test" CMAKE_FLAGS -DCCACHE="${CCACHE_FOUND}")
try_compile(RET "${TEST_PROJECT}/build" "${TEST_PROJECT}" "test" CMAKE_FLAGS -DCCACHE="${CCACHE_FOUND} -DCMAKE_POLICY_DEFAULT_CMP0091=NEW")
unset(TEST_PROJECT)
if (${RET})
# Success