From ecfe2a0f1bfbea23337f3284aa475c0785528d9f Mon Sep 17 00:00:00 2001 From: Ashcon Partovi Date: Thu, 30 May 2024 14:36:52 -0700 Subject: [PATCH] Fix supruious sccache errors --- scripts/env.ps1 | 30 +++++++++++++++++++++++------- 1 file changed, 23 insertions(+), 7 deletions(-) diff --git a/scripts/env.ps1 b/scripts/env.ps1 index 90cc0756a1..5f2184290e 100644 --- a/scripts/env.ps1 +++ b/scripts/env.ps1 @@ -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." } -} +} \ No newline at end of file