summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJacek Blaszczynski <biosciencenow@outlook.com>2017-11-04 19:11:25 +0100
committerWes Haggard <weshaggard@users.noreply.github.com>2017-11-04 11:11:25 -0700
commit5a01d8a39576f0d07441e4d123a90138f4ae0735 (patch)
treef1f4f9e4f368181d8ba3d86ff563100157f8eb73
parent9345244f8172de638223cd7c1e48a5cd169185eb (diff)
downloadcoreclr-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.
-rw-r--r--CMakeLists.txt2
-rw-r--r--Directory.Build.props (renamed from clr.nativebuild.props)0
-rw-r--r--build.cmd10
-rw-r--r--config.json13
-rw-r--r--crosscomponents.cmake5
-rw-r--r--functions.cmake1
-rw-r--r--src/ToolBox/superpmi/mcs/CMakeLists.txt2
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-collector/CMakeLists.txt2
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-counter/CMakeLists.txt2
-rw-r--r--src/ToolBox/superpmi/superpmi-shim-simple/CMakeLists.txt2
-rw-r--r--src/ToolBox/superpmi/superpmi/CMakeLists.txt2
-rw-r--r--src/dlls/mscordac/CMakeLists.txt2
12 files changed, 27 insertions, 16 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 9a721dcc74..a5f352dd7f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -1,4 +1,4 @@
-# Require at least version 2.8.12 of CMake
+# Verify minimum required version
cmake_minimum_required(VERSION 2.8.12)
if(CMAKE_VERSION VERSION_EQUAL 3.0 OR CMAKE_VERSION VERSION_GREATER 3.0)
diff --git a/clr.nativebuild.props b/Directory.Build.props
index 3efd9a363c..3efd9a363c 100644
--- a/clr.nativebuild.props
+++ b/Directory.Build.props
diff --git a/build.cmd b/build.cmd
index 707b744799..58608c3e47 100644
--- a/build.cmd
+++ b/build.cmd
@@ -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:
diff --git a/config.json b/config.json
index 8fa4f53830..536dd15453 100644
--- a/config.json
+++ b/config.json
@@ -180,6 +180,12 @@
"values": [],
"defaultValue": "/t:GenerateVersionSourceFile /p:GenerateVersionSourceFile=true"
},
+ "MSBuildNodeCount": {
+ "description": "Sets the value of the number of processors available for MSBuild.",
+ "valueType": "passThrough",
+ "values": [],
+ "defaultValue": "/maxcpucount"
+ },
"NativeVersionSourceFile": {
"description": "Provides location for version.cpp",
"valueType": "property",
@@ -508,7 +514,8 @@
"MsBuildEventLogging": "default",
"RestoreDefaultOptimizationDataPackage": "false",
"PortableBuild": "true",
- "UsePartialNGENOptimization": "false"
+ "UsePartialNGENOptimization": "false",
+ "MSBuildNodeCount": "default"
}
}
},
@@ -708,11 +715,11 @@
"msbuild": {
"osSpecific": {
"windows": {
- "defaultParameters": "/nologo /verbosity:minimal /clp:Summary /maxcpucount /nodeReuse:false",
+ "defaultParameters": "/nologo /verbosity:minimal /clp:Summary /nodeReuse:false",
"path": "Tools/msbuild.cmd"
},
"unix": {
- "defaultParameters": "/nologo /verbosity:minimal /clp:Summary /maxcpucount",
+ "defaultParameters": "/nologo /verbosity:minimal /clp:Summary",
"path": "Tools/msbuild.sh"
}
},
diff --git a/crosscomponents.cmake b/crosscomponents.cmake
index 96c477ee34..1e386dcbaf 100644
--- a/crosscomponents.cmake
+++ b/crosscomponents.cmake
@@ -8,8 +8,13 @@ set (CLR_CROSS_COMPONENTS_LIST
if(NOT CLR_CMAKE_PLATFORM_LINUX)
list (APPEND CLR_CROSS_COMPONENTS_LIST
+ mcs
mscordaccore
mscordbi
sos
+ superpmi
+ superpmi-shim-collector
+ superpmi-shim-counter
+ superpmi-shim-simple
)
endif()
diff --git a/functions.cmake b/functions.cmake
index 3fb0e46e68..afa3d6ebf6 100644
--- a/functions.cmake
+++ b/functions.cmake
@@ -266,4 +266,3 @@ function(add_executable_clr)
_add_executable(${ARGV})
add_dependencies(${ARGV0} GeneratedEventingFiles)
endfunction()
-
diff --git a/src/ToolBox/superpmi/mcs/CMakeLists.txt b/src/ToolBox/superpmi/mcs/CMakeLists.txt
index ebacd0761c..0856b6f5e6 100644
--- a/src/ToolBox/superpmi/mcs/CMakeLists.txt
+++ b/src/ToolBox/superpmi/mcs/CMakeLists.txt
@@ -49,7 +49,7 @@ add_precompiled_header(
MCS_SOURCES
)
-add_executable(mcs
+_add_executable(mcs
${MCS_SOURCES}
)
diff --git a/src/ToolBox/superpmi/superpmi-shim-collector/CMakeLists.txt b/src/ToolBox/superpmi/superpmi-shim-collector/CMakeLists.txt
index bcd5c3b24f..3e0df52808 100644
--- a/src/ToolBox/superpmi/superpmi-shim-collector/CMakeLists.txt
+++ b/src/ToolBox/superpmi/superpmi-shim-collector/CMakeLists.txt
@@ -48,7 +48,7 @@ if (WIN32)
list(APPEND SUPERPMI_SHIM_COLLECTOR_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/superpmi-shim-collector.def)
endif (WIN32)
-add_library(superpmi-shim-collector
+_add_library(superpmi-shim-collector
SHARED
${SUPERPMI_SHIM_COLLECTOR_SOURCES}
)
diff --git a/src/ToolBox/superpmi/superpmi-shim-counter/CMakeLists.txt b/src/ToolBox/superpmi/superpmi-shim-counter/CMakeLists.txt
index 3a81b8ad12..232c8d96be 100644
--- a/src/ToolBox/superpmi/superpmi-shim-counter/CMakeLists.txt
+++ b/src/ToolBox/superpmi/superpmi-shim-counter/CMakeLists.txt
@@ -49,7 +49,7 @@ if (WIN32)
list(APPEND SUPERPMI_SHIM_COUNTER_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/superpmi-shim-counter.def)
endif (WIN32)
-add_library(superpmi-shim-counter
+_add_library(superpmi-shim-counter
SHARED
${SUPERPMI_SHIM_COUNTER_SOURCES}
)
diff --git a/src/ToolBox/superpmi/superpmi-shim-simple/CMakeLists.txt b/src/ToolBox/superpmi/superpmi-shim-simple/CMakeLists.txt
index 59f3045709..f37c1d2416 100644
--- a/src/ToolBox/superpmi/superpmi-shim-simple/CMakeLists.txt
+++ b/src/ToolBox/superpmi/superpmi-shim-simple/CMakeLists.txt
@@ -48,7 +48,7 @@ if (WIN32)
list(APPEND SUPERPMI_SHIM_SIMPLE_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/superpmi-shim-simple.def)
endif (WIN32)
-add_library(superpmi-shim-simple
+_add_library(superpmi-shim-simple
SHARED
${SUPERPMI_SHIM_SIMPLE_SOURCES}
)
diff --git a/src/ToolBox/superpmi/superpmi/CMakeLists.txt b/src/ToolBox/superpmi/superpmi/CMakeLists.txt
index 5b9897e02b..bbea80515d 100644
--- a/src/ToolBox/superpmi/superpmi/CMakeLists.txt
+++ b/src/ToolBox/superpmi/superpmi/CMakeLists.txt
@@ -49,7 +49,7 @@ add_precompiled_header(
SUPERPMI_SOURCES
)
-add_executable(superpmi
+_add_executable(superpmi
${SUPERPMI_SOURCES}
)
diff --git a/src/dlls/mscordac/CMakeLists.txt b/src/dlls/mscordac/CMakeLists.txt
index 82582f4def..fba524a405 100644
--- a/src/dlls/mscordac/CMakeLists.txt
+++ b/src/dlls/mscordac/CMakeLists.txt
@@ -60,7 +60,7 @@ endif(CLR_CMAKE_PLATFORM_DARWIN)
# Create object library to enable creation of proper dependency of mscordaccore.exp on mscordac.obj and
# mscordaccore on both the mscordaccore.exp and mscordac.obj.
-add_library(mscordacobj OBJECT mscordac.cpp)
+_add_library(mscordacobj OBJECT mscordac.cpp)
add_library_clr(mscordaccore SHARED ${CLR_DAC_SOURCES} $<TARGET_OBJECTS:mscordacobj>)