summaryrefslogtreecommitdiff
path: root/build.cmd
diff options
context:
space:
mode:
authorJacek Blaszczynski <biosciencenow@outlook.com>2017-10-16 23:56:59 +0200
committerDan Moseley <danmose@microsoft.com>2017-10-16 14:56:59 -0700
commita1142be0e2cfc8b98168761beeb5f97e4f865b63 (patch)
treef56ac417a3db519313cc775c1f9d0d4bba067658 /build.cmd
parenta78940216170cdf5f9b97ccbf6edaca2ac0758c9 (diff)
downloadcoreclr-a1142be0e2cfc8b98168761beeb5f97e4f865b63.tar.gz
coreclr-a1142be0e2cfc8b98168761beeb5f97e4f865b63.tar.bz2
coreclr-a1142be0e2cfc8b98168761beeb5f97e4f865b63.zip
Optimize native build of coreclr repo - 3x less memory , 11% build time improvement (#14509)
* Fix native build overparallelism * Fix native build parallelization problems * Allow overriding all build workaround parameters * Fix cleanup ommisions and local environment variable naming * Address code review feedback * Fix nul spelling and add standard message prefix * Simplify settings for CL compiler parallelism * Address code review feedback - remove whitespace
Diffstat (limited to 'build.cmd')
-rw-r--r--build.cmd16
1 files changed, 13 insertions, 3 deletions
diff --git a/build.cmd b/build.cmd
index 69597eb003..3a0de8c808 100644
--- a/build.cmd
+++ b/build.cmd
@@ -305,6 +305,16 @@ echo %__MsgPrefix%Checking prerequisites
:: Eval the output from probe-win1.ps1
for /f "delims=" %%a in ('powershell -NoProfile -ExecutionPolicy ByPass "& ""%__SourceDir%\pal\tools\probe-win.ps1"""') do %%a
+REM NumberOfEnabledCore is an WMI property providing number of enabled cores on machine
+REM processor(s) and later is used to set optimal level of CL paralellism during native build step
+if not defined NumberOfEnabledCore (
+REM Determine number of physical processor cores available on machine
+for /f "tokens=*" %%I in (
+ 'wmic cpu get NumberOfEnabledCore /value ^| find "=" 2^>NUL'
+ ) do set %%I
+)
+echo %__MsgPrefix%Number of available CPU cores %NumberOfEnabledCore%
+
REM =========================================================================================
REM ===
REM === Start the build steps
@@ -415,7 +425,7 @@ if %__BuildNative% EQU 1 (
set __MsbuildWrn=/flp1:WarningsOnly;LogFile=!__BuildWrn!
set __MsbuildErr=/flp2:ErrorsOnly;LogFile=!__BuildErr!
- @call %__ProjectDir%\run.cmd build -Project=%__IntermediatesDir%\install.vcxproj -MsBuildLog=!__MsbuildLog! -MsBuildWrn=!__MsbuildWrn! -MsBuildErr=!__MsbuildErr! -configuration=%__BuildType% %nativePlatfromArgs% %__RunArgs% %__UnprocessedBuildArgs%
+ @call %__ProjectDir%\run.cmd build -Project=%__IntermediatesDir%\install.vcxproj -MsBuildLog=!__MsbuildLog! -MsBuildWrn=!__MsbuildWrn! -MsBuildErr=!__MsbuildErr! -configuration=%__BuildType% %nativePlatfromArgs% %__RunArgs% -ExtraParameters="/p:ForceImportBeforeCppTargets=%__ProjectDir%/clr.nativebuild.props /m:2" %__UnprocessedBuildArgs%
if not !errorlevel! == 0 (
echo %__MsgPrefix%Error: native component build failed. Refer to the build log files for details:
@@ -485,9 +495,9 @@ if /i "%__DoCrossArchBuild%"=="1" (
set __MsbuildWrn=/flp1:WarningsOnly;LogFile=!__BuildWrn!
set __MsbuildErr=/flp2:ErrorsOnly;LogFile=!__BuildErr!
- @call %__ProjectDir%\run.cmd build -Project=%__CrossCompIntermediatesDir%\install.vcxproj -configuration=%__BuildType% -platform=%__CrossArch% -MsBuildLog=!__MsbuildLog! -MsBuildWrn=!__MsbuildWrn! -MsBuildErr=!__MsbuildErr! %__RunArgs% %__UnprocessedBuildArgs%
+ @call %__ProjectDir%\run.cmd build -Project=%__CrossCompIntermediatesDir%\install.vcxproj -configuration=%__BuildType% -platform=%__CrossArch% -MsBuildLog=!__MsbuildLog! -MsBuildWrn=!__MsbuildWrn! -MsBuildErr=!__MsbuildErr! %__RunArgs% -ExtraParameters="/p:ForceImportBeforeCppTargets=%__ProjectDir%/clr.nativebuild.props /m:2" %__UnprocessedBuildArgs%
- if not !errorlevel! == 0 (
+ if not !errorlevel! == 0 (
echo %__MsgPrefix%Error: cross-arch components build failed. Refer to the build log files for details:
echo !__BuildLog!
echo !__BuildWrn!