ci/msvc: Improve msvc init

Now when choose different version of msvc, there is no need rebuild windows-msvc docker

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Reviewed-by: Jesse Natalie <jenatali@microsoft.com>
Part-of: <https://gitlab.freedesktop.org/mesa/mesa/-/merge_requests/26736>
This commit is contained in:
Yonggang Luo
2023-12-20 11:04:43 +08:00
committed by Marge Bot
parent a2595dbf3b
commit c0ad42fe34
5 changed files with 15 additions and 11 deletions

View File

@@ -6,6 +6,7 @@ FROM ${base_image}
COPY mesa_deps_vulkan_sdk.ps1 C:\
RUN C:\mesa_deps_vulkan_sdk.ps1
COPY mesa_init_msvc.ps1 C:\
COPY mesa_deps_build.ps1 C:\
RUN C:\mesa_deps_build.ps1

View File

@@ -18,8 +18,6 @@ RUN C:\mesa_deps_msvc.ps1
COPY mesa_deps_choco.ps1 C:\
RUN C:\mesa_deps_choco.ps1
COPY mesa_init_msvc.ps1 C:\
# Example usage:
# `base_image` should use windows image that can be run with `--isolation=process` option,
# since the resulting container will want to be used that way be later containers in the build process.

View File

@@ -6,5 +6,6 @@ FROM ${base_image}
COPY mesa_deps_vulkan_sdk.ps1 C:\
RUN C:\mesa_deps_vulkan_sdk.ps1
COPY mesa_init_msvc.ps1 C:\
COPY mesa_deps_test.ps1 C:\
RUN C:\mesa_deps_test.ps1

View File

@@ -2,14 +2,14 @@
[Net.ServicePointManager]::SecurityProtocol = [Net.SecurityProtocolType]::Tls12;
# VS16.x is 2019
$msvc_2019_url = 'https://aka.ms/vs/16/release/vs_buildtools.exe'
$msvc_url = 'https://aka.ms/vs/16/release/vs_buildtools.exe'
Write-Host "Downloading Visual Studio 2019 build tools at:"
Get-Date
Write-Host "Downloading Visual Studio 2019 build tools"
Invoke-WebRequest -Uri $msvc_2019_url -OutFile C:\vs_buildtools.exe
Invoke-WebRequest -Uri $msvc_url -OutFile C:\vs_buildtools.exe
Write-Host "Installing Visual Studio 2019 at:"
Get-Date
Write-Host "Installing Visual Studio 2019"
# Command line
# https://docs.microsoft.com/en-us/visualstudio/install/command-line-parameter-examples?view=vs-2019
# Component ids
@@ -36,4 +36,8 @@ if (!$?) {
Exit 1
}
Remove-Item C:\vs_buildtools.exe -Force
Write-Host "Installing Visual Studio 2019 finished at:"
Get-Date
Exit 0

View File

@@ -4,8 +4,8 @@ $vsInstallPath = if ("$vsInstallPath" -eq "" ) { "C:\BuildTools" } else { "$vsI
Write-Output "Final installPath: $vsInstallPath"
Import-Module (Join-Path $vsInstallPath "Common7\Tools\Microsoft.VisualStudio.DevShell.dll")
# https://en.wikipedia.org/wiki/Microsoft_Visual_C%2B%2B
# VS2015 14.0
# VS2017 14.16
# VS2019 14.29
# VS2022 14.32
Enter-VsDevShell -VsInstallPath $vsInstallPath -SkipAutomaticLocation -DevCmdArguments '-vcvars_ver=14.29 -arch=x64 -no_logo -host_arch=amd64'
# VS2015 14.0 use -vcvars_ver=14.0
# VS2017 14.1 to 14.16 use -vcvars_ver=14.16
# VS2019 14.20 to 14.29 use -vcvars_ver=14.29
# VS2022 14.30 to 14.38 (not finished yet) use -vcvars_ver=14 to choose the newest version
Enter-VsDevShell -VsInstallPath $vsInstallPath -SkipAutomaticLocation -DevCmdArguments '-vcvars_ver=14 -arch=x64 -no_logo -host_arch=amd64'