Skip to content

Commit e04d058

Browse files
targosMylesBorins
authored andcommitted
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: #27214 PR-URL: #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>
1 parent e110d81 commit e04d058

2 files changed

Lines changed: 37 additions & 36 deletions

File tree

‎BUILDING.md‎

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -498,9 +498,9 @@ $ backtrace
498498

499499
*[Python 2.7](https://www.python.org/downloads/)
500500
* The "Desktop development with C++" workload from
501-
[Visual Studio 2017](https://www.visualstudio.com/downloads/) or the
502-
"Visual C++ build tools" workload from the
503-
[Build Tools](https://www.visualstudio.com/downloads/#build-tools-for-visual-studio-2017),
501+
[Visual Studio 2017 or 2019](https://visualstudio.microsoft.com/downloads/) or
502+
the "Visual C++ build tools" workload from the
503+
[Build Tools](https://visualstudio.microsoft.com/downloads/#build-tools-for-visual-studio-2019),
504504
with the default optional components.
505505
* Basic Unix tools required for some tests,
506506
[Git for Windows](https://git-scm.com/download/win) includes Git Bash
@@ -513,7 +513,8 @@ $ backtrace
513513
Optional requirements to build the MSI installer package:
514514

515515
* The [WiX Toolset v3.11](https://wixtoolset.org/releases/) and the
516-
[Wix Toolset Visual Studio 2017 Extension](https://marketplace.visualstudio.com/items?itemName=RobMensching.WixToolsetVisualStudio2017Extension).
516+
[Wix Toolset Visual Studio 2017 Extension](https://marketplace.visualstudio.com/items?itemName=RobMensching.WixToolsetVisualStudio2017Extension)
517+
or the [Wix Toolset Visual Studio 2019 Extension](https://marketplace.visualstudio.com/items?itemName=WixToolset.WixToolsetVisualStudio2019Extension).
517518

518519
Optional requirements for compiling for Windows 10 on ARM (ARM64):
519520

‎vcbuild.bat‎

Lines changed: 32 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -236,61 +236,61 @@ if %target_arch%==x64 if %msvs_host_arch%==amd64 set vcvarsall_arg=amd64
236236
@rem also if both are x86
237237
if%target_arch%==x86 if%msvs_host_arch%==x86 setvcvarsall_arg=x86
238238

239-
@rem Look for Visual Studio 2017
240-
:vs-set-2017
241-
ifdefined target_env if"%target_env%"NEQ"vs2017"goto vs-set-2019
242-
echo Looking for Visual Studio 2017
243-
call tools\msvs\vswhere_usability_wrapper.cmd "[15.0,16.0)"
244-
if"_%VCINSTALLDIR%_"=="__"gotomsbuild-not-found
239+
@rem Look for Visual Studio 2019
240+
:vs-set-2019
241+
ifdefined target_env if"%target_env%"NEQ"vs2019"goto vs-set-2017
242+
echo Looking for Visual Studio 2019
243+
call tools\msvs\vswhere_usability_wrapper.cmd "[16.0,17.0)"
244+
if"_%VCINSTALLDIR%_"=="__"gotovs-set-2017
245245
ifdefined msi (
246-
echo Looking for WiX installation for Visual Studio 2017...
246+
echo Looking for WiX installation for Visual Studio 2019...
247247
ifnotexist"%WIX%\SDK\VS2017" (
248-
echo Failed to find WiX install for Visual Studio 2017
249-
echoVS2017 support for WiX is only present starting at version 3.11
250-
gotomsbuild-not-found
248+
echo Failed to find WiX install for Visual Studio 2019
249+
echoVS2019 support for WiX is only present starting at version 3.11
250+
gotovs-set-2017
251251
)
252252
ifnotexist"%VCINSTALLDIR%\..\MSBuild\Microsoft\WiX" (
253-
echo Failed to find the WiX Toolset Visual Studio 2017 Extension
254-
gotomsbuild-not-found
253+
echo Failed to find the WiX Toolset Visual Studio 2019 Extension
254+
gotovs-set-2017
255255
)
256256
)
257-
@rem check if VS2017 is already setup, and for the requested arch
258-
if"_%VisualStudioVersion%_"=="_15.0_"if"_%VSCMD_ARG_TGT_ARCH%_"=="_%target_arch%_"gotofound_vs2017
257+
@rem check if VS2019 is already setup, and for the requested arch
258+
if"_%VisualStudioVersion%_"=="_16.0_"if"_%VSCMD_ARG_TGT_ARCH%_"=="_%target_arch%_"gotofound_vs2019
259259
@rem need to clear VSINSTALLDIR for vcvarsall to work as expected
260260
set"VSINSTALLDIR="
261261
@rem prevent VsDevCmd.bat from changing the current working directory
262262
set"VSCMD_START_DIR=%CD%"
263263
setvcvars_call="%VCINSTALLDIR%\Auxiliary\Build\vcvarsall.bat"%vcvarsall_arg%
264264
echo calling: %vcvars_call%
265265
call%vcvars_call%
266-
iferrorlevel1gotomsbuild-not-found
266+
iferrorlevel1gotovs-set-2017
267267
ifdefined DEBUG_HELPER @ECHOON
268-
:found_vs2017
268+
:found_vs2019
269269
echo Found MSVS version %VisualStudioVersion%
270-
setGYP_MSVS_VERSION=2017
271-
setPLATFORM_TOOLSET=v141
270+
setGYP_MSVS_VERSION=2019
271+
setPLATFORM_TOOLSET=v142
272272
goto msbuild-found
273273

274-
@rem Look for Visual Studio 2019
275-
:vs-set-2019
276-
ifdefined target_env if"%target_env%"NEQ"vs2019"goto msbuild-not-found
277-
echo Looking for Visual Studio 2019
278-
call tools\msvs\vswhere_usability_wrapper.cmd "[16.0,17.0)"
274+
@rem Look for Visual Studio 2017
275+
:vs-set-2017
276+
ifdefined target_env if"%target_env%"NEQ"vs2017"goto msbuild-not-found
277+
echo Looking for Visual Studio 2017
278+
call tools\msvs\vswhere_usability_wrapper.cmd "[15.0,16.0)"
279279
if"_%VCINSTALLDIR%_"=="__"goto msbuild-not-found
280280
ifdefined msi (
281-
echo Looking for WiX installation for Visual Studio 2019...
281+
echo Looking for WiX installation for Visual Studio 2017...
282282
ifnotexist"%WIX%\SDK\VS2017" (
283-
echo Failed to find WiX install for Visual Studio 2019
284-
echoVS2019 support for WiX is only present starting at version 3.11
283+
echo Failed to find WiX install for Visual Studio 2017
284+
echoVS2017 support for WiX is only present starting at version 3.11
285285
goto msbuild-not-found
286286
)
287287
ifnotexist"%VCINSTALLDIR%\..\MSBuild\Microsoft\WiX" (
288-
echo Failed to find the WiX Toolset Visual Studio 2019 Extension
288+
echo Failed to find the WiX Toolset Visual Studio 2017 Extension
289289
goto msbuild-not-found
290290
)
291291
)
292-
@rem check if VS2019 is already setup, and for the requested arch
293-
if"_%VisualStudioVersion%_"=="_16.0_"if"_%VSCMD_ARG_TGT_ARCH%_"=="_%target_arch%_"gotofound_vs2019
292+
@rem check if VS2017 is already setup, and for the requested arch
293+
if"_%VisualStudioVersion%_"=="_15.0_"if"_%VSCMD_ARG_TGT_ARCH%_"=="_%target_arch%_"gotofound_vs2017
294294
@rem need to clear VSINSTALLDIR for vcvarsall to work as expected
295295
set"VSINSTALLDIR="
296296
@rem prevent VsDevCmd.bat from changing the current working directory
@@ -300,10 +300,10 @@ echo calling: %vcvars_call%
300300
call%vcvars_call%
301301
iferrorlevel1goto msbuild-not-found
302302
ifdefined DEBUG_HELPER @ECHOON
303-
:found_vs2019
303+
:found_vs2017
304304
echo Found MSVS version %VisualStudioVersion%
305-
setGYP_MSVS_VERSION=2019
306-
setPLATFORM_TOOLSET=v142
305+
setGYP_MSVS_VERSION=2017
306+
setPLATFORM_TOOLSET=v141
307307
goto msbuild-found
308308

309309
:msbuild-not-found

0 commit comments

Comments
 (0)