forked from lthn/blockchain
Add ccache support and update caching paths in build configurations
This commit is contained in:
parent
3fcee22c86
commit
6c35d636b3
9 changed files with 55 additions and 6 deletions
5
.github/workflows/build-linux-arm64.yml
vendored
5
.github/workflows/build-linux-arm64.yml
vendored
|
|
@ -27,7 +27,10 @@ jobs:
|
|||
- name: Cache SDK Folder
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ github.workspace }}/build/sdk
|
||||
path: |
|
||||
${{ github.workspace }}/build/.ccache
|
||||
${{ github.workspace }}/build/sdk
|
||||
${{ github.workspace }}/build/bin
|
||||
key: ${{ runner.os }}-${{ runner.arch }}-sdk
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
|
|
|
|||
5
.github/workflows/build-linux-intel.yml
vendored
5
.github/workflows/build-linux-intel.yml
vendored
|
|
@ -27,7 +27,10 @@ jobs:
|
|||
- name: Cache SDK Folder
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ github.workspace }}/build/sdk
|
||||
path: |
|
||||
${{ github.workspace }}/build/.ccache
|
||||
${{ github.workspace }}/build/sdk
|
||||
${{ github.workspace }}/build/bin
|
||||
key: ${{ runner.os }}-${{ runner.arch }}-sdk
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
|
|
|
|||
5
.github/workflows/build-macos-arm64.yml
vendored
5
.github/workflows/build-macos-arm64.yml
vendored
|
|
@ -26,7 +26,10 @@ jobs:
|
|||
- name: Cache SDK Folder
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ github.workspace }}/build/sdk
|
||||
path: |
|
||||
${{ github.workspace }}/build/.ccache
|
||||
${{ github.workspace }}/build/sdk
|
||||
${{ github.workspace }}/build/bin
|
||||
key: ${{ runner.os }}-${{ runner.arch }}-sdk
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
|
|
|
|||
5
.github/workflows/build-macos-intel.yml
vendored
5
.github/workflows/build-macos-intel.yml
vendored
|
|
@ -24,7 +24,10 @@ jobs:
|
|||
- name: Cache SDK Folder
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ github.workspace }}/build/sdk
|
||||
path: |
|
||||
${{ github.workspace }}/build/.ccache
|
||||
${{ github.workspace }}/build/sdk
|
||||
${{ github.workspace }}/build/bin
|
||||
key: ${{ runner.os }}-${{ runner.arch }}-sdk
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
|
|
|
|||
5
.github/workflows/build-windows-intel.yml
vendored
5
.github/workflows/build-windows-intel.yml
vendored
|
|
@ -24,7 +24,10 @@ jobs:
|
|||
- name: Cache SDK Folder
|
||||
uses: actions/cache@v4
|
||||
with:
|
||||
path: ${{ github.workspace }}/build/sdk
|
||||
path: |
|
||||
${{ github.workspace }}/build/.ccache
|
||||
${{ github.workspace }}/build/sdk
|
||||
${{ github.workspace }}/build/bin
|
||||
key: ${{ runner.os }}-${{ runner.arch }}-sdk
|
||||
|
||||
- uses: actions/setup-python@v5
|
||||
|
|
|
|||
|
|
@ -7,7 +7,6 @@ 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}")
|
||||
|
|
@ -15,6 +14,12 @@ message("OPENSSL_SSL_LIBRARY: ${OPENSSL_SSL_LIBRARY}")
|
|||
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)
|
||||
|
|
|
|||
|
|
@ -21,6 +21,7 @@ function(selective_clean_build_dir)
|
|||
|
||||
# List of top-level items in the build directory to keep.
|
||||
set(golden_items
|
||||
"${CMAKE_SOURCE_DIR}/build/.ccache"
|
||||
"${CMAKE_SOURCE_DIR}/build/bin"
|
||||
"${CMAKE_SOURCE_DIR}/build/docs"
|
||||
"${CMAKE_SOURCE_DIR}/build/sdk"
|
||||
|
|
|
|||
26
cmake/FindCcache.cmake
Normal file
26
cmake/FindCcache.cmake
Normal file
|
|
@ -0,0 +1,26 @@
|
|||
find_program(CCACHE_FOUND ccache)
|
||||
if (CCACHE_FOUND)
|
||||
# Try to compile a test program with ccache, in order to verify if it really works. (needed on exotic setups)
|
||||
set(TEST_PROJECT "${CMAKE_BINARY_DIR}/${CMAKE_FILES_DIRECTORY}/CMakeTmp")
|
||||
file(WRITE "${TEST_PROJECT}/CMakeLists.txt" [=[
|
||||
cmake_minimum_required(VERSION 3.10)
|
||||
project(test)
|
||||
option (CCACHE "")
|
||||
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}")
|
||||
unset(TEST_PROJECT)
|
||||
if (${RET})
|
||||
# Success
|
||||
message(STATUS "Found usable ccache: ${CCACHE_FOUND}")
|
||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_COMPILE "${CCACHE_FOUND} cache_dir=${CMAKE_SOURCE_DIR}/build/.ccache")
|
||||
set_property(GLOBAL PROPERTY RULE_LAUNCH_LINK "${CCACHE_FOUND} cache_dir=${CMAKE_SOURCE_DIR}/build/.ccache")
|
||||
else()
|
||||
message(STATUS "Found ccache ${CCACHE_FOUND}, but is UNUSABLE! Return code: ${RET}")
|
||||
endif()
|
||||
else()
|
||||
message(STATUS "ccache NOT found! Please install it for faster rebuilds.")
|
||||
endif()
|
||||
|
|
@ -18,6 +18,8 @@ class BlockchainConan(ConanFile):
|
|||
"testnet": False
|
||||
}
|
||||
|
||||
tool_requires = "ccache/4.11"
|
||||
|
||||
requires = [
|
||||
"zlib/1.3.1",
|
||||
"boost/1.85.0",
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue