Fix supruious sccache errors

This commit is contained in:
Ashcon Partovi
2024-05-30 14:36:52 -07:00
parent 6a7c35cb52
commit ecfe2a0f1b

View File

@@ -20,8 +20,12 @@ if ($env:VSINSTALLDIR -eq $null) {
}
$vsDir = (& $vswhere -prerelease -latest -property installationPath)
if ($vsDir -eq $null) {
throw "Visual Studio directory not found."
}
$vsDir = Get-ChildItem -Path "C:\Program Files\Microsoft Visual Studio\2022" -Directory
if ($vsDir -eq $null) {
throw "Visual Studio directory not found."
}
$vsDir = $vsDir.FullName;
}
Push-Location $vsDir
try {
$launchps = (Join-Path -Path $vsDir -ChildPath "Common7\Tools\Launch-VsDevShell.ps1")
@@ -45,10 +49,10 @@ $CPUS = if ($env:CPUS) { $env:CPUS } else { (Get-CimInstance -Class Win32_Proces
$CC = "clang-cl"
$CXX = "clang-cl"
$CFLAGS = '/O2'
# $CFLAGS = '/O2 /MT'
$CXXFLAGS = '/O2'
# $CXXFLAGS = '/O2 /MT'
$CFLAGS = '/O2 /Zi'
# $CFLAGS = '/O2 /Zi /MT'
$CXXFLAGS = '/O2 /Zi'
# $CXXFLAGS = '/O2 /Zi /MT'
$CPU_NAME = if ($Baseline) { "nehalem" } else { "haswell" };
@@ -73,6 +77,18 @@ if ($Baseline) {
$CMAKE_FLAGS += "-DUSE_BASELINE_BUILD=ON"
}
if (Get-Command sccache -ErrorAction SilentlyContinue) {
Write-Host "Using sccache"
# Continue with local compiler if sccache has an error
$env:SCCACHE_IGNORE_SERVER_IO_ERROR = "1"
$CMAKE_FLAGS += "-DCMAKE_C_COMPILER_LAUNCHER=sccache"
$CMAKE_FLAGS += "-DCMAKE_CXX_COMPILER_LAUNCHER=sccache"
$CMAKE_FLAGS += "-DCMAKE_MSVC_DEBUG_INFORMATION_FORMAT=Embedded"
$CMAKE_FLAGS += "-DCMAKE_POLICY_CMP0141=NEW"
}
$null = New-Item -ItemType Directory -Force -Path $BUN_DEPS_OUT_DIR
function Run() {
@@ -96,4 +112,4 @@ function Run() {
if ($result -ne 0) {
throw "$command $commandArgs exited with code $result."
}
}
}