build: default Windows build to Visual Studio 2019
Building and testing Node.js with Visual Studio 2019 is now working as expected. Fallback to VS 2017 if VS 2019 was not found. Fixes: https://github.com/nodejs/node/issues/27214 PR-URL: https://github.com/nodejs/node/pull/30022 Reviewed-By: Jiawen Geng <technicalcute@gmail.com> Reviewed-By: Richard Lau <riclau@uk.ibm.com> Reviewed-By: Beth Griggs <Bethany.Griggs@uk.ibm.com>
This commit is contained in:
parent
a4e075f668
commit
b554214249
@ -498,9 +498,9 @@ $ backtrace
|
||||
|
||||
* [Python 2.7](https://www.python.org/downloads/)
|
||||
* The "Desktop development with C++" workload from
|
||||
[Visual Studio 2017](https://www.visualstudio.com/downloads/) or the
|
||||
"Visual C++ build tools" workload from the
|
||||
[Build Tools](https://www.visualstudio.com/downloads/#build-tools-for-visual-studio-2017),
|
||||
[Visual Studio 2017 or 2019](https://visualstudio.microsoft.com/downloads/) or
|
||||
the "Visual C++ build tools" workload from the
|
||||
[Build Tools](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019),
|
||||
with the default optional components.
|
||||
* Basic Unix tools required for some tests,
|
||||
[Git for Windows](https://git-scm.com/download/win) includes Git Bash
|
||||
@ -513,7 +513,8 @@ $ backtrace
|
||||
Optional requirements to build the MSI installer package:
|
||||
|
||||
* The [WiX Toolset v3.11](https://wixtoolset.org/releases/) and the
|
||||
[Wix Toolset Visual Studio 2017 Extension](https://marketplace.visualstudio.com/items?itemName=RobMensching.WixToolsetVisualStudio2017Extension).
|
||||
[Wix Toolset Visual Studio 2017 Extension](https://marketplace.visualstudio.com/items?itemName=RobMensching.WixToolsetVisualStudio2017Extension)
|
||||
or the [Wix Toolset Visual Studio 2019 Extension](https://marketplace.visualstudio.com/items?itemName=WixToolset.WixToolsetVisualStudio2019Extension).
|
||||
|
||||
Optional requirements for compiling for Windows 10 on ARM (ARM64):
|
||||
|
||||
|
72
vcbuild.bat
72
vcbuild.bat
@ -236,9 +236,44 @@ if %target_arch%==x64 if %msvs_host_arch%==amd64 set vcvarsall_arg=amd64
|
||||
@rem also if both are x86
|
||||
if %target_arch%==x86 if %msvs_host_arch%==x86 set vcvarsall_arg=x86
|
||||
|
||||
@rem Look for Visual Studio 2019
|
||||
:vs-set-2019
|
||||
if defined target_env if "%target_env%" NEQ "vs2019" goto vs-set-2017
|
||||
echo Looking for Visual Studio 2019
|
||||
call tools\msvs\vswhere_usability_wrapper.cmd "[16.0,17.0)"
|
||||
if "_%VCINSTALLDIR%_" == "__" goto vs-set-2017
|
||||
if defined msi (
|
||||
echo Looking for WiX installation for Visual Studio 2019...
|
||||
if not exist "%WIX%\SDK\VS2017" (
|
||||
echo Failed to find WiX install for Visual Studio 2019
|
||||
echo VS2019 support for WiX is only present starting at version 3.11
|
||||
goto vs-set-2017
|
||||
)
|
||||
if not exist "%VCINSTALLDIR%\..\MSBuild\Microsoft\WiX" (
|
||||
echo Failed to find the WiX Toolset Visual Studio 2019 Extension
|
||||
goto vs-set-2017
|
||||
)
|
||||
)
|
||||
@rem check if VS2019 is already setup, and for the requested arch
|
||||
if "_%VisualStudioVersion%_" == "_16.0_" if "_%VSCMD_ARG_TGT_ARCH%_"=="_%target_arch%_" goto found_vs2019
|
||||
@rem need to clear VSINSTALLDIR for vcvarsall to work as expected
|
||||
set "VSINSTALLDIR="
|
||||
@rem prevent VsDevCmd.bat from changing the current working directory
|
||||
set "VSCMD_START_DIR=%CD%"
|
||||
set vcvars_call="%VCINSTALLDIR%\Auxiliary\Build\vcvarsall.bat" %vcvarsall_arg%
|
||||
echo calling: %vcvars_call%
|
||||
call %vcvars_call%
|
||||
if errorlevel 1 goto vs-set-2017
|
||||
if defined DEBUG_HELPER @ECHO ON
|
||||
:found_vs2019
|
||||
echo Found MSVS version %VisualStudioVersion%
|
||||
set GYP_MSVS_VERSION=2019
|
||||
set PLATFORM_TOOLSET=v142
|
||||
goto msbuild-found
|
||||
|
||||
@rem Look for Visual Studio 2017
|
||||
:vs-set-2017
|
||||
if defined target_env if "%target_env%" NEQ "vs2017" goto vs-set-2019
|
||||
if defined target_env if "%target_env%" NEQ "vs2017" goto msbuild-not-found
|
||||
echo Looking for Visual Studio 2017
|
||||
call tools\msvs\vswhere_usability_wrapper.cmd "[15.0,16.0)"
|
||||
if "_%VCINSTALLDIR%_" == "__" goto msbuild-not-found
|
||||
@ -271,41 +306,6 @@ set GYP_MSVS_VERSION=2017
|
||||
set PLATFORM_TOOLSET=v141
|
||||
goto msbuild-found
|
||||
|
||||
@rem Look for Visual Studio 2019
|
||||
:vs-set-2019
|
||||
if defined target_env if "%target_env%" NEQ "vs2019" goto msbuild-not-found
|
||||
echo Looking for Visual Studio 2019
|
||||
call tools\msvs\vswhere_usability_wrapper.cmd "[16.0,17.0)"
|
||||
if "_%VCINSTALLDIR%_" == "__" goto msbuild-not-found
|
||||
if defined msi (
|
||||
echo Looking for WiX installation for Visual Studio 2019...
|
||||
if not exist "%WIX%\SDK\VS2017" (
|
||||
echo Failed to find WiX install for Visual Studio 2019
|
||||
echo VS2019 support for WiX is only present starting at version 3.11
|
||||
goto msbuild-not-found
|
||||
)
|
||||
if not exist "%VCINSTALLDIR%\..\MSBuild\Microsoft\WiX" (
|
||||
echo Failed to find the WiX Toolset Visual Studio 2019 Extension
|
||||
goto msbuild-not-found
|
||||
)
|
||||
)
|
||||
@rem check if VS2019 is already setup, and for the requested arch
|
||||
if "_%VisualStudioVersion%_" == "_16.0_" if "_%VSCMD_ARG_TGT_ARCH%_"=="_%target_arch%_" goto found_vs2019
|
||||
@rem need to clear VSINSTALLDIR for vcvarsall to work as expected
|
||||
set "VSINSTALLDIR="
|
||||
@rem prevent VsDevCmd.bat from changing the current working directory
|
||||
set "VSCMD_START_DIR=%CD%"
|
||||
set vcvars_call="%VCINSTALLDIR%\Auxiliary\Build\vcvarsall.bat" %vcvarsall_arg%
|
||||
echo calling: %vcvars_call%
|
||||
call %vcvars_call%
|
||||
if errorlevel 1 goto msbuild-not-found
|
||||
if defined DEBUG_HELPER @ECHO ON
|
||||
:found_vs2019
|
||||
echo Found MSVS version %VisualStudioVersion%
|
||||
set GYP_MSVS_VERSION=2019
|
||||
set PLATFORM_TOOLSET=v142
|
||||
goto msbuild-found
|
||||
|
||||
:msbuild-not-found
|
||||
echo Failed to find a suitable Visual Studio installation.
|
||||
echo Try to run in a "Developer Command Prompt" or consult
|
||||
|
Loading…
x
Reference in New Issue
Block a user