From 921162a4b1d4c3e3948e1e4ffa960cbdb9e933b7 Mon Sep 17 00:00:00 2001 From: James McCoy Date: Sat, 23 Oct 2021 21:38:58 -0400 Subject: ci: bump Windows image to windows-2019 The VS 2019 CMake generator no longer has different generator types for different architectures. Now, the architecture is specified via CMake's `-A` switch. However, this requires we also propagate `${CMAKE_GENERATOR_PLATFORM}` to the bundled deps, so they build for the same architecture as Nvim. --- ci/build.ps1 | 29 ++++++++++++++++++++--------- 1 file changed, 20 insertions(+), 9 deletions(-) (limited to 'ci') diff --git a/ci/build.ps1 b/ci/build.ps1 index ef5ba3bf2d..ba80251013 100644 --- a/ci/build.ps1 +++ b/ci/build.ps1 @@ -77,12 +77,7 @@ if ($compiler -eq 'MINGW') { } elseif ($compiler -eq 'MSVC') { $cmakeGeneratorArgs = '/verbosity:normal' - if ($bits -eq 32) { - $cmakeGenerator = 'Visual Studio 15 2017' - } - elseif ($bits -eq 64) { - $cmakeGenerator = 'Visual Studio 15 2017 Win64' - } + $cmakeGenerator = 'Visual Studio 16 2019' } if (-not $NoTests) { @@ -101,7 +96,7 @@ if (-not $NoTests) { 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/2017/Community/VC/Tools/MSVC/14.16.27023/" + $env:VCINSTALLDIR = "C:/Program Files (x86)/Microsoft Visual Studio/2019/Enterprise/VC/Tools/MSVC/16.11.31729/" } function convertToCmakeArgs($vars) { @@ -109,14 +104,30 @@ function convertToCmakeArgs($vars) { } cd $env:DEPS_BUILD_DIR -cmake -G $cmakeGenerator $(convertToCmakeArgs($depsCmakeVars)) "$buildDir/third-party/" ; exitIfFailed +if ($compiler -eq 'MSVC') { + if ($bits -eq 32) { + cmake -G $cmakeGenerator -A Win32 $(convertToCmakeArgs($depsCmakeVars)) "$buildDir/third-party/" ; exitIfFailed + } else { + cmake -G $cmakeGenerator -A x64 $(convertToCmakeArgs($depsCmakeVars)) "$buildDir/third-party/" ; exitIfFailed + } +} else { + cmake -G $cmakeGenerator $(convertToCmakeArgs($depsCmakeVars)) "$buildDir/third-party/" ; exitIfFailed +} cmake --build . --config $cmakeBuildType -- $cmakeGeneratorArgs ; exitIfFailed cd $buildDir # Build Neovim mkdir build cd build -cmake -G $cmakeGenerator $(convertToCmakeArgs($nvimCmakeVars)) .. ; exitIfFailed +if ($compiler -eq 'MSVC') { + if ($bits -eq 32) { + cmake -G $cmakeGenerator -A Win32 $(convertToCmakeArgs($nvimCmakeVars)) .. ; exitIfFailed + } else { + cmake -G $cmakeGenerator -A x64 $(convertToCmakeArgs($nvimCmakeVars)) .. ; exitIfFailed + } +} else { + cmake -G $cmakeGenerator $(convertToCmakeArgs($nvimCmakeVars)) .. ; exitIfFailed +} cmake --build . --config $cmakeBuildType -- $cmakeGeneratorArgs ; exitIfFailed .\bin\nvim --version ; exitIfFailed -- cgit From 2550212b25f313c781ac048757b6969c920cd78f Mon Sep 17 00:00:00 2001 From: James McCoy Date: Tue, 21 Dec 2021 18:49:55 -0500 Subject: ci(win): use vswhere to automatically setup required vsdev env vars --- ci/build.ps1 | 15 ++++++++++----- 1 file changed, 10 insertions(+), 5 deletions(-) (limited to 'ci') 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)" } } -- cgit