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:
parent
c7523326a0
commit
510fb205e7
@ -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)
|
option(ENABLE_MONOLITHIC_INSTALL "Install everything in single directory on Linux and Mac" OFF)
|
||||||
endif()
|
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
|
# Allow to pass package name from Travis CI
|
||||||
set(PACKAGE_NAME_SUFFIX "" CACHE STRING "Suffix for CPack package name")
|
set(PACKAGE_NAME_SUFFIX "" CACHE STRING "Suffix for CPack package name")
|
||||||
set(PACKAGE_FILE_NAME "" CACHE STRING "Override for CPack package filename")
|
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_PRODUCT_BUNDLE_IDENTIFIER "${BUNDLE_IDENTIFIER_PREFIX}.$(PRODUCT_NAME)")
|
||||||
set(CMAKE_XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2")
|
set(CMAKE_XCODE_ATTRIBUTE_TARGETED_DEVICE_FAMILY "1,2")
|
||||||
|
|
||||||
if(CMAKE_CXX_COMPILER_LAUNCHER)
|
if(ENABLE_CCACHE)
|
||||||
find_program(CCACHE "ccache")
|
find_program(CCACHE "ccache")
|
||||||
if(CCACHE)
|
if(CCACHE)
|
||||||
# https://stackoverflow.com/a/36515503/2278742
|
# https://stackoverflow.com/a/36515503/2278742
|
||||||
@ -255,12 +261,12 @@ if(MINGW OR MSVC)
|
|||||||
set(CMAKE_SHARED_LIBRARY_PREFIX "")
|
set(CMAKE_SHARED_LIBRARY_PREFIX "")
|
||||||
|
|
||||||
if(MSVC)
|
if(MSVC)
|
||||||
if(CMAKE_CXX_COMPILER_LAUNCHER)
|
if(ENABLE_CCACHE)
|
||||||
# https://github.com/ccache/ccache/discussions/1154#discussioncomment-3611387
|
# https://github.com/ccache/ccache/discussions/1154#discussioncomment-3611387
|
||||||
find_program(ccache_exe ccache)
|
find_program(CCACHE ccache)
|
||||||
if (ccache_exe)
|
if (CCACHE)
|
||||||
file(COPY_FILE
|
file(COPY_FILE
|
||||||
${ccache_exe} ${CMAKE_BINARY_DIR}/cl.exe
|
${CCACHE} ${CMAKE_BINARY_DIR}/cl.exe
|
||||||
ONLY_IF_DIFFERENT)
|
ONLY_IF_DIFFERENT)
|
||||||
|
|
||||||
set(CMAKE_VS_GLOBALS
|
set(CMAKE_VS_GLOBALS
|
||||||
|
@ -122,7 +122,8 @@
|
|||||||
"cacheVariables": {
|
"cacheVariables": {
|
||||||
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/vcpkg/scripts/buildsystems/vcpkg.cmake",
|
"CMAKE_TOOLCHAIN_FILE": "${sourceDir}/vcpkg/scripts/buildsystems/vcpkg.cmake",
|
||||||
"CMAKE_POLICY_DEFAULT_CMP0091": "NEW",
|
"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",
|
"description": "VCMI iOS release using Conan and ccache",
|
||||||
"inherits": "ios-release-conan",
|
"inherits": "ios-release-conan",
|
||||||
"cacheVariables": {
|
"cacheVariables": {
|
||||||
"ENABLE_PCH" : "OFF"
|
"ENABLE_PCH" : "OFF",
|
||||||
|
"ENABLE_CCACHE": "ON"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
Loading…
Reference in New Issue
Block a user