windows-miner: prefer the 14.30 toolset libraries and never shadow a loaded cl.exe
Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
This commit is contained in:
parent
8c2441ca9c
commit
9871f9802e
1 changed files with 3 additions and 2 deletions
|
|
@ -93,7 +93,8 @@ function Set-LibFallback {
|
|||
foreach ($pf in @('C:\Program Files', 'C:\Program Files (x86)')) { $vsRoots += Get-ChildItem -Path (Join-Path $pf 'Microsoft Visual Studio') -Directory -Recurse -Depth 3 -Filter 'MSVC' -ErrorAction SilentlyContinue }
|
||||
$msvc = $null
|
||||
foreach ($r in $vsRoots) {
|
||||
$tools = Get-ChildItem -Path $r.FullName -Directory -ErrorAction SilentlyContinue | Sort-Object Name -Descending
|
||||
# Prefer the toolset CUDA accepts (vcvarsVer, 14.30), then the newest one that has the libraries.
|
||||
$tools = Get-ChildItem -Path $r.FullName -Directory -ErrorAction SilentlyContinue | Sort-Object @{Expression={ if ($_.Name.StartsWith($vcvarsVer)) { 0 } else { 1 } }}, @{Expression='Name'; Descending=$true}
|
||||
foreach ($t in $tools) { if (Test-Path (Join-Path $t.FullName 'lib\x64\libcmt.lib')) { $msvc = $t.FullName; break } }
|
||||
if ($msvc) { break }
|
||||
}
|
||||
|
|
@ -104,7 +105,7 @@ function Set-LibFallback {
|
|||
if (-not $msvc -or -not $sdk) { Log "fallback: MSVC lib dir $(if ($msvc) { $msvc } else { 'not found' }), Windows SDK $(if ($sdk) { $sdk } else { 'not found' })"; return $false }
|
||||
$env:LIB = "$msvc\lib\x64;$kits\Lib\$sdk\ucrt\x64;$kits\Lib\$sdk\um\x64;" + $env:LIB
|
||||
$env:INCLUDE = "$msvc\include;$kits\Include\$sdk\ucrt;$kits\Include\$sdk\um;$kits\Include\$sdk\shared;" + $env:INCLUDE
|
||||
$env:PATH = "$msvc\bin\Hostx64\x64;" + $env:PATH
|
||||
if (-not (Get-Command cl.exe -ErrorAction SilentlyContinue)) { $env:PATH = "$msvc\bin\Hostx64\x64;" + $env:PATH } # never shadow an already loaded (14.30) cl.exe
|
||||
Log "fallback MSVC environment set from $msvc and Windows SDK $sdk"
|
||||
return [bool](Get-Command cl.exe -ErrorAction SilentlyContinue)
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in a new issue