1
0
Fork 0
mirror of https://github.com/transmission/transmission synced 2025-01-30 19:03:04 +00:00

Speed up Appveyor builds with ccache (#4823)

This commit is contained in:
Mike Gelfand 2023-02-11 16:56:08 +03:00 committed by GitHub
parent 4a3c217069
commit b8e7b15804
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
3 changed files with 37 additions and 0 deletions

View file

@ -183,6 +183,11 @@ if(WIN32)
if(MSVC)
# Reduce noise (at least for now)
set(CMAKE_${L}_FLAGS "${CMAKE_${L}_FLAGS} /wd4244 /wd4267")
# Make caching-friendly (store debug info inside object files)
foreach(T IN ITEMS ${CMAKE_CONFIGURATION_TYPES} ${CMAKE_BUILD_TYPE})
string(TOUPPER "${T}" T)
string(REGEX REPLACE "[-/]Z[iI]" "-Z7" CMAKE_${L}_FLAGS_${T} "${CMAKE_${L}_FLAGS_${T}}")
endforeach()
endif()
if(MINGW)

View file

@ -27,6 +27,13 @@ for:
clone_folder: '%SystemDrive%\%TR_ARCH%-project'
cache:
- '%SystemDrive%\%TR_ARCH%-ccache'
init:
- pwsh: |
$Env:APPVEYOR_SAVE_CACHE_ON_ERROR = 'true'
install:
- pwsh: |
$Version = git describe --tags --abbrev=10 --always
@ -47,6 +54,7 @@ for:
choco install nasm
choco install jom
choco install wixtoolset --version 3.11.2
choco install ccache
Remove-Item -Path (Join-Path $Env:SystemDrive OpenSSL-Win32) -Recurse
Remove-Item -Path (Join-Path $Env:SystemDrive OpenSSL-Win64) -Recurse
@ -62,12 +70,16 @@ for:
$Env:PATH
) -join [System.IO.Path]::PathSeparator
$Env:CCACHE_DIR = "${Env:SystemDrive}\${Env:TR_ARCH}-ccache"
$Env:CCACHE_MAXSIZE = '500Mi'
Set-ExecutionPolicy -Scope Process Bypass
try {
& (Join-Path $Env:APPVEYOR_BUILD_FOLDER release windows main.ps1) `
-Mode Build `
-BuildArch $env:TR_ARCH `
-CCachePart App `
-PackDebugSyms:$($Env:APPVEYOR_REPO_BRANCH -eq "main" -or $Env:APPVEYOR_REPO_TAG -eq "true")
} catch {
Write-Error ("{1}{0}{2}{0}{3}" -f [Environment]::NewLine, $_.ToString(), $_.InvocationInfo.PositionMessage, $_.ScriptStackTrace) -ErrorAction Continue

View file

@ -13,6 +13,10 @@ Param(
[ValidateSet('All', 'Deps', 'App')]
[string] $BuildPart = 'All',
[Parameter()]
[ValidateSet('None', 'All', 'Deps', 'App')]
[string] $CCachePart = 'None',
[Parameter()]
[string] $SourceDir,
@ -266,6 +270,14 @@ if ($Mode -eq 'Build') {
$env:CXXFLAGS = $CompilerFlags -join ' '
$env:LDFLAGS = $LinkerFlags -join ' '
if (@('All', 'Deps') -contains $CCachePart) {
$Env:CMAKE_C_COMPILER_LAUNCHER = 'ccache'
$Env:CMAKE_CXX_COMPILER_LAUNCHER = 'ccache'
} else {
$Env:CMAKE_C_COMPILER_LAUNCHER = ''
$Env:CMAKE_CXX_COMPILER_LAUNCHER = ''
}
if (@('All', 'Deps') -contains $BuildPart) {
Invoke-Build Expat
Invoke-Build DBus
@ -275,6 +287,14 @@ if ($Mode -eq 'Build') {
Invoke-Build Qt
}
if (@('All', 'App') -contains $CCachePart) {
$Env:CMAKE_C_COMPILER_LAUNCHER = 'ccache'
$Env:CMAKE_CXX_COMPILER_LAUNCHER = 'ccache'
} else {
$Env:CMAKE_C_COMPILER_LAUNCHER = ''
$Env:CMAKE_CXX_COMPILER_LAUNCHER = ''
}
if (@('All', 'App') -contains $BuildPart) {
Invoke-Build Transmission -NoCache -MoreArguments @($SourceDir, $SourceDir, $PackDebugSyms.IsPresent)
}