@@ -15,7 +15,7 @@ if /i "%1"=="/?" goto help
15
15
set config = Release
16
16
set target = Build
17
17
set target_arch = x64
18
- set target_env =
18
+ set target_env = vs2015
19
19
set noprojgen =
20
20
set nobuild =
21
21
set sign =
@@ -53,7 +53,10 @@ if /i "%1"=="clean" set target=Clean&goto arg-ok
53
53
if /i " %1 " == " ia32" set target_arch = x86& goto arg-ok
54
54
if /i " %1 " == " x86" set target_arch = x86& goto arg-ok
55
55
if /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
57
60
if /i " %1 " == " noprojgen" set noprojgen = 1& goto arg-ok
58
61
if /i " %1 " == " nobuild" set nobuild = 1& goto arg-ok
59
62
if /i " %1 " == " nosign" set " sign = " & echo Note: vcbuild no longer signs by default. " nosign" is redundant.& goto arg-ok
@@ -88,7 +91,7 @@ if /i "%1"=="upload" set upload=1&goto arg-ok
88
91
if /i " %1 " == " small-icu" set i18n_arg = %1 & goto arg-ok
89
92
if /i " %1 " == " full-icu" set i18n_arg = %1 & goto arg-ok
90
93
if /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
92
95
if /i " %1 " == " download-all" set download_arg = " --download=all" & goto arg-ok
93
96
if /i " %1 " == " ignore-flaky" set test_args = %test_args% --flaky-tests=dontcare& goto arg-ok
94
97
if /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
149
152
150
153
@ rem Set environment for msbuild
151
154
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
+
152
179
@ rem Look for Visual Studio 2015
180
+ :vs-set-2015
181
+ if " %target_env% " NEQ " vs2015" goto msbuild-not-found
153
182
echo Looking for Visual Studio 2015
154
183
if not defined VS140COMNTOOLS goto msbuild-not-found
155
184
if not exist " %VS140COMNTOOLS% \..\..\vc\vcvarsall.bat" goto msbuild-not-found
@@ -172,7 +201,9 @@ set PLATFORM_TOOLSET=v140
172
201
goto msbuild-found
173
202
174
203
: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" or consult
206
+ echo https://github.com/nodejs/node/blob/master/BUILDING.md#windows-1
176
207
goto exit
177
208
178
209
:wix-not-found
@@ -298,6 +329,7 @@ if not defined SSHCONFIG (
298
329
echo SSHCONFIG is not set for upload
299
330
exit /b 1
300
331
)
332
+
301
333
if not defined STAGINGSERVER set STAGINGSERVER = node-www
302
334
ssh -F %SSHCONFIG% %STAGINGSERVER% " mkdir -p nodejs/%DISTTYPEDIR% /v%FULLVERSION% /win-%target_arch% "
303
335
scp -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.
455
487
goto exit
456
488
457
489
: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]
459
491
echo Examples:
460
492
echo vcbuild.bat : builds release build
461
493
echo vcbuild.bat debug : builds debug build
0 commit comments