summaryrefslogtreecommitdiff
path: root/vcbuild.bat
diff options
context:
space:
mode:
authorRefael Ackermann <refack@gmail.com>2017-04-07 08:53:45 -0400
committerGibson Fahnestock <gibfahn@gmail.com>2017-05-05 10:36:05 +0200
commit1c93e8c94b5d0c304e20b2af3050db0bdc8864d0 (patch)
treed1991e49a9be5f151fa3c4ecbc84120806dfe13f /vcbuild.bat
parentbc05436a891da91211c9bbcff08d43133558a1d6 (diff)
downloadandroid-node-v8-1c93e8c94b5d0c304e20b2af3050db0bdc8864d0.tar.gz
android-node-v8-1c93e8c94b5d0c304e20b2af3050db0bdc8864d0.tar.bz2
android-node-v8-1c93e8c94b5d0c304e20b2af3050db0bdc8864d0.zip
win: make buildable on VS2017
* Set default to `vs2015` since `vs2017` is not CI-green yet * changes vcbuild.bat arg from `vc2015` to `vs2015`/`vs2017` `vc` as in Visual C++ is actually versions 14.0 or 14.10 `vs` as in Visual Studio is 2015 or 2017 Ref: http://lists.boost.org/Archives/boost/2017/03/233597.php 🤦 * keep `vc2015` for backward compatibility but "undocumented" * tools: transplant vswhere wrapper from `msvs-com-helper` Ref: https://github.com/node4good/msvs-com-helper PR-URL: https://github.com/nodejs/node/pull/11852 Reviewed-By: João Reis <reis@janeasystems.com> Reviewed-By: Bartosz Sosnowski <bartosz@janeasystems.com> Reviewed-By: Gibson Fahnestock <gibfahn@gmail.com>
Diffstat (limited to 'vcbuild.bat')
-rw-r--r--vcbuild.bat42
1 files changed, 37 insertions, 5 deletions
diff --git a/vcbuild.bat b/vcbuild.bat
index f0f68e6449..ac2bf7f72a 100644
--- a/vcbuild.bat
+++ b/vcbuild.bat
@@ -15,7 +15,7 @@ if /i "%1"=="/?" goto help
set config=Release
set target=Build
set target_arch=x64
-set target_env=
+set target_env=vs2015
set noprojgen=
set nobuild=
set sign=
@@ -53,7 +53,10 @@ if /i "%1"=="clean" set target=Clean&goto arg-ok
if /i "%1"=="ia32" set target_arch=x86&goto arg-ok
if /i "%1"=="x86" set target_arch=x86&goto arg-ok
if /i "%1"=="x64" set target_arch=x64&goto arg-ok
-if /i "%1"=="vc2015" set target_env=vc2015&goto arg-ok
+@rem args should be vs2017 and vs2015. keeping vc2015 for backward combatibility (undocumented)
+if /i "%1"=="vc2015" set target_env=vs2015&goto arg-ok
+if /i "%1"=="vs2015" set target_env=vs2015&goto arg-ok
+if /i "%1"=="vs2017" set target_env=vs2017&goto arg-ok
if /i "%1"=="noprojgen" set noprojgen=1&goto arg-ok
if /i "%1"=="nobuild" set nobuild=1&goto arg-ok
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
if /i "%1"=="small-icu" set i18n_arg=%1&goto arg-ok
if /i "%1"=="full-icu" set i18n_arg=%1&goto arg-ok
if /i "%1"=="intl-none" set i18n_arg=%1&goto arg-ok
-if /i "%1"=="without-intl" set i18n_arg=%1&goto arg-ok
+if /i "%1"=="without-intl" set i18n_arg=%1&goto arg-ok
if /i "%1"=="download-all" set download_arg="--download=all"&goto arg-ok
if /i "%1"=="ignore-flaky" set test_args=%test_args% --flaky-tests=dontcare&goto arg-ok
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
@rem Set environment for msbuild
+set msvs_host_arch=x86
+if _%PROCESSOR_ARCHITECTURE%_==_AMD64_ set msvs_host_arch=amd64
+if _%PROCESSOR_ARCHITEW6432%_==_AMD64_ set msvs_host_arch=amd64
+@rem usualy vcvarsall takes an argument: host + '_' + target
+set vcvarsall_arg=%msvs_host_arch%_%target_arch%
+@rem unless both host and taget are x64
+if %target_arch%==x64 if %msvs_host_arch%==amd64 set vcvarsall_arg=amd64
+
+@rem Look for Visual Studio 2017
+:vs-set-2017
+if "%target_env%" NEQ "vs2017" goto vs-set-2015
+echo Looking for Visual Studio 2017
+if "_%VSCMD_ARG_TGT_ARCH%_"=="_%target_arch%_" goto found_vs2017
+call tools\msvs\vswhere_usability_wrapper.cmd
+if "_%VCINSTALLDIR%_" == "__" goto vs-set-2015
+set vcvars_call="%VCINSTALLDIR%\Auxiliary\Build\vcvarsall.bat" %vcvarsall_arg%
+echo calling: %vcvars_call%
+call %vcvars_call%
+:found_vs2017
+echo Found MSVS version %VisualStudioVersion%
+set GYP_MSVS_VERSION=2017
+set PLATFORM_TOOLSET=v141
+goto msbuild-found
+
@rem Look for Visual Studio 2015
+:vs-set-2015
+if "%target_env%" NEQ "vs2015" goto msbuild-not-found
echo Looking for Visual Studio 2015
if not defined VS140COMNTOOLS goto msbuild-not-found
if not exist "%VS140COMNTOOLS%\..\..\vc\vcvarsall.bat" goto msbuild-not-found
@@ -172,7 +201,9 @@ set PLATFORM_TOOLSET=v140
goto msbuild-found
:msbuild-not-found
-echo Failed to find Visual Studio installation.
+echo Failed to find a suitable Visual Studio installation.
+echo Try to run in a "Developer Command Prompt" or consult
+echo https://github.com/nodejs/node/blob/master/BUILDING.md#windows-1
goto exit
:wix-not-found
@@ -298,6 +329,7 @@ if not defined SSHCONFIG (
echo SSHCONFIG is not set for upload
exit /b 1
)
+
if not defined STAGINGSERVER set STAGINGSERVER=node-www
ssh -F %SSHCONFIG% %STAGINGSERVER% "mkdir -p nodejs/%DISTTYPEDIR%/v%FULLVERSION%/win-%target_arch%"
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.
goto exit
:help
-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]
+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]
echo Examples:
echo vcbuild.bat : builds release build
echo vcbuild.bat debug : builds debug build