summaryrefslogtreecommitdiff
path: root/vcbuild.bat
diff options
context:
space:
mode:
authorJoão Reis <reis@janeasystems.com>2017-04-04 21:01:24 +0100
committerJoão Reis <reis@janeasystems.com>2017-04-11 11:24:40 +0100
commit6cfedf0481c3a35b6a1d501104288f31a0e5445c (patch)
treea9eb6812c3552a84bde1d01c5c6b62163317d8c0 /vcbuild.bat
parenteb49d596b4fb910093ae59387b4a2dfc6d0bdd4a (diff)
downloadnode-new-6cfedf0481c3a35b6a1d501104288f31a0e5445c.tar.gz
build,win: limit maxcpucount to 2 for MSBuild
MSBuild invokes cl.exe with /MP (set in common.gypi), making it compile sources in parallel using a number of internal processes equal to the number of effective processors. MSBuild /m uses a similar mechanism, so the number of compiler processes can grow to the number of effective processors squared. This limits MSBuild to 2 processes, to still use some parallelization while requiring less memory. Cl.exe is still invoked with /MP, thus the maximum number of processes is limited to twice the number of effective processors. PR-URL: https://github.com/nodejs/node/pull/12184 Reviewed-By: Refael Ackermann <refack@gmail.com> Reviewed-By: Ben Noordhuis <info@bnoordhuis.nl>
Diffstat (limited to 'vcbuild.bat')
-rw-r--r--vcbuild.bat4
1 files changed, 3 insertions, 1 deletions
diff --git a/vcbuild.bat b/vcbuild.bat
index 985b7f1fcc..98260a9db0 100644
--- a/vcbuild.bat
+++ b/vcbuild.bat
@@ -190,9 +190,11 @@ echo Project files generated.
if defined nobuild goto sign
@rem Build the sln with msbuild.
+set "msbcpu=/m:2"
+if "%NUMBER_OF_PROCESSORS%"=="1" set "msbcpu=/m:1"
set "msbplatform=Win32"
if "%target_arch%"=="x64" set "msbplatform=x64"
-msbuild node.sln /m /t:%target% /p:Configuration=%config% /p:Platform=%msbplatform% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo
+msbuild node.sln %msbcpu% /t:%target% /p:Configuration=%config% /p:Platform=%msbplatform% /clp:NoSummary;NoItemAndPropertyList;Verbosity=minimal /nologo
if errorlevel 1 goto exit
if "%target%" == "Clean" goto exit