@@ -15,7 +15,7 @@ if /i "%1"=="/?" goto help
1515set  config = Release
1616set  target = Build
1717set  target_arch = x64
18- set  target_env = 
18+ set  target_env = vs2015 
1919set  noprojgen = 
2020set  nobuild = 
2121set  sign = 
@@ -53,7 +53,10 @@ if /i "%1"=="clean"         set target=Clean&goto arg-ok
5353if  /i " %1 " == " ia32" set  target_arch = x86& goto arg-ok
5454if  /i " %1 " == " x86" set  target_arch = x86& goto arg-ok
5555if  /i " %1 " == " x64" set  target_arch = x64& goto arg-ok
56- if  /i " %1 " == " vc2015" set  target_env = vc2015& goto arg-ok
56+ @ rem  args should be vs2017 and vs2015. keeping vc2015 for backward combatibility (undocumented)
57+ if  /i " %1 " == " vc2015" set  target_env = vs2015& goto arg-ok
58+ if  /i " %1 " == " vs2015" set  target_env = vs2015& goto arg-ok
59+ if  /i " %1 " == " vs2017" set  target_env = vs2017& goto arg-ok
5760if  /i " %1 " == " noprojgen" set  noprojgen = 1& goto arg-ok
5861if  /i " %1 " == " nobuild" set  nobuild = 1& goto arg-ok
5962if  /i " %1 " == " nosign" set  " sign = " & echo Note: vcbuild no longer signs by default. " nosign" & goto arg-ok
@@ -88,7 +91,7 @@ if /i "%1"=="upload"        set upload=1&goto arg-ok
8891if  /i " %1 " == " small-icu" set  i18n_arg = %1 & goto arg-ok
8992if  /i " %1 " == " full-icu" set  i18n_arg = %1 & goto arg-ok
9093if  /i " %1 " == " intl-none" set  i18n_arg = %1 & goto arg-ok
91- if  /i " %1 " == " without-intl"     set  i18n_arg = %1 & goto arg-ok
94+ if  /i " %1 " == " without-intl" set  i18n_arg = %1 & goto arg-ok
9295if  /i " %1 " == " download-all" set  download_arg = " --download=all" & goto arg-ok
9396if  /i " %1 " == " ignore-flaky" set  test_args = %test_args%  --flaky-tests=dontcare& goto arg-ok
9497if  /i " %1 " == " enable-vtune" set  enable_vtune_arg = 1& goto arg-ok
@@ -149,7 +152,33 @@ if defined noprojgen if defined nobuild if not defined sign if not defined msi g
149152
150153@ rem  Set environment for msbuild
151154
155+ set  msvs_host_arch = x86
156+ if  _%PROCESSOR_ARCHITECTURE% _== _AMD64_ set  msvs_host_arch = amd64
157+ if  _%PROCESSOR_ARCHITEW6432% _== _AMD64_ set  msvs_host_arch = amd64
158+ @ rem  usualy vcvarsall takes an argument: host + '_' + target
159+ set  vcvarsall_arg = %msvs_host_arch% _%target_arch% 
160+ @ rem  unless both host and taget are x64
161+ if  %target_arch% == x64 if  %msvs_host_arch% == amd64 set  vcvarsall_arg = amd64
162+ 
163+ @ rem  Look for Visual Studio 2017
164+ :vs-set-2017 
165+ if  " %target_env% " NEQ  " vs2017" goto  vs-set-2015
166+ echo  Looking for Visual Studio 2017 
167+ if  " _%VSCMD_ARG_TGT_ARCH% _" == " _%target_arch% _" goto  found_vs2017
168+ call  tools\msvs\vswhere_usability_wrapper.cmd
169+ if  " _%VCINSTALLDIR% _" ==  " __" goto  vs-set-2015
170+ set  vcvars_call = " %VCINSTALLDIR% \Auxiliary\Build\vcvarsall.bat" %vcvarsall_arg% 
171+ echo  calling: %vcvars_call% 
172+ call  %vcvars_call% 
173+ :found_vs2017 
174+ echo  Found MSVS version %VisualStudioVersion% 
175+ set  GYP_MSVS_VERSION = 2017 
176+ set  PLATFORM_TOOLSET = v141
177+ goto  msbuild-found
178+ 
152179@ rem  Look for Visual Studio 2015
180+ :vs-set-2015 
181+ if  " %target_env% " NEQ  " vs2015" goto  msbuild-not-found
153182echo  Looking for Visual Studio 2015 
154183if  not  defined  VS140COMNTOOLS goto  msbuild-not-found
155184if  not  exist  " %VS140COMNTOOLS% \..\..\vc\vcvarsall.bat" goto  msbuild-not-found
@@ -172,7 +201,9 @@ set PLATFORM_TOOLSET=v140
172201goto  msbuild-found
173202
174203:msbuild-not-found 
175- echo  Failed to find Visual Studio installation.
204+ echo  Failed to find a suitable Visual Studio installation.
205+ echo  Try to run in a " Developer Command Prompt" 
206+ echo  https://github.com/nodejs/node/blob/master/BUILDING.md#windows-1
176207goto  exit 
177208
178209:wix-not-found 
@@ -298,6 +329,7 @@ if not defined SSHCONFIG (
298329  echo  SSHCONFIG is not set for upload
299330  exit  /b 1 
300331)
332+ 
301333if  not  defined  STAGINGSERVER set  STAGINGSERVER = node-www
302334ssh  -F %SSHCONFIG%  %STAGINGSERVER%  " mkdir -p nodejs/%DISTTYPEDIR% /v%FULLVERSION% /win-%target_arch% " 
303335scp  -F %SSHCONFIG%  Release\node.exe %STAGINGSERVER% :nodejs/%DISTTYPEDIR% /v%FULLVERSION% /win-%target_arch% /node.exe
@@ -455,7 +487,7 @@ echo Failed to create vc project files.
455487goto  exit 
456488
457489:help 
458- echo  vcbuild.bat [debug/release] [msi] [test-all/test-uv/test-inspector/test-internet/test-pummel/test-simple/test-message] [clean] [noprojgen] [small-icu/full-icu/without-intl] [nobuild] [sign] [x86/x64] [vc2015 ] [download-all] [enable-vtune] [lint/lint-ci]   [no-NODE-OPTIONS]
490+ echo  vcbuild.bat [debug/release] [msi] [test-all/test-uv/test-inspector/test-internet/test-pummel/test-simple/test-message] [clean] [noprojgen] [small-icu/full-icu/without-intl] [nobuild] [sign] [x86/x64] [vs2015/vs2017 ] [download-all] [enable-vtune] [lint/lint-ci] [no-NODE-OPTIONS]
459491echo  Examples:
460492echo    vcbuild.bat                : builds release build
461493echo    vcbuild.bat debug          : builds debug build
0 commit comments