diff options
author | James McCoy <jamessan@jamessan.com> | 2021-12-21 18:49:55 -0500 |
---|---|---|
committer | Dundar Göc <gocdundar@gmail.com> | 2022-02-20 10:18:45 +0100 |
commit | 2550212b25f313c781ac048757b6969c920cd78f (patch) | |
tree | 4fd7f79590686c7402c92e9e9c1a1e846d576e55 | |
parent | 921162a4b1d4c3e3948e1e4ffa960cbdb9e933b7 (diff) | |
download | rneovim-2550212b25f313c781ac048757b6969c920cd78f.tar.gz rneovim-2550212b25f313c781ac048757b6969c920cd78f.tar.bz2 rneovim-2550212b25f313c781ac048757b6969c920cd78f.zip |
ci(win): use vswhere to automatically setup required vsdev env vars
-rw-r--r-- | ci/build.ps1 | 15 |
1 files changed, 10 insertions, 5 deletions
diff --git a/ci/build.ps1 b/ci/build.ps1 index ba80251013..0953a708c8 100644 --- a/ci/build.ps1 +++ b/ci/build.ps1 @@ -80,6 +80,16 @@ elseif ($compiler -eq 'MSVC') { $cmakeGenerator = 'Visual Studio 16 2019' } +if ($compiler -eq 'MSVC') { + $installationPath = vswhere.exe -latest -requires Microsoft.VisualStudio.Component.VC.Tools.x86.x64 -property installationPath + if ($installationPath -and (test-path "$installationPath\Common7\Tools\vsdevcmd.bat")) { + & "${env:COMSPEC}" /s /c "`"$installationPath\Common7\Tools\vsdevcmd.bat`" -arch=x${bits} -no_logo && set" | foreach-object { + $name, $value = $_ -split '=', 2 + set-content env:\"$name" $value + } + } +} + if (-not $NoTests) { python -m ensurepip python -m pip install pynvim ; exitIfFailed @@ -94,11 +104,6 @@ if (-not $NoTests) { npm.cmd link neovim } -if ($compiler -eq 'MSVC') { - # Required for LuaRocks (https://github.com/luarocks/luarocks/issues/1039#issuecomment-507296940). - $env:VCINSTALLDIR = "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/16.11.31729/" -} - function convertToCmakeArgs($vars) { return $vars.GetEnumerator() | foreach { "-D$($_.Key)=$($_.Value)" } } |