1
0
mirror of https://github.com/vcmi/vcmi.git synced 2024-12-22 22:13:35 +02:00

Add CMake option for enabling ccache for IOS and MSVC build

This commit is contained in:
Alexander Wilms 2023-10-05 23:29:41 +02:00
parent c7523326a0
commit 510fb205e7
2 changed files with 15 additions and 7 deletions

View File

@ -79,6 +79,12 @@ if(NOT APPLE_IOS AND NOT ANDROID)
option(ENABLE_MONOLITHIC_INSTALL "Install everything in single directory on Linux and Mac" OFF)
endif()
# On Linux, use -DCMAKE_CXX_COMPILER_LAUNCHER=ccache instead.
# The iOS and MSVC builds each require some configuration, which is enabled by the following option:
if(APPLE_IOS OR MSVC)
option(ENABLE_CCACHE "Speed up recompilation by caching previous compilations" OFF)
endif()
# Allow to pass package name from Travis CI
set(PACKAGE_NAME_SUFFIX "" CACHE STRING "Suffix for CPack package name")
set(PACKAGE_FILE_NAME "" CACHE STRING "Override for CPack package filename")
@ -223,7 +229,7 @@ if(APPLE_IOS)
set(CMAKE_XCODE_ATTRIBUTE_PRODUCT_BUNDLE_IDENTIFIER "${BUNDLE_IDENTIFIER_PREFIX}.$(PRODUCT_NAME)")
set(CMAKE_XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2")
if(CMAKE_CXX_COMPILER_LAUNCHER)
if(ENABLE_CCACHE)
find_program(CCACHE "ccache")
if(CCACHE)
# https://stackoverflow.com/a/36515503/2278742
@ -255,12 +261,12 @@ if(MINGW OR MSVC)
set(CMAKE_SHARED_LIBRARY_PREFIX "")
if(MSVC)
if(CMAKE_CXX_COMPILER_LAUNCHER)
if(ENABLE_CCACHE)
# https://github.com/ccache/ccache/discussions/1154#discussioncomment-3611387
find_program(ccache_exe ccache)
if (ccache_exe)
find_program(CCACHE ccache)
if (CCACHE)
file(COPY_FILE
${ccache_exe} ${CMAKE_BINARY_DIR}/cl.exe
${CCACHE} ${CMAKE_BINARY_DIR}/cl.exe
ONLY_IF_DIFFERENT)
set(CMAKE_VS_GLOBALS

View File

@ -122,7 +122,8 @@
"cacheVariables": {
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/vcpkg/scripts/buildsystems/vcpkg.cmake",
"CMAKE_POLICY_DEFAULT_CMP0091": "NEW",
"FORCE_BUNDLED_MINIZIP": "ON"
"FORCE_BUNDLED_MINIZIP": "ON",
"ENABLE_CCACHE": "ON"
}
},
{
@ -228,7 +229,8 @@
"description": "VCMI iOS release using Conan and ccache",
"inherits": "ios-release-conan",
"cacheVariables": {
"ENABLE_PCH" : "OFF"
"ENABLE_PCH" : "OFF",
"ENABLE_CCACHE": "ON"
}
},
{