Skip to content

Commit

Permalink
build,win: respect VS version for building addons
Browse files Browse the repository at this point in the history
When building in machines with multiple versions of Visual Studio
installed, node-gyp should respect the vs2015/vs2017 arguments passed
to vcbuild.bat instead of relying on its own detection mechanism.

PR-URL: #13911
Reviewed-By: Refael Ackermann <refack@gmail.com>
  • Loading branch information
joaocgreis committed Jun 30, 2017
1 parent e783475 commit c9cf7c2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions vcbuild.bat
Original file line number Diff line number Diff line change
Expand Up @@ -122,6 +122,9 @@ if defined build_release (

:: assign path to node_exe
set "node_exe=%config%\node.exe"
set "node_gyp_exe="%node_exe%" deps\npm\node_modules\node-gyp\bin\node-gyp"
if "%target_env%"=="vs2015" set "node_gyp_exe=%node_gyp_exe% --msvs_version=2015"
if "%target_env%"=="vs2017" set "node_gyp_exe=%node_gyp_exe% --msvs_version=2017"

if "%config%"=="Debug" set configure_flags=%configure_flags% --debug
if defined nosnapshot set configure_flags=%configure_flags% --without-snapshot
Expand Down Expand Up @@ -351,7 +354,7 @@ ssh -F %SSHCONFIG% %STAGINGSERVER% "touch nodejs/%DISTTYPEDIR%/v%FULLVERSION%/no

@rem Build test/gc add-on if required.
if "%build_testgc_addon%"=="" goto build-addons
"%config%\node" deps\npm\node_modules\node-gyp\bin\node-gyp rebuild --directory="%~dp0test\gc" --nodedir="%~dp0."
%node_gyp_exe% rebuild --directory="%~dp0test\gc" --nodedir="%~dp0."
if errorlevel 1 goto build-testgc-addon-failed
goto build-addons

Expand All @@ -376,7 +379,7 @@ if %errorlevel% neq 0 exit /b %errorlevel%
:: building addons
setlocal EnableDelayedExpansion
for /d %%F in (test\addons\*) do (
"%node_exe%" deps\npm\node_modules\node-gyp\bin\node-gyp rebuild ^
%node_gyp_exe% rebuild ^
--directory="%%F" ^
--nodedir="%cd%"
if !errorlevel! neq 0 exit /b !errorlevel!
Expand All @@ -395,7 +398,7 @@ for /d %%F in (test\addons-napi\??_*) do (
)
:: building addons-napi
for /d %%F in (test\addons-napi\*) do (
"%node_exe%" deps\npm\node_modules\node-gyp\bin\node-gyp rebuild ^
%node_gyp_exe% rebuild ^
--directory="%%F" ^
--nodedir="%cd%"
)
Expand Down

0 comments on commit c9cf7c2

Please sign in to comment.