gitlab-ci: Use a specific MSVC version on Windows

Teach jobs to load the environment for a specific MSVC version, and tag
them accordingly.  This allows runners to have multiple versions of MSVC
installed without requiring us to compile on the newer ones right away.

The runners provide the VS 2019 location in a `VS160COMNTOOLS`
environment variable.  Use it to avoid requiring a specific VS edition.

Issue: #595
This commit is contained in:
Brad King 2021-02-04 12:50:40 -05:00
parent 2861513abf
commit 469d57b415
3 changed files with 23 additions and 17 deletions

@ -1,14 +0,0 @@
$tempFile = "$env:temp\vcvars.txt"
if ($env:CI_JOB_NAME -eq "build:windows_vs2019") {
cmd.exe /c "call `"C:\Program Files (x86)\Microsoft Visual Studio\2019\Community\VC\Auxiliary\Build\vcvars64.bat`" && set > $tempFile"
} else {
cmd.exe /c "call `"C:\Program Files (x86)\Microsoft Visual Studio\2017\Community\VC\Auxiliary\Build\vcvars64.bat`" && set > $tempFile"
}
Get-Content "$tempFile" | Foreach-Object {
if ($_ -match "^(.*?)=(.*)$") {
Set-Content "env:\$($matches[1])" $matches[2]
}
}

@ -0,0 +1,9 @@
$erroractionpreference = "stop"
cmd /c "`"$env:VCVARSALL`" $VCVARSPLATFORM -vcvars_ver=$VCVARSVERSION & set" |
foreach {
if ($_ -match "=") {
$v = $_.split("=")
[Environment]::SetEnvironmentVariable($v[0], $v[1])
}
}

@ -4,7 +4,7 @@
timeout: 2 hours
interruptible: true
before_script:
- .gitlab/ci/config/setup_vs_powershell.ps1
- Invoke-Expression -Command .gitlab/ci/config/vcvarsall.ps1
- "cmake --version"
- "cmake -V -P .gitlab/ci/config/gitlab_ci_setup.cmake"
- "ctest -VV -S .gitlab/ci/ctest_configure.cmake"
@ -43,7 +43,7 @@
timeout: 50 minutes
interruptible: true
before_script:
- .gitlab/ci/config/setup_vs_powershell.ps1
- Invoke-Expression -Command .gitlab/ci/config/vcvarsall.ps1
script:
#Need to use our custom ctest-latest symlink
#This will allow us to use 3.17+ which has support
@ -51,6 +51,12 @@
#due to system load are not reported
- "ctest-latest -VV -S .gitlab/ci/ctest_test.cmake"
.windows_vs2019:
variables:
VCVARSALL: "${VS160COMNTOOLS}\\..\\..\\VC\\Auxiliary\\Build\\vcvarsall.bat"
VCVARSPLATFORM: "x64"
VCVARSVERSION: "14.25"
# Build on windows10 with Visual Studio
# Will have CUDA 10.2 once build issues are resolved
build:windows_vs2019:
@ -58,10 +64,12 @@ build:windows_vs2019:
- vtkm # Since this is a bare runner, pin to a project.
- build
- windows
- vs2019
- shell
- vs2019
- msvc-19.25
- large-memory
extends:
- .windows_vs2019
- .cmake_build_windows
- .only-default
variables:
@ -77,9 +85,12 @@ test:windows_vs2019:
- test
- windows
- shell
- vs2019
- msvc-19.25
- cuda-rt
- turing
extends:
- .windows_vs2019
- .cmake_test_windows
- .only-default
dependencies: