mirror of
https://github.com/openai/codex.git
synced 2026-05-14 16:22:51 +00:00
Set explicit Cargo linker in MSVC setup action
This commit is contained in:
16
.github/actions/setup-msvc-env/action.yml
vendored
16
.github/actions/setup-msvc-env/action.yml
vendored
@@ -70,6 +70,7 @@ runs:
|
||||
)
|
||||
|
||||
$envLines = & cmd.exe /c ('"{0}" -no_logo -arch={1} -host_arch={2} >nul && set' -f $vsDevCmd, $targetArch, $hostArch)
|
||||
$vcToolsInstallDir = $null
|
||||
foreach ($line in $envLines) {
|
||||
if ($line -notmatch "^(.*?)=(.*)$") {
|
||||
continue
|
||||
@@ -81,6 +82,21 @@ runs:
|
||||
if ($name -ieq "Path") {
|
||||
$name = "PATH"
|
||||
}
|
||||
if ($name -eq "VCToolsInstallDir") {
|
||||
$vcToolsInstallDir = $value
|
||||
}
|
||||
"$name=$value" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||
}
|
||||
}
|
||||
|
||||
if (-not $vcToolsInstallDir) {
|
||||
throw "VCToolsInstallDir was not exported by VsDevCmd.bat"
|
||||
}
|
||||
|
||||
$linker = Join-Path $vcToolsInstallDir "bin\Host${hostArch}\${targetArch}\link.exe"
|
||||
if (-not (Test-Path $linker)) {
|
||||
throw "MSVC linker not found at $linker"
|
||||
}
|
||||
|
||||
$cargoTarget = "${{ inputs.target }}".ToUpperInvariant().Replace("-", "_")
|
||||
"CARGO_TARGET_${cargoTarget}_LINKER=$linker" | Out-File -FilePath $env:GITHUB_ENV -Encoding utf8 -Append
|
||||
|
||||
Reference in New Issue
Block a user