Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/dotnet/runtime.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
path: root/eng
diff options
context:
space:
mode:
authorJeremy Koritzinsky <jekoritz@microsoft.com>2021-04-05 19:28:04 +0300
committerGitHub <noreply@github.com>2021-04-05 19:28:04 +0300
commit8c2158f9fe12c82cd3c0a7f4150773654bc78aaf (patch)
tree44c037075204154c3e9c841177b2eae1b4177e59 /eng
parentb7a164882573af99eaf200c4b21808ecaf6dbb8c (diff)
Make Ninja the default CMake generator on Windows for the repo (#49715)
Co-authored-by: Juan Hoyos <juan.hoyos@microsoft.com>
Diffstat (limited to 'eng')
-rw-r--r--eng/build.ps118
-rw-r--r--eng/native/configurecompiler.cmake6
-rw-r--r--eng/native/functions.cmake28
-rw-r--r--eng/pipelines/coreclr/templates/build-job.yml10
-rw-r--r--eng/pipelines/global-build.yml15
5 files changed, 35 insertions, 42 deletions
diff --git a/eng/build.ps1 b/eng/build.ps1
index 12d3d00674a..638c1d56c15 100644
--- a/eng/build.ps1
+++ b/eng/build.ps1
@@ -17,6 +17,7 @@ Param(
[ValidateSet("Debug","Release")][string][Alias('lc')]$librariesConfiguration,
[ValidateSet("CoreCLR","Mono")][string][Alias('rf')]$runtimeFlavor,
[switch]$ninja,
+ [switch]$msbuild,
[string]$cmakeargs,
[switch]$pgoinstrument,
[Parameter(ValueFromRemainingArguments=$true)][String[]]$properties
@@ -51,7 +52,7 @@ function Get-Help() {
Write-Host " [Default: Minimal]"
Write-Host " -vs Open the solution with Visual Studio using the locally acquired SDK."
Write-Host " Path or any project or solution name is accepted."
- Write-Host " (Example: -vs Microsoft.CSharp)"
+ Write-Host " (Example: -vs Microsoft.CSharp or -vs CoreCLR.sln)"
Write-Host ""
Write-Host "Actions (defaults to -restore -build):"
@@ -79,7 +80,8 @@ function Get-Help() {
Write-Host "Native build settings:"
Write-Host " -cmakeargs User-settable additional arguments passed to CMake."
- Write-Host " -ninja Use Ninja instead of MSBuild to run the native build."
+ Write-Host " -ninja Use Ninja to drive the native build. (default)"
+ Write-Host " -msbuild Use MSBuild to drive the native build. This is a no-op for Mono."
Write-Host " -pgoinstrument Build the CLR with PGO instrumentation."
Write-Host "Command-line arguments not listed above are passed through to MSBuild."
@@ -133,10 +135,10 @@ if ($vs) {
if ($runtimeConfiguration) {
$configToOpen = $runtimeConfiguration
}
- $vs = Split-Path $PSScriptRoot -Parent | Join-Path -ChildPath "artifacts\obj\coreclr" | Join-Path -ChildPath "windows.$archToOpen.$((Get-Culture).TextInfo.ToTitleCase($configToOpen))" | Join-Path -ChildPath "CoreCLR.sln"
+ $vs = Split-Path $PSScriptRoot -Parent | Join-Path -ChildPath "artifacts\obj\coreclr" | Join-Path -ChildPath "windows.$archToOpen.$((Get-Culture).TextInfo.ToTitleCase($configToOpen))" | Join-Path -ChildPath "ide" | Join-Path -ChildPath "CoreCLR.sln"
if (-Not (Test-Path $vs)) {
$repoRoot = Split-Path $PSScriptRoot -Parent
- Invoke-Expression "& `"$repoRoot/src/coreclr/build-runtime.cmd`" -configureonly -$archToOpen -$configToOpen"
+ Invoke-Expression "& `"$repoRoot/src/coreclr/build-runtime.cmd`" -configureonly -$archToOpen -$configToOpen -msbuild"
if ($lastExitCode -ne 0) {
Write-Error "Failed to generate the CoreCLR solution file."
exit 1
@@ -234,7 +236,9 @@ foreach ($argument in $PSBoundParameters.Keys)
"properties" { $arguments += " " + $properties }
"verbosity" { $arguments += " -$argument " + $($PSBoundParameters[$argument]) }
"cmakeargs" { $arguments += " /p:CMakeArgs=`"$($PSBoundParameters[$argument])`"" }
- "ninja" { $arguments += " /p:Ninja=$($PSBoundParameters[$argument])" }
+ # The -ninja switch is a no-op since Ninja is the default generator on Windows.
+ "ninja" { }
+ "msbuild" { $arguments += " /p:Ninja=false" }
"pgoinstrument" { $arguments += " /p:PgoInstrument=$($PSBoundParameters[$argument])"}
# configuration and arch can be specified multiple times, so they should be no-ops here
"configuration" {}
@@ -276,4 +280,8 @@ if ($failedBuilds.Count -ne 0) {
exit 1
}
+if ($ninja) {
+ Write-Host "The -ninja option has no effect on Windows builds since the Ninja generator is the default generator."
+}
+
exit 0
diff --git a/eng/native/configurecompiler.cmake b/eng/native/configurecompiler.cmake
index 682edf73fc4..2fab8f0b9ac 100644
--- a/eng/native/configurecompiler.cmake
+++ b/eng/native/configurecompiler.cmake
@@ -463,7 +463,11 @@ if (MSVC)
# Compile options for targeting windows
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/nologo>) # Suppress Startup Banner
- add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/W3>) # set warning level to 3
+ # /W3 is added by default by CMake, so remove it
+ string(REPLACE "/W3" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+ string(REPLACE "/W3" "" CMAKE_C_FLAGS "${CMAKE_C_FLAGS}")
+ # set default warning level to 3 but allow targets to override it.
+ add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/W$<GENEX_EVAL:$<IF:$<BOOL:$<TARGET_PROPERTY:MSVC_WARNING_LEVEL>>,$<TARGET_PROPERTY:MSVC_WARNING_LEVEL>,3>>>)
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/WX>) # treat warnings as errors
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/Oi>) # enable intrinsics
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/Oy->) # disable suppressing of the creation of frame pointers on the call stack for quicker function calls
diff --git a/eng/native/functions.cmake b/eng/native/functions.cmake
index 3e01c275025..ae4c66091d3 100644
--- a/eng/native/functions.cmake
+++ b/eng/native/functions.cmake
@@ -466,34 +466,6 @@ function(add_executable_clr)
_add_executable(${ARGV})
endfunction()
-function(generate_module_index Target ModuleIndexFile)
- if(CLR_CMAKE_HOST_WIN32)
- set(scriptExt ".cmd")
- else()
- set(scriptExt ".sh")
- endif()
-
- set(index_timestamp ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/${Target}_index.timestamp)
-
- add_custom_command(
- OUTPUT ${index_timestamp}
- COMMAND ${CLR_ENG_NATIVE_DIR}/genmoduleindex${scriptExt} $<TARGET_FILE:${Target}> ${ModuleIndexFile}
- COMMAND ${CMAKE_COMMAND} -E touch ${index_timestamp}
- DEPENDS ${Target}
- COMMENT "Generating ${Target} module index file -> ${ModuleIndexFile}"
- )
-
- set_source_files_properties(
- ${ModuleIndexFile}
- PROPERTIES GENERATED TRUE
- )
-
- add_custom_target(
- ${Target}_module_index_header
- DEPENDS ${index_timestamp}
- )
-endfunction(generate_module_index)
-
# add_linker_flag(Flag [Config1 Config2 ...])
function(add_linker_flag Flag)
if (ARGN STREQUAL "")
diff --git a/eng/pipelines/coreclr/templates/build-job.yml b/eng/pipelines/coreclr/templates/build-job.yml
index d857a6fd375..4766c5c9a72 100644
--- a/eng/pipelines/coreclr/templates/build-job.yml
+++ b/eng/pipelines/coreclr/templates/build-job.yml
@@ -132,12 +132,6 @@ jobs:
- name: clrBuildPALTestsBuildArg
value: '-paltests '
- - name: ninjaArg
- value: ''
- - ${{ if eq(parameters.osGroup, 'windows') }}:
- - name: ninjaArg
- value: '-ninja'
-
- name: pgoInstrumentArg
value: ''
- ${{ if eq(parameters.pgoType, 'PGO' )}}:
@@ -194,10 +188,10 @@ jobs:
# Build CoreCLR Runtime
- ${{ if ne(parameters.osGroup, 'windows') }}:
- - script: $(Build.SourcesDirectory)/src/coreclr/build-runtime$(scriptExt) $(buildConfig) $(archType) $(crossArg) $(osArg) -ci $(compilerArg) $(clrBuildPALTestsBuildArg) $(ninjaArg) $(officialBuildIdArg) $(clrInterpreterBuildArg)
+ - script: $(Build.SourcesDirectory)/src/coreclr/build-runtime$(scriptExt) $(buildConfig) $(archType) $(crossArg) $(osArg) -ci $(compilerArg) $(clrBuildPALTestsBuildArg) $(officialBuildIdArg) $(clrInterpreterBuildArg)
displayName: Build CoreCLR Runtime
- ${{ if eq(parameters.osGroup, 'windows') }}:
- - script: set __TestIntermediateDir=int&&$(Build.SourcesDirectory)/src/coreclr/build-runtime$(scriptExt) $(buildConfig) $(archType) -ci $(ninjaArg) $(enforcePgoArg) $(pgoInstrumentArg) $(officialBuildIdArg) $(clrInterpreterBuildArg)
+ - script: set __TestIntermediateDir=int&&$(Build.SourcesDirectory)/src/coreclr/build-runtime$(scriptExt) $(buildConfig) $(archType) -ci $(enforcePgoArg) $(pgoInstrumentArg) $(officialBuildIdArg) $(clrInterpreterBuildArg)
displayName: Build CoreCLR Runtime
- ${{ if in(parameters.osGroup, 'OSX', 'iOS', 'tvOS') }}:
diff --git a/eng/pipelines/global-build.yml b/eng/pipelines/global-build.yml
index 581e9991d92..3a737e69c52 100644
--- a/eng/pipelines/global-build.yml
+++ b/eng/pipelines/global-build.yml
@@ -46,6 +46,21 @@ jobs:
timeoutInMinutes: 90
#
+# Build with Release config and runtimeConfiguration with MSBuild generator
+#
+- template: /eng/pipelines/common/platform-matrix.yml
+ parameters:
+ jobTemplate: /eng/pipelines/common/global-build-job.yml
+ buildConfig: release
+ platforms:
+ - windows_x86
+ jobParameters:
+ testGroup: innerloop
+ nameSuffix: MSBuild_CMake
+ buildArgs: -c Release -msbuild
+ timeoutInMinutes: 90
+
+#
# Build with Debug config and Release runtimeConfiguration
#
- template: /eng/pipelines/common/platform-matrix.yml