mirror of
https://github.com/OpenMW/openmw.git
synced 2026-01-24 13:30:55 +00:00
CCache with MSBuild
This commit is contained in:
parent
39ec9f32a1
commit
240e2486ed
3 changed files with 41 additions and 7 deletions
|
|
@ -758,7 +758,7 @@ macOS15_Xcode16_arm64:
|
|||
- $env:CCACHE_IGNOREHEADERS = "$env:INCLUDE;$(Get-Location)\deps"
|
||||
- '$env:NINJA_STATUS = "[%s/%t %p :: %e] "'
|
||||
- cmake --build . --config $config --target ($targets.Split(' '))
|
||||
- ccache --show-stats -v
|
||||
- ccache --show-stats -vv
|
||||
- cd $config
|
||||
- echo "CI_COMMIT_REF_NAME ${CI_COMMIT_REF_NAME}`r`nCI_JOB_ID ${CI_JOB_ID}`r`nCI_COMMIT_SHA ${CI_COMMIT_SHA}" | Out-File -Encoding UTF8 CI-ID.txt
|
||||
- $artifactDirectory = "$(Make-SafeFileName("${CI_PROJECT_NAMESPACE}"))/$(Make-SafeFileName("${CI_COMMIT_REF_NAME}"))/$(Make-SafeFileName("${CI_COMMIT_SHORT_SHA}-${CI_JOB_ID}"))/"
|
||||
|
|
@ -816,7 +816,7 @@ macOS15_Xcode16_arm64:
|
|||
# This is capped at 2h by GitLab for Windows Shared Runners
|
||||
timeout: 2h
|
||||
variables:
|
||||
CCACHE_SIZE: 1.5G
|
||||
CCACHE_SIZE: 2.5G
|
||||
targets: all
|
||||
|
||||
.Windows_Ninja_Release:
|
||||
|
|
@ -923,6 +923,7 @@ Windows_Ninja_CacheInit:
|
|||
- choco source disable -n=chocolatey
|
||||
- choco install git --force --params "/GitAndUnixToolsOnPath" -y
|
||||
- choco install 7zip -y
|
||||
- choco install ccache -y
|
||||
- choco install vswhere -y
|
||||
- choco install python -y
|
||||
- choco install awscli -y --version=2.22.35
|
||||
|
|
@ -945,11 +946,19 @@ Windows_Ninja_CacheInit:
|
|||
- $time = (Get-Date -Format "HH:mm:ss")
|
||||
- echo ${time}
|
||||
- echo "started by ${GITLAB_USER_NAME}"
|
||||
- $env:CCACHE_DIR = "$(Get-Location)\ccache"
|
||||
- $env:CCACHE_DEPEND = "true"
|
||||
- $env:CCACHE_INODECACHE = "true"
|
||||
- $env:CCACHE_SLOPPINESS = "pch_defines, time_macros"
|
||||
- New-Item -Type Directory -Force -Path $env:CCACHE_DIR
|
||||
- ccache -z -M "${CCACHE_SIZE}"
|
||||
- New-Item -Type File -Force -Path MSVC2022_64\.cmake\api\v1\query\codemodel-v2
|
||||
- sh CI/before_script.msvc.sh -c $config -p Win64 -v 2022 -k -V -b -t -C $multiview -E
|
||||
- cd MSVC2022_64
|
||||
- Get-Volume
|
||||
- $env:CCACHE_IGNOREHEADERS = "$(Get-Location)\deps"
|
||||
- cmake --build . --config $config --target ($targets.Split(' '))
|
||||
- ccache --show-stats -vv
|
||||
- cd $config
|
||||
- echo "CI_COMMIT_REF_NAME ${CI_COMMIT_REF_NAME}`r`nCI_JOB_ID ${CI_JOB_ID}`r`nCI_COMMIT_SHA ${CI_COMMIT_SHA}" | Out-File -Encoding UTF8 CI-ID.txt
|
||||
- $artifactDirectory = "$(Make-SafeFileName("${CI_PROJECT_NAMESPACE}"))/$(Make-SafeFileName("${CI_COMMIT_REF_NAME}"))/$(Make-SafeFileName("${CI_COMMIT_SHORT_SHA}-${CI_JOB_ID}"))/"
|
||||
|
|
@ -992,6 +1001,7 @@ Windows_Ninja_CacheInit:
|
|||
cache:
|
||||
key: msbuild-2022-v13
|
||||
paths:
|
||||
- ccache
|
||||
- deps
|
||||
- MSVC2022_64/deps/Qt
|
||||
artifacts:
|
||||
|
|
@ -1003,6 +1013,7 @@ Windows_Ninja_CacheInit:
|
|||
- MSVC2022_64/**/*.log
|
||||
- "*_to-be-merged.txt"
|
||||
variables:
|
||||
CCACHE_SIZE: 2.5G
|
||||
targets: ALL_BUILD
|
||||
# When CCache doesn't exist (e.g. first build on a fork), build takes more than 1h, which is the default for forks.
|
||||
# This is capped at 2h by GitLab for Windows Shared Runners
|
||||
|
|
|
|||
|
|
@ -532,7 +532,7 @@ if [ -n "$USE_CCACHE" ]; then
|
|||
if [ -n "$NMAKE" ] || [ -n "$NINJA" ]; then
|
||||
add_cmake_opts "-DCMAKE_C_COMPILER_LAUNCHER=ccache -DCMAKE_CXX_COMPILER_LAUNCHER=ccache"
|
||||
else
|
||||
echo "Ignoring -C (CCache) as it is incompatible with Visual Studio CMake generators"
|
||||
add_cmake_opts "-DOPENMW_MSBUILD_COMPILER_OVERRIDE=ccache"
|
||||
fi
|
||||
fi
|
||||
|
||||
|
|
|
|||
|
|
@ -170,6 +170,29 @@ option(OPENMW_LTO_BUILD "Build OpenMW with Link-Time Optimization (Needs ~2GB of
|
|||
# OS X deployment
|
||||
option(OPENMW_OSX_DEPLOYMENT OFF)
|
||||
|
||||
if (CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
if (OPENMW_MSBUILD_COMPILER_OVERRIDE)
|
||||
if (NOT IS_ABSOLUTE OPENMW_MSBUILD_COMPILER_OVERRIDE)
|
||||
find_program(OPENMW_MSBUILD_COMPILER_OVERRIDE_PATH "${OPENMW_MSBUILD_COMPILER_OVERRIDE}")
|
||||
else()
|
||||
set(OPENMW_MSBUILD_COMPILER_OVERRIDE_PATH OPENMW_MSBUILD_COMPILER_OVERRIDE)
|
||||
endif()
|
||||
if (DEFINED ENV{ChocolateyInstall})
|
||||
# if Chocolatey's installed, it's relatively likely that the command's a shim and won't work if copied
|
||||
# it's safer to shim it
|
||||
execute_process(COMMAND "$ENV{ChocolateyInstall}/tools/shimgen.exe" -p "${OPENMW_MSBUILD_COMPILER_OVERRIDE_PATH}" -o "${CMAKE_BINARY_DIR}/cl.exe" -c cl.exe)
|
||||
else()
|
||||
file(COPY_FILE "${OPENMW_MSBUILD_COMPILER_OVERRIDE_PATH}" "${CMAKE_BINARY_DIR}/cl.exe" ONLY_IF_DIFFERENT)
|
||||
endif()
|
||||
|
||||
list(APPEND CMAKE_VS_GLOBALS
|
||||
"CLToolPath=${CMAKE_BINARY_DIR}"
|
||||
"UseMultiToolTask=true"
|
||||
"TrackFileAccess=false"
|
||||
)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if (MSVC)
|
||||
option(OPENMW_MP_BUILD "Build OpenMW with /MP flag" OFF)
|
||||
if (OPENMW_MP_BUILD)
|
||||
|
|
@ -185,16 +208,16 @@ if (MSVC)
|
|||
|
||||
add_compile_options(/Zc:__cplusplus)
|
||||
|
||||
if (CMAKE_CXX_COMPILER_LAUNCHER OR CMAKE_C_COMPILER_LAUNCHER)
|
||||
if (CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
if (CMAKE_CXX_COMPILER_LAUNCHER OR CMAKE_C_COMPILER_LAUNCHER OR OPENMW_MSBUILD_COMPILER_OVERRIDE)
|
||||
if ((CMAKE_CXX_COMPILER_LAUNCHER OR CMAKE_C_COMPILER_LAUNCHER) AND CMAKE_GENERATOR MATCHES "Visual Studio")
|
||||
message(STATUS "A compiler launcher was specified, but will be unused by the current generator (${CMAKE_GENERATOR})")
|
||||
else()
|
||||
foreach (config_lower ${CMAKE_CONFIGURATION_TYPES})
|
||||
string(TOUPPER "${config_lower}" config)
|
||||
if (CMAKE_C_COMPILER_LAUNCHER STREQUAL "ccache")
|
||||
if (CMAKE_C_COMPILER_LAUNCHER STREQUAL "ccache" OR OPENMW_MSBUILD_COMPILER_OVERRIDE STREQUAL "ccache")
|
||||
string(REPLACE "/Zi" "/Z7" CMAKE_C_FLAGS_${config} "${CMAKE_C_FLAGS_${config}}")
|
||||
endif()
|
||||
if (CMAKE_CXX_COMPILER_LAUNCHER STREQUAL "ccache")
|
||||
if (CMAKE_CXX_COMPILER_LAUNCHER STREQUAL "ccache" OR OPENMW_MSBUILD_COMPILER_OVERRIDE STREQUAL "ccache")
|
||||
string(REPLACE "/Zi" "/Z7" CMAKE_CXX_FLAGS_${config} "${CMAKE_CXX_FLAGS_${config}}")
|
||||
endif()
|
||||
endforeach()
|
||||
|
|
|
|||
Loading…
Reference in a new issue