diff options
author | Jacek Blaszczynski <biosciencenow@outlook.com> | 2017-11-04 19:11:25 +0100 |
---|---|---|
committer | Wes Haggard <weshaggard@users.noreply.github.com> | 2017-11-04 11:11:25 -0700 |
commit | 5a01d8a39576f0d07441e4d123a90138f4ae0735 (patch) | |
tree | f1f4f9e4f368181d8ba3d86ff563100157f8eb73 /build.cmd | |
parent | 9345244f8172de638223cd7c1e48a5cd169185eb (diff) | |
download | coreclr-5a01d8a39576f0d07441e4d123a90138f4ae0735.tar.gz coreclr-5a01d8a39576f0d07441e4d123a90138f4ae0735.tar.bz2 coreclr-5a01d8a39576f0d07441e4d123a90138f4ae0735.zip |
[Infrastructure] Use MSBuild v15 extension point to control CL parallelism, abstract MSBuild /maxcpucount switch (#14578)
This commit frees -ExtraParameters and uses MSBuild v15 extension point to control CL compiler parallelism.
If MSBuild 15.0 is available - installed with Visual Studio 2017 - CL parallelism control is achieved by using extension point in Microsoft.Common.props file which allows to include Directory.Build.props - for details see [Microsoft.Common.props] [1] file in MSBuild repo. https://github.com/Microsoft/msbuild/blob/b38e4ceeaaec36c5237ae698041e9b9f18c84876/src/Tasks/Microsoft.Common.props#L36.
MSBuild parallelism is controled via abstracted /maxcpucount command line switch
which now is available as -MSBuildNodeCount pass through run.cmd/run.sh command line
argument with default value equal to /maxcpucount (what defaults to number of logical processors).
This allows to control MSBuild parallelism on all supported platforms.
It is possible to control MSBuild parallelism programatically via MSBuild public
API using MaxNodeCount properties available on the following APIs:
Microsoft.Build.Evaluation.ProjectCollection.MaxNodeCount
Microsoft.Build.Execution.BuildParameters.MaxNodeCount
It's use in current build infrastructure would require creating unnecessary
complexity and was ruled out.
Diffstat (limited to 'build.cmd')
-rw-r--r-- | build.cmd | 10 |
1 files changed, 5 insertions, 5 deletions
@@ -30,7 +30,7 @@ if defined VisualStudioVersion ( goto :Run ) -echo %__MsgPrefix%"Searching for Visual Studio 2017 or 2015 installation" +echo %__MsgPrefix%Searching ^for Visual Studio 2017 or 2015 installation set _VSWHERE="%ProgramFiles(x86)%\Microsoft Visual Studio\Installer\vswhere.exe" if exist %_VSWHERE% ( for /f "usebackq tokens=*" %%i in (`%_VSWHERE% -latest -prerelease -property installationPath`) do set _VSCOMNTOOLS=%%i\Common7\Tools @@ -315,8 +315,8 @@ 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 parallelism during native build step +REM NumberOfCores is an WMI property providing number of physical cores on machine +REM processor(s). It is used to set optimal level of CL parallelism during native build step if not defined NumberOfCores ( REM Determine number of physical processor cores available on machine for /f "tokens=*" %%I in ( @@ -439,7 +439,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% %__NativePlatformArgs% %__RunArgs% -ExtraParameters="/p:ForceImportBeforeCppTargets=%__ProjectDir%/clr.nativebuild.props /m:2" %__UnprocessedBuildArgs% + @call %__ProjectDir%\run.cmd build -Project=%__IntermediatesDir%\install.vcxproj -MsBuildLog=!__MsbuildLog! -MsBuildWrn=!__MsbuildWrn! -MsBuildErr=!__MsbuildErr! -configuration=%__BuildType% %__NativePlatformArgs% %__RunArgs% -MSBuildNodeCount="/m:2" %__UnprocessedBuildArgs% if not !errorlevel! == 0 ( echo %__MsgPrefix%Error: native component build failed. Refer to the build log files for details: @@ -509,7 +509,7 @@ 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% -ExtraParameters="/p:ForceImportBeforeCppTargets=%__ProjectDir%/clr.nativebuild.props /m:2" %__UnprocessedBuildArgs% + @call %__ProjectDir%\run.cmd build -Project=%__CrossCompIntermediatesDir%\install.vcxproj -configuration=%__BuildType% -platform=%__CrossArch% -MsBuildLog=!__MsbuildLog! -MsBuildWrn=!__MsbuildWrn! -MsBuildErr=!__MsbuildErr! %__RunArgs% -MSBuildNodeCount="/m:2" %__UnprocessedBuildArgs% if not !errorlevel! == 0 ( echo %__MsgPrefix%Error: cross-arch components build failed. Refer to the build log files for details: |