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
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
parentb7a164882573af99eaf200c4b21808ecaf6dbb8c (diff)
Make Ninja the default CMake generator on Windows for the repo (#49715)
Co-authored-by: Juan Hoyos <juan.hoyos@microsoft.com>
-rw-r--r--docs/workflow/debugging/coreclr/debugging.md28
-rw-r--r--docs/workflow/editing-and-debugging.md5
-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
-rw-r--r--src/coreclr/CMakeLists.txt21
-rw-r--r--src/coreclr/build-runtime.cmd9
-rw-r--r--src/coreclr/debug/runtimeinfo/CMakeLists.txt31
-rw-r--r--src/coreclr/dlls/mscordac/CMakeLists.txt6
-rw-r--r--src/coreclr/dlls/mscordbi/CMakeLists.txt6
-rw-r--r--src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt42
-rw-r--r--src/coreclr/jit/CMakeLists.txt3
-rw-r--r--src/coreclr/runtime.proj3
-rw-r--r--src/installer/corehost.proj2
-rw-r--r--src/libraries/Native/Windows/CMakeLists.txt4
-rw-r--r--src/libraries/Native/build-native.cmd7
-rw-r--r--src/libraries/Native/build-native.proj7
-rw-r--r--src/native/corehost/CMakeLists.txt2
-rw-r--r--src/native/corehost/build.cmd7
-rw-r--r--src/tests/Common/dir.common.props4
-rw-r--r--src/tests/Directory.Build.targets106
-rw-r--r--src/tests/Interop/COM/Dynamic/Server/CMakeLists.txt4
-rw-r--r--src/tests/Interop/COM/NativeClients/DefaultInterfaces/CMakeLists.txt2
-rw-r--r--src/tests/Interop/COM/NativeClients/Dispatch/CMakeLists.txt2
-rw-r--r--src/tests/Interop/COM/NativeClients/Events/CMakeLists.txt2
-rw-r--r--src/tests/Interop/COM/NativeClients/Licensing/CMakeLists.txt2
-rw-r--r--src/tests/Interop/COM/NativeClients/Primitives/CMakeLists.txt2
-rw-r--r--src/tests/Interop/COM/NativeServer/CMakeLists.txt2
-rw-r--r--src/tests/build.cmd32
31 files changed, 248 insertions, 170 deletions
diff --git a/docs/workflow/debugging/coreclr/debugging.md b/docs/workflow/debugging/coreclr/debugging.md
index 0eda9dc3727..4e8d8c00b95 100644
--- a/docs/workflow/debugging/coreclr/debugging.md
+++ b/docs/workflow/debugging/coreclr/debugging.md
@@ -8,28 +8,32 @@ SOS has moved to the diagnostics repo. For more information on SOS, installation
Debugging CoreCLR on Windows
============================
-1. Perform a build of the repo.
-2. Open solution \<reporoot\>\artifacts\obj\coreclr\windows.\<platform\>.\<configuration\>\CoreCLR.sln in Visual Studio. \<platform\> and \<configuration\> are based
+1. Open the CoreCLR solution in Visual Studio.
+ - Method 1: Use the build scripts to open the solution.
+ 1. Run `./build.cmd -vs coreclr.sln -a <platform> -c <configuration>`. This will create and launch the CoreCLR solution in VS for the specified architecture and configuration.
+ - Method 2: Manually build and open the solution.
+ 1. Perform a build of the repo with the `-msbuild` flag.
+ 2. Open solution `\<reporoot>\artifacts\obj\coreclr\windows.\<platform>.\<configuration>\ide\CoreCLR.sln` in Visual Studio. `<platform>` and `<configuration>` are based
on type of build you did. By default they are 'x64' and 'Debug'.
-3. Right-click the INSTALL project and choose ‘Set as StartUp Project’
-4. Bring up the properties page for the INSTALL project
-5. Select Configuration Properties->Debugging from the left side tree control
-6. Set Command=`$(SolutionDir)\..\..\..\bin\coreclr\windows.$(Platform).$(Configuration)\corerun.exe`
+2. Right-click the INSTALL project and choose ‘Set as StartUp Project’
+3. Bring up the properties page for the INSTALL project
+4. Select Configuration Properties->Debugging from the left side tree control
+5. Set Command=`$(SolutionDir)\..\..\..\bin\coreclr\windows.$(Platform).$(Configuration)\corerun.exe`
1. This points to the folder where the built runtime binaries are present.
-7. Set Command Arguments=`<managed app you wish to run>` (e.g. HelloWorld.dll)
-8. Set Working Directory=`$(SolutionDir)\..\..\..\bin\coreclr\windows.$(Platform).$(Configuration)`
+6. Set Command Arguments=`<managed app you wish to run>` (e.g. HelloWorld.dll)
+7. Set Working Directory=`$(SolutionDir)\..\..\..\bin\coreclr\windows.$(Platform).$(Configuration)`
1. This points to the folder containing CoreCLR binaries.
-9. Set Environment=`CORE_LIBRARIES=$(SolutionDir)\..\..\..\bin\runtime\<current tfm>-windows-$(Configuration)-$(Platform)`,
+8. Set Environment=`CORE_LIBRARIES=$(SolutionDir)\..\..\..\bin\runtime\<current tfm>-windows-$(Configuration)-$(Platform)`,
where '\<current tfm\>' is the target framework of current branch, for example `netcoreapp3.1` `net5.0`.
1. This points to the folder containing core libraries except `System.Private.CoreLib`.
2. This step can be skipped if you are debugging CLR tests that references only `System.Private.CoreLib`.
Otherwise, it's required to debug a realworld application that references anything else, including `System.Runtime`.
-10. Right-click the INSTALL project and choose 'Build'
+9. Right-click the INSTALL project and choose 'Build'
1. This will load necessary information from cmake to Visual Studio.
-11. Press F11 to start debugging at wmain in corerun (or set a breakpoint in source and press F5 to run to it)
+10. Press F11 to start debugging at wmain in corerun (or set a breakpoint in source and press F5 to run to it)
1. As an example, set a breakpoint for the EEStartup function in ceemain.cpp to break into CoreCLR startup.
-Steps 1-10 only need to be done once, and then (11) can be repeated whenever you want to start debugging. The above can be done with Visual Studio 2019 as writing.
+Steps 1-9 only need to be done once as long as there's been no changes to the CMake files in the repository. Afterwards, step 10 can be repeated whenever you want to start debugging. The above can be done with Visual Studio 2019 as writing.
Keeping with latest version of Visual Studio is recommended.
### Using SOS with windbg or cdb on Windows ###
diff --git a/docs/workflow/editing-and-debugging.md b/docs/workflow/editing-and-debugging.md
index 50213150e4b..46e3d0b5e58 100644
--- a/docs/workflow/editing-and-debugging.md
+++ b/docs/workflow/editing-and-debugging.md
@@ -19,19 +19,20 @@ The repository has a number of Visual Studio Solutions files (`*.sln`) that are
* `src\coreclr\System.Private.CoreLib\System.Private.CorLib.sln` - This solution is for all managed (C#) code that is defined
in the runtime itself. This is all class library support of one form or another.
- * `artifacts\obj\coreclr\windows.<Arch>.<BuildType>\CoreCLR.sln` - this solution contains most native (C++) projects
+ * `artifacts\obj\coreclr\windows.<Arch>.<BuildType>\ide\CoreCLR.sln` - this solution contains most native (C++) projects
associated with the repository, including
* `coreclr` - This is the main runtime DLL (the GC, class loader, interop are all here)
* `corjit` - This is the Just In Time (JIT) compiler that compiles .NET Intermediate language to native code.
* `corerun` - This is the simple host program that can run a .NET application
* `crossgen` - This is the host program that runs the JIT compiler and produces .NET Native images (`*.ni.dll`)
for C# code.
+ * This project can be automatically generated and opened in Visual Studio by running `./build.cmd -vs CoreCLR.sln -a <Arch> -c <BuildType>` from the root of the repository.
Thus opening one of these two solution files (double clicking on them in Explorer) is typically all you need
to do most editing.
Notice that the CoreCLR solution is under the `artifacts` directory. This is because it is created as part of the build.
-Thus you can only launch this solution after you have built at least once.
+Thus you can only launch this solution after you have built at least once with the `-msbuild` flag or run the `./build.cmd -vs CoreCLR.sln` command line with the specified architecture and configuration.
* See [Debugging CoreCLR](debugging/coreclr/debugging.md)
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
diff --git a/src/coreclr/CMakeLists.txt b/src/coreclr/CMakeLists.txt
index 7e9c6b8a656..8dc3564a781 100644
--- a/src/coreclr/CMakeLists.txt
+++ b/src/coreclr/CMakeLists.txt
@@ -12,8 +12,6 @@ include(../../eng/native/configurepaths.cmake)
include(${CLR_ENG_NATIVE_DIR}/configurecompiler.cmake)
if(MSVC)
- string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
- add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/EHa>) # enable C++ EH (w/ SEH exceptions)
set(CMAKE_CXX_STANDARD_LIBRARIES "") # do not link against standard win32 libs i.e. kernel32, uuid, user32, etc.
endif (MSVC)
@@ -48,6 +46,21 @@ endif(CLR_CROSS_COMPONENTS_BUILD)
#-------------------
include(pgosupport.cmake)
+#---------------------------
+# Build the single file host
+#---------------------------
+if(CLR_CMAKE_BUILD_SUBSET_RUNTIME AND NOT CLR_CROSS_COMPONENTS_BUILD)
+ add_subdirectory(${CLR_SRC_NATIVE_DIR}/corehost/apphost/static Corehost.Static)
+endif()
+
+#-------------------------
+# Enable C++ EH with SEH
+#-------------------------
+if (MSVC)
+ string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+ add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/EHa>) # enable C++ EH (w/ SEH exceptions)
+endif()
+
#-------------------------------
# Include libraries native shims
#-------------------------------
@@ -130,10 +143,6 @@ if(FEATURE_STANDALONE_GC)
endif (CLR_CMAKE_BUILD_SUBSET_RUNTIME)
endif(FEATURE_STANDALONE_GC)
-if(CLR_CMAKE_BUILD_SUBSET_RUNTIME AND NOT CLR_CROSS_COMPONENTS_BUILD)
- add_subdirectory(${CLR_SRC_NATIVE_DIR}/corehost/apphost/static Corehost.Static)
-endif()
-
if (CLR_CMAKE_HOST_UNIX)
include_directories("pal/inc")
include_directories("pal/inc/rt")
diff --git a/src/coreclr/build-runtime.cmd b/src/coreclr/build-runtime.cmd
index 89cce1aa1d1..e31d9b7b812 100644
--- a/src/coreclr/build-runtime.cmd
+++ b/src/coreclr/build-runtime.cmd
@@ -78,7 +78,7 @@ set __CrossArch2=
set __CrossOS=0
set __PgoOptDataPath=
set __CMakeArgs=
-set __Ninja=0
+set __Ninja=1
@REM CMD has a nasty habit of eating "=" on the argument list, so passing:
@REM -priority=1
@@ -152,7 +152,9 @@ if /i "%1" == "-skipnative" (set __BuildNative=0&set processedArgs=!pro
if /i "%1" == "-skipcrossarchnative" (set __SkipCrossArchNative=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "-skipgenerateversion" (set __SkipGenerateVersion=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "-skiprestoreoptdata" (set __RestoreOptData=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
-if /i "%1" == "-ninja" (set __Ninja=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
+REM -ninja is a no-op option since Ninja is now the default generator on Windows.
+if /i "%1" == "-ninja" (set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
+if /i "%1" == "-msbuild" (set __Ninja=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "-pgoinstrument" (set __PgoInstrument=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "-enforcepgo" (set __EnforcePgo=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "-nopgooptimize" (set __PgoOptimize=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
@@ -284,7 +286,7 @@ set "__IntermediatesDir=%__RootBinDir%\obj\coreclr\%__TargetOS%.%__BuildArch%.%_
set "__LogsDir=%__RootBinDir%\log\!__BuildType!"
set "__MsbuildDebugLogsDir=%__LogsDir%\MsbuildDebugLogs"
set "__ArtifactsIntermediatesDir=%__RepoRootDir%\artifacts\obj\coreclr\"
-if "%__Ninja%"=="1" (set "__IntermediatesDir=%__RootBinDir%\nmakeobj\%__TargetOS%.%__BuildArch%.%__BuildType%")
+if "%__Ninja%"=="0" (set "__IntermediatesDir=%__IntermediatesDir%\ide")
set "__PackagesBinDir=%__BinDir%\.nuget"
set "__CrossComponentBinDir=%__BinDir%"
set "__CrossCompIntermediatesDir=%__IntermediatesDir%\crossgen"
@@ -707,6 +709,7 @@ REM ============================================================================
echo %__MsgPrefix%Build succeeded. Finished at %TIME%
echo %__MsgPrefix%Product binaries are available at !__BinDir!
+
exit /b 0
REM =========================================================================================
diff --git a/src/coreclr/debug/runtimeinfo/CMakeLists.txt b/src/coreclr/debug/runtimeinfo/CMakeLists.txt
index a7811d6ce2c..c4ad348e6b7 100644
--- a/src/coreclr/debug/runtimeinfo/CMakeLists.txt
+++ b/src/coreclr/debug/runtimeinfo/CMakeLists.txt
@@ -6,11 +6,34 @@ set(RUNTIMEINFO_SOURCES
add_library_clr(runtimeinfo STATIC ${RUNTIMEINFO_SOURCES})
-add_dependencies(runtimeinfo coreclr_module_index_header)
+function(generate_module_index Target ModuleIndexFile)
+ if(CLR_CMAKE_HOST_WIN32)
+ set(scriptExt ".cmd")
+ else()
+ set(scriptExt ".sh")
+ endif()
-if (NOT (CLR_CMAKE_TARGET_WIN32 AND (CLR_CMAKE_TARGET_ARCH_I386 OR CLR_CMAKE_TARGET_ARCH_ARM) AND CLR_CMAKE_HOST_ARCH_AMD64))
- add_dependencies(runtimeinfo mscordaccore_module_index_header)
- add_dependencies(runtimeinfo mscordbi_module_index_header)
+ add_custom_command(
+ OUTPUT ${ModuleIndexFile}
+ COMMAND ${CLR_ENG_NATIVE_DIR}/genmoduleindex${scriptExt} $<TARGET_FILE:${Target}> ${ModuleIndexFile}
+ DEPENDS ${Target}
+ COMMENT "Generating ${Target} module index file -> ${ModuleIndexFile}"
+ )
+
+ set_source_files_properties(
+ ${ModuleIndexFile}
+ PROPERTIES GENERATED TRUE
+ )
+
+ add_dependencies(runtimeinfo ${Target})
+ target_sources(runtimeinfo PRIVATE ${ModuleIndexFile})
+endfunction(generate_module_index)
+
+generate_module_index(coreclr ${CMAKE_CURRENT_BINARY_DIR}/runtimemoduleindex.h)
+if(NOT DEFINED CLR_CROSS_COMPONENTS_BUILD)
+ add_dependencies(runtimeinfo inject_debug_resources_coreclr)
+ generate_module_index(mscordaccore ${CMAKE_CURRENT_BINARY_DIR}/dacmoduleindex.h)
+ generate_module_index(mscordbi ${CMAKE_CURRENT_BINARY_DIR}/dbimoduleindex.h)
endif()
# publish runtimeinfo lib
diff --git a/src/coreclr/dlls/mscordac/CMakeLists.txt b/src/coreclr/dlls/mscordac/CMakeLists.txt
index 91e4d66c924..3ec2b964454 100644
--- a/src/coreclr/dlls/mscordac/CMakeLists.txt
+++ b/src/coreclr/dlls/mscordac/CMakeLists.txt
@@ -192,12 +192,6 @@ endif(CLR_CMAKE_HOST_UNIX)
target_link_libraries(mscordaccore PRIVATE ${COREDAC_LIBRARIES})
-# Create the DAC module index header file containing the DAC build id
-# for xplat and the timestamp/size on Windows.
-if(FEATURE_SINGLE_FILE_DIAGNOSTICS)
- generate_module_index(mscordaccore ${GENERATED_INCLUDE_DIR}/dacmoduleindex.h)
-endif(FEATURE_SINGLE_FILE_DIAGNOSTICS)
-
# add the install targets
install_clr(TARGETS mscordaccore ADDITIONAL_DESTINATIONS sharedFramework)
diff --git a/src/coreclr/dlls/mscordbi/CMakeLists.txt b/src/coreclr/dlls/mscordbi/CMakeLists.txt
index a0fae494846..f000748bee0 100644
--- a/src/coreclr/dlls/mscordbi/CMakeLists.txt
+++ b/src/coreclr/dlls/mscordbi/CMakeLists.txt
@@ -119,11 +119,5 @@ elseif(CLR_CMAKE_HOST_UNIX)
endif(CLR_CMAKE_HOST_WIN32)
-# Create the DBI module index header file containing the DBI build id
-# for xplat and the timestamp/size on Windows.
-if(FEATURE_SINGLE_FILE_DIAGNOSTICS)
- generate_module_index(mscordbi ${GENERATED_INCLUDE_DIR}/dbimoduleindex.h)
-endif(FEATURE_SINGLE_FILE_DIAGNOSTICS)
-
# add the install targets
install_clr(TARGETS mscordbi ADDITIONAL_DESTINATIONS sharedFramework)
diff --git a/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt b/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt
index b22ccf1a6bc..09897cd7753 100644
--- a/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt
+++ b/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt
@@ -173,12 +173,6 @@ target_sources(coreclr_static PUBLIC $<TARGET_OBJECTS:cee_wks_core>)
target_link_libraries(coreclr_static PUBLIC ${CORECLR_LIBRARIES} clrjit_static cee_wks_mergeable)
target_compile_definitions(coreclr_static PUBLIC CORECLR_EMBEDDED)
-# Create the runtime module index header file containing the coreclr build id
-# for xplat and the timestamp/size on Windows.
-if(FEATURE_SINGLE_FILE_DIAGNOSTICS)
- generate_module_index(coreclr ${GENERATED_INCLUDE_DIR}/runtimemoduleindex.h)
-endif(FEATURE_SINGLE_FILE_DIAGNOSTICS)
-
if(CLR_CMAKE_TARGET_WIN32)
# Add dac table & debug resource to coreclr
get_include_directories(INC_DIR)
@@ -204,32 +198,48 @@ if(CLR_CMAKE_TARGET_WIN32)
endif()
add_custom_command(
- DEPENDS coreclr singlefilehost mscordaccore mscordbi ${CLR_DIR}/debug/daccess/daccess.cpp
- OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/inject_debug_resources.timestamp
+ DEPENDS coreclr mscordaccore mscordbi ${CLR_DIR}/debug/daccess/daccess.cpp
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/inject_debug_resources_coreclr.timestamp
COMMAND ${CMAKE_CXX_COMPILER} /P /EP /TP ${PREPROCESS_DEFINITIONS} ${INC_DIR} /Fi${CMAKE_CURRENT_BINARY_DIR}/daccess.i ${CLR_DIR}/debug/daccess/daccess.cpp
# make and inject dactable for coreclr
COMMAND cmd /c ${CLR_REPO_ROOT_DIR}/dotnet.cmd exec ${CMAKE_INSTALL_PREFIX}/DacTableGen/DacTableGen.dll /dac:${CMAKE_CURRENT_BINARY_DIR}/daccess.i /pdb:$<TARGET_PDB_FILE:coreclr> /dll:$<TARGET_FILE:coreclr> /bin:${CMAKE_CURRENT_BINARY_DIR}/wks.bin
COMMAND InjectResource /bin:${CMAKE_CURRENT_BINARY_DIR}/wks.bin /dll:$<TARGET_FILE:coreclr>
+ # make CLRDEBUGINFO resource and inject into coreclr
+ COMMAND GenClrDebugResource /dac:$<TARGET_FILE:mscordaccore> /dbi:$<TARGET_FILE:mscordbi> /sku:onecoreclr /out:${CMAKE_CURRENT_BINARY_DIR}/clrDebugResource.bin
+ COMMAND InjectResource /bin:${CMAKE_CURRENT_BINARY_DIR}/clrDebugResource.bin /dll:$<TARGET_FILE:coreclr> /name:CLRDEBUGINFO
+
+ # inject MINIDUMP_AUXILIARY_PROVIDER into coreclr
+ COMMAND InjectResource /bin:${CMAKE_CURRENT_SOURCE_DIR}/dump_helper_resource.bin /dll:$<TARGET_FILE:coreclr> /name:MINIDUMP_AUXILIARY_PROVIDER
+
+ COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/inject_debug_resources_coreclr.timestamp
+ COMMENT Add dactable, debug resources, and dump helper resources to coreclr
+ )
+
+ if(NOT DEFINED CLR_CROSS_COMPONENTS_BUILD)
+ add_custom_target(inject_debug_resources_coreclr ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/inject_debug_resources_coreclr.timestamp)
+ endif()
+
+ add_custom_command(
+ DEPENDS singlefilehost mscordaccore mscordbi ${CLR_DIR}/debug/daccess/daccess.cpp
+ OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/inject_debug_resources_singlefilehost.timestamp
+ COMMAND ${CMAKE_CXX_COMPILER} /P /EP /TP ${PREPROCESS_DEFINITIONS} ${INC_DIR} /Fi${CMAKE_CURRENT_BINARY_DIR}/daccess.i ${CLR_DIR}/debug/daccess/daccess.cpp
+
# make and inject dactable for singlefilehost
COMMAND cmd /c ${CLR_REPO_ROOT_DIR}/dotnet.cmd exec ${CMAKE_INSTALL_PREFIX}/DacTableGen/DacTableGen.dll /dac:${CMAKE_CURRENT_BINARY_DIR}/daccess.i /pdb:$<TARGET_PDB_FILE:singlefilehost> /dll:$<TARGET_FILE:singlefilehost> /bin:${CMAKE_CURRENT_BINARY_DIR}/sfh.bin
COMMAND InjectResource /bin:${CMAKE_CURRENT_BINARY_DIR}/sfh.bin /dll:$<TARGET_FILE:singlefilehost>
- # make CLRDEBUGINFO resource and inject into coreclr and singlefilehost
+ # make CLRDEBUGINFO resource and inject into singlefilehost
COMMAND GenClrDebugResource /dac:$<TARGET_FILE:mscordaccore> /dbi:$<TARGET_FILE:mscordbi> /sku:onecoreclr /out:${CMAKE_CURRENT_BINARY_DIR}/clrDebugResource.bin
- COMMAND InjectResource /bin:${CMAKE_CURRENT_BINARY_DIR}/clrDebugResource.bin /dll:$<TARGET_FILE:coreclr> /name:CLRDEBUGINFO
COMMAND InjectResource /bin:${CMAKE_CURRENT_BINARY_DIR}/clrDebugResource.bin /dll:$<TARGET_FILE:singlefilehost> /name:CLRDEBUGINFO
- # inject MINIDUMP_AUXILIARY_PROVIDER into coreclr
- COMMAND InjectResource /bin:${CMAKE_CURRENT_SOURCE_DIR}/dump_helper_resource.bin /dll:$<TARGET_FILE:coreclr> /name:MINIDUMP_AUXILIARY_PROVIDER
-
- COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/inject_debug_resources.timestamp
- COMMENT Add dactable, debug resources, and dump helper resources to coreclr and singlefilehost
+ COMMAND ${CMAKE_COMMAND} -E touch ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/inject_debug_resources_singlefilehost.timestamp
+ COMMENT Add dactable, debug resources, and dump helper resources to singlefilehost
)
if(NOT DEFINED CLR_CROSS_COMPONENTS_BUILD)
- add_custom_target(inject_debug_resources ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/inject_debug_resources.timestamp)
+ add_custom_target(inject_debug_resources_singlefilehost ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/inject_debug_resources_singlefilehost.timestamp)
endif()
endif(CLR_CMAKE_TARGET_WIN32)
diff --git a/src/coreclr/jit/CMakeLists.txt b/src/coreclr/jit/CMakeLists.txt
index 3eb595b9ead..7401264cf16 100644
--- a/src/coreclr/jit/CMakeLists.txt
+++ b/src/coreclr/jit/CMakeLists.txt
@@ -8,8 +8,6 @@ if (CMAKE_CXX_COMPILER_ID STREQUAL "GNU")
add_compile_options(-Wno-error)
endif()
-add_compile_options($<$<CXX_COMPILER_ID:MSVC>:-W4>)
-
function(create_standalone_jit)
set(oneValueArgs TARGET OS ARCH)
@@ -447,6 +445,7 @@ function(add_jit jitName)
set_property(TARGET ${jitName} APPEND_STRING PROPERTY LINK_FLAGS ${JIT_EXPORTS_LINKER_OPTION})
set_property(TARGET ${jitName} APPEND_STRING PROPERTY LINK_DEPENDS ${JIT_EXPORTS_FILE})
+ set_target_properties(${jitName} PROPERTIES MSVC_WARNING_LEVEL 4)
target_link_libraries(${jitName}
${JIT_LINK_LIBRARIES}
diff --git a/src/coreclr/runtime.proj b/src/coreclr/runtime.proj
index c6f96405f4d..eb29aa04397 100644
--- a/src/coreclr/runtime.proj
+++ b/src/coreclr/runtime.proj
@@ -26,7 +26,8 @@
'$(PgoInstrument)' != 'true'"
Include="-enforcepgo" />
<_CoreClrBuildArg Condition="$([MSBuild]::IsOsPlatform(Windows)) and '$(CrossDac)' != ''" Include="-$(CrossDac)dac" />
- <_CoreClrBuildArg Condition="'$(Ninja)' == 'true'" Include="-ninja" />
+ <_CoreClrBuildArg Condition="'$(Ninja)' == 'true' and !$([MSBuild]::IsOsPlatform(Windows))" Include="-ninja" />
+ <_CoreClrBuildArg Condition="'$(Ninja)' == 'false' and $([MSBuild]::IsOsPlatform(Windows))" Include="-msbuild" />
<_CoreClrBuildArg Condition="'$(ClrRuntimeSubset)' != 'true'" Include="-skipruntime" />
<_CoreClrBuildArg Condition="'$(ClrJitSubset)' != 'true'" Include="-skipjit" />
<_CoreClrBuildArg Condition="'$(ClrILToolsSubset)' != 'true'" Include="-skipiltools" />
diff --git a/src/installer/corehost.proj b/src/installer/corehost.proj
index 6ba56f27aec..09d6bc7ebb6 100644
--- a/src/installer/corehost.proj
+++ b/src/installer/corehost.proj
@@ -84,7 +84,7 @@
<BuildArgs Condition="'$(IncrementalNativeBuild)' == 'true'">$(BuildArgs) incremental-native-build</BuildArgs>
<BuildArgs>$(BuildArgs) rootdir $(RepoRoot)</BuildArgs>
<BuildArgs>$(BuildArgs) coreclrartifacts $(CoreCLRArtifactsPath)</BuildArgs>
- <BuildArgs Condition="'$(Ninja)' == 'true'">$(BuildArgs) ninja</BuildArgs>
+ <BuildArgs Condition="'$(Ninja)' == 'false'">$(BuildArgs) msbuild</BuildArgs>
<BuildArgs>$(BuildArgs) runtimeflavor $(RuntimeFlavor)</BuildArgs>
<BuildArgs>$(BuildArgs) runtimeconfiguration $(RuntimeConfiguration)</BuildArgs>
</PropertyGroup>
diff --git a/src/libraries/Native/Windows/CMakeLists.txt b/src/libraries/Native/Windows/CMakeLists.txt
index 3f9924adb0a..77b6d979c7a 100644
--- a/src/libraries/Native/Windows/CMakeLists.txt
+++ b/src/libraries/Native/Windows/CMakeLists.txt
@@ -49,9 +49,8 @@ string(REPLACE "/EHsc" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
add_compile_options(/EHa) # enable C++ EH (w/ SEH exceptions)
add_compile_options(/Zp8) # pack structs on 8-byte boundary
add_compile_options(/Gy) # separate functions for linker
-add_compile_options(/Zc:wchar_t-) # C++ language conformance: wchar_t is NOT the native type, but a typedef
add_compile_options(/Zc:forScope) # C++ language conformance: enforce Standard C++ for scoping rules
-string(REPLACE "/GR" "" CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
+string(REPLACE "/GR " " " CMAKE_CXX_FLAGS "${CMAKE_CXX_FLAGS}")
add_compile_options(/GR-) # disable C++ RTTI
add_compile_options(/FC) # use full pathnames in diagnostics
add_compile_options(/MP) # Build with Multiple Processes (number of processes equal to the number of processors)
@@ -80,7 +79,6 @@ list(APPEND __SharedLinkArgs /GUARD:CF)
set(CMAKE_MSVC_RUNTIME_LIBRARY "MultiThreaded$<$<CONFIG:Debug>:Debug>")
add_compile_options($<$<CONFIG:RELEASE>:/GL>)
-add_compile_options($<$<CONFIG:RELEASE>:/O1>)
list(APPEND __LinkLibraries $<$<CONFIG:DEBUG>:libcmtd.lib>)
list(APPEND __LinkLibraries $<$<CONFIG:RELEASE>:libcmt.lib>)
diff --git a/src/libraries/Native/build-native.cmd b/src/libraries/Native/build-native.cmd
index 29037e2ef91..15389a55f24 100644
--- a/src/libraries/Native/build-native.cmd
+++ b/src/libraries/Native/build-native.cmd
@@ -15,7 +15,7 @@ set __TargetOS=windows
set CMAKE_BUILD_TYPE=Debug
set "__LinkArgs= "
set "__LinkLibraries= "
-set __Ninja=0
+set __Ninja=1
:Arg_Loop
:: Since the native build requires some configuration information before msbuild is called, we have to do some manual args parsing
@@ -37,7 +37,7 @@ if /i [%1] == [Browser] ( set __TargetOS=Browser&&shift&goto Arg_Loop)
if /i [%1] == [rebuild] ( set __BuildTarget=rebuild&&shift&goto Arg_Loop)
-if /i [%1] == [ninja] ( set __Ninja=1&&shift&goto Arg_Loop)
+if /i [%1] == [msbuild] ( set __Ninja=0&&shift&goto Arg_Loop)
shift
goto :Arg_Loop
@@ -67,6 +67,9 @@ if %__CMakeBinDir% == "" (
if %__IntermediatesDir% == "" (
set "__IntermediatesDir=%__artifactsDir%\obj\native\%__outConfig%"
)
+if %__Ninja% == 0 (
+ set "__IntermediatesDir=%__IntermediatesDir%\ide"
+)
set "__CMakeBinDir=%__CMakeBinDir:\=/%"
set "__IntermediatesDir=%__IntermediatesDir:\=/%"
diff --git a/src/libraries/Native/build-native.proj b/src/libraries/Native/build-native.proj
index 900d7f0ad72..edba5f1fbdd 100644
--- a/src/libraries/Native/build-native.proj
+++ b/src/libraries/Native/build-native.proj
@@ -6,7 +6,6 @@
<TargetFramework>$(BuildTargetFramework)</TargetFramework>
<TargetFramework Condition="'$(TargetFramework)' == ''">$(NetCoreAppCurrent)</TargetFramework>
<_BuildNativeArgs>$(TargetArchitecture) $(Configuration) outconfig $(TargetFramework)-$(TargetOS)-$(Configuration)-$(TargetArchitecture) -os $(TargetOS)</_BuildNativeArgs>
- <_BuildNativeArgs Condition="'$(Ninja)' == 'true'">$(_BuildNativeArgs) ninja</_BuildNativeArgs>
</PropertyGroup>
<ItemGroup>
@@ -18,6 +17,7 @@
BeforeTargets="Build"
Condition="!$([MSBuild]::IsOsPlatform(Windows))">
<PropertyGroup>
+ <_BuildNativeArgs Condition="'$(Ninja)' == 'true'">$(_BuildNativeArgs) ninja</_BuildNativeArgs>
<!--
MSBuildNodeCount should a good approximation for how many procs to use for native build, if we find that doesn't work
then we should consider calling Environment.ProcessorCount
@@ -44,7 +44,10 @@
BeforeTargets="Build"
Condition="$([MSBuild]::IsOsPlatform(Windows)) and
'$(TargetFramework)' == '$(NetCoreAppCurrent)'">
- <!-- Run script that invokes Cmake to create VS files, and then calls msbuild to compile them -->
+ <PropertyGroup>
+ <_BuildNativeArgs Condition="'$(Ninja)' == 'false'">$(_BuildNativeArgs) msbuild</_BuildNativeArgs>
+ </PropertyGroup>
+ <!-- Run script that uses CMake to generate and build the native files. -->
<Message Text="&quot;$(MSBuildThisFileDirectory)build-native.cmd&quot; $(_BuildNativeArgs)" Importance="High"/>
<Exec Command="&quot;$(MSBuildThisFileDirectory)build-native.cmd&quot; $(_BuildNativeArgs)" />
</Target>
diff --git a/src/native/corehost/CMakeLists.txt b/src/native/corehost/CMakeLists.txt
index 3ce1d78bec7..d7784410ed0 100644
--- a/src/native/corehost/CMakeLists.txt
+++ b/src/native/corehost/CMakeLists.txt
@@ -16,7 +16,7 @@ if (MSVC)
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4200>)
add_compile_options($<$<COMPILE_LANGUAGE:C,CXX>:/wd4244>)
# Host components don't try to handle asynchronous exceptions
- add_compile_options(/EHsc)
+ add_compile_options($<$<COMPILE_LANGUAGE:CXX>:/EHsc>)
elseif (CMAKE_CXX_COMPILER_ID MATCHES GNU)
# Prevents libc from calling pthread_cond_destroy on static objects in
# dlopen()'ed library which we dlclose() in pal::unload_library.
diff --git a/src/native/corehost/build.cmd b/src/native/corehost/build.cmd
index d346198a660..6239d5df950 100644
--- a/src/native/corehost/build.cmd
+++ b/src/native/corehost/build.cmd
@@ -17,7 +17,7 @@ set "__LinkArgs= "
set "__LinkLibraries= "
set __PortableBuild=0
set __IncrementalNativeBuild=0
-set __Ninja=0
+set __Ninja=1
:Arg_Loop
if [%1] == [] goto :InitVSEnv
@@ -43,7 +43,7 @@ if /i [%1] == [commit] (set __CommitSha=%2&&shift&&shift&goto Arg_Loop)
if /i [%1] == [incremental-native-build] ( set __IncrementalNativeBuild=1&&shift&goto Arg_Loop)
if /i [%1] == [rootDir] ( set __rootDir=%2&&shift&&shift&goto Arg_Loop)
if /i [%1] == [coreclrartifacts] (set __CoreClrArtifacts=%2&&shift&&shift&goto Arg_Loop)
-if /i [%1] == [ninja] (set __Ninja=1)
+if /i [%1] == [msbuild] (set __Ninja=0)
if /i [%1] == [runtimeflavor] (set __RuntimeFlavor=%2&&shift&&shift&goto Arg_Loop)
if /i [%1] == [runtimeconfiguration] (set __RuntimeConfiguration=%2&&shift&&shift&goto Arg_Loop)
@@ -73,6 +73,9 @@ if %__CMakeBinDir% == "" (
if %__IntermediatesDir% == "" (
set "__IntermediatesDir=%__objDir%\%__TargetRid%.%CMAKE_BUILD_TYPE%\corehost"
)
+if %__Ninja% == 0 (
+ set "__IntermediatesDir=%__IntermediatesDir%\ide"
+)
set "__ResourcesDir=%__objDir%\%__TargetRid%.%CMAKE_BUILD_TYPE%\hostResourceFiles"
set "__CMakeBinDir=%__CMakeBinDir:\=/%"
set "__IntermediatesDir=%__IntermediatesDir:\=/%"
diff --git a/src/tests/Common/dir.common.props b/src/tests/Common/dir.common.props
index 3a60c77ea93..afac3e7ae45 100644
--- a/src/tests/Common/dir.common.props
+++ b/src/tests/Common/dir.common.props
@@ -24,7 +24,9 @@
for the lock file, and props/targets from nuget packages. -->
<BaseIntermediateOutputPath>$(BaseOutputPath)/obj/$(OSPlatformConfig)/Managed/$(BuildProjectRelativeDir)</BaseIntermediateOutputPath>
<IntermediateOutputPath>$(BaseIntermediateOutputPath)</IntermediateOutputPath>
- <__NativeTestIntermediatesDir Condition="'$(__NativeTestIntermediatesDir)' == ''">$(BaseOutputPath)\obj\$(OSPlatformConfig)\Native\</__NativeTestIntermediatesDir>
+ <UseVisualStudioNativeBinariesLayout Condition="'$(UseVisualStudioNativeBinariesLayout)' == '' and '$(Ninja)' == 'false' and $([MSBuild]::IsOsPlatform(Windows))">true</UseVisualStudioNativeBinariesLayout>
+ <__NativeTestIntermediatesDir Condition="'$(__NativeTestIntermediatesDir)' == '' and '$(UseVisualStudioNativeBinariesLayout)' != 'true'">$(BaseOutputPath)\obj\$(OSPlatformConfig)\Native\</__NativeTestIntermediatesDir>
+ <__NativeTestIntermediatesDir Condition="'$(__NativeTestIntermediatesDir)' == '' and '$(UseVisualStudioNativeBinariesLayout)' == 'true'">$(BaseOutputPath)\obj\$(OSPlatformConfig)\Native\ide\</__NativeTestIntermediatesDir>
<BasePackagePath>$(BaseOutputPath)\packages\$(BuildProjectRelativeDir)</BasePackagePath>
<BasePackagePath Condition="'$(PackageRuntimeIdentifier)' != ''">$([System.IO.Path]::GetFullPath($(IntermediateOutputPath)\$(PackageRuntimeIdentifier)))</BasePackagePath>
diff --git a/src/tests/Directory.Build.targets b/src/tests/Directory.Build.targets
index 80bda0ec6fc..cf36a8cdf61 100644
--- a/src/tests/Directory.Build.targets
+++ b/src/tests/Directory.Build.targets
@@ -114,48 +114,62 @@
</PropertyGroup>
<Target Name="CopyNativeProjectBinaries" Condition="'$(_CopyNativeProjectBinaries)' == 'true'">
-
- <ItemGroup>
- <NativeProjectBinaries Condition="'$(RunningOnUnix)' != 'true'" Include="$(NativeProjectOutputFolder)\**\*.*" />
-
- <!-- ############################################################### -->
- <!-- The following is unix only. It is required because the unix test-->
- <!-- build, unlike the windows test build, do not place the binaries -->
- <!-- built into a separate Debug/Checked/Release directory. Therefore-->
- <!-- we must filter the folder to only include dynamic libraries, -->
- <!-- static libraries and executables. -->
- <!-- -->
- <!-- Please take care when modifying the following lines of code. -->
- <!-- At a minimum to test any changes to the below, please run a -->
- <!-- pri1 test build. -->
- <!-- ############################################################### -->
-
- <!-- Include everything and then filter. -->
- <NativeProjectBinariesMatched Condition="'$(RunningOnUnix)' == 'true'" Include="$(NativeProjectOutputFolder)\**\*.*" />
-
- <!-- Filter executables on unix -->
- <NativeProjectBinariesExeFilter Condition="'$(RunningOnUnix)' == 'true' and $([System.Text.RegularExpressions.Regex]::IsMatch(['%(Identity)', `(.*\/)([^.]+)$`))" Include="@(NativeProjectBinariesMatched)" />
- <!-- Filter out the *Make* files -->
- <NativeProjectBinariesExeFilterRemovedMakeFile Condition="'$(RunningOnUnix)' == 'true' and !$([System.Text.RegularExpressions.Regex]::IsMatch(['%(Identity)', `.*Makefile.*`))" Include="@(NativeProjectBinariesExeFilter)" />
-
- <!-- Filter out the CMakeFiles files -->
- <NativeProjectBinariesExeFilterRemovedCMakeFile Condition="'$(RunningOnUnix)' == 'true' and !$([System.Text.RegularExpressions.Regex]::IsMatch(['%(Identity)', `.*CMakeFiles.*`))" Include="@(NativeProjectBinariesExeFilterRemovedMakeFile)" />
-
- <!-- Filter .dylib files on OSX -->
- <NativeProjectBinariesDyLibFilter Condition="'$(TargetOS)' == 'OSX' and $([System.Text.RegularExpressions.Regex]::IsMatch(['%(Identity)', `(.*\/).*\.dylib`))" Include="@(NativeProjectBinariesMatched)" />
-
- <!-- Filter .so files on non-OSX Unix -->
- <NativeProjectBinariesDyLibFilter Condition="'$(RunningOnUnix)' == 'true' and '$(TargetOS)' != 'OSX' and $([System.Text.RegularExpressions.Regex]::IsMatch(['%(Identity)', `(.*\/).*\.so`))" Include="@(NativeProjectBinariesMatched)" />
-
- <!-- Filter static lib files on Unix -->
- <NativeProjectBinariesStaticLibFilter Condition="'$(RunningOnUnix)' == 'true' and $([System.Text.RegularExpressions.Regex]::IsMatch(['%(Identity)', `(.*\/).*\.a`))" Include="@(NativeProjectBinariesMatched)" />
-
- <!-- Merge the filtered lists -->
- <NativeProjectBinaries Condition="'$(RunningOnUnix)' == 'true'" Include="@(NativeProjectBinariesExeFilterRemovedCMakeFile)" />
- <NativeProjectBinaries Condition="'$(RunningOnUnix)' == 'true'" Include="@(NativeProjectBinariesDyLibFilter)" />
- <NativeProjectBinaries Condition="'$(RunningOnUnix)' == 'true'" Include="@(NativeProjectBinariesStaticLibFilter)" />
-
- </ItemGroup>
+ <ItemGroup Condition="'$(UseVisualStudioNativeBinariesLayout)' == 'true'">
+ <NativeProjectBinaries Include="$(NativeProjectOutputFolder)\*.*" />
+ </ItemGroup>
+ <ItemGroup Condition="'$(UseVisualStudioNativeBinariesLayout)' != 'true'">
+ <!-- ############################################################### -->
+ <!-- The following is required because the single configuration -->
+ <!-- generators, unlike multi-configuration generators, -->
+ <!-- do not place the binaries built into a separate -->
+ <!-- Debug/Checked/Release directory. Therefore we must filter -->
+ <!-- the folder to only include dynamic libraries, static libraries -->
+ <!-- and executables. -->
+ <!-- -->
+ <!-- Please take care when modifying the following lines of code. -->
+ <!-- ############################################################### -->
+
+ <!-- Include everything and then filter. -->
+ <NativeProjectBinariesMatched Include="$(NativeProjectOutputFolder)\**\*.*" />
+
+ <!-- Filter executables on unix -->
+ <NativeProjectBinariesExeFilter Condition="'%(Extension)' == ''" Include="@(NativeProjectBinariesMatched)" />
+
+ <!-- Filter executables on Windows -->
+ <NativeProjectBinariesExeFilter Condition="'%(Extension)' == '.exe'" Include="@(NativeProjectBinariesMatched)" />
+
+ <!-- Filter manifest/data files on Windows -->
+ <NativeProjectBinariesManifestFilter Condition="'%(Extension)' == '.manifest'" Include="@(NativeProjectBinariesMatched)" />
+ <NativeProjectBinariesManifestFilter Condition="'%(Extension)' == '.tlb'" Include="@(NativeProjectBinariesMatched)" />
+
+ <!-- Filter out the *Make* files -->
+ <NativeProjectBinariesExeFilterRemovedMakeFile Condition="'%(FileName)' != 'Makefile'" Include="@(NativeProjectBinariesExeFilter)" />
+
+ <!-- Filter .dylib files for OSX -->
+ <NativeProjectBinariesDyLibFilter Condition="'%(Extension)' == '.dylib'" Include="@(NativeProjectBinariesMatched)" />
+
+ <!-- Filter .so files for Linux -->
+ <NativeProjectBinariesDyLibFilter Condition="'%(Extension)' == '.so'" Include="@(NativeProjectBinariesMatched)" />
+
+ <!-- Filter static lib files for Unix -->
+ <NativeProjectBinariesStaticLibFilter Condition="'%(Extension)' == '.a'" Include="@(NativeProjectBinariesMatched)" />
+
+ <!-- Filter dynamic lib files for Windows -->
+ <NativeProjectBinariesDyLibFilter Condition="'%(Extension)' == '.dll'" Include="@(NativeProjectBinariesMatched)" />
+
+ <!-- Filter symbol files for Windows -->
+ <NativeProjectsBinariesSymbolsFilter Condition="'%(Extension)' == '.pdb'" Include="@(NativeProjectBinariesMatched)" />
+
+ <!-- Filter static lib files for Windows -->
+ <NativeProjectBinariesStaticLibFilter Condition="'%(Extension)' == '.lib'" Include="@(NativeProjectBinariesMatched)" />
+
+ <!-- Merge the filtered lists -->
+ <NativeProjectBinaries Include="@(NativeProjectBinariesExeFilterRemovedMakeFile)" />
+ <NativeProjectBinaries Include="@(NativeProjectBinariesDyLibFilter)" />
+ <NativeProjectBinaries Include="@(NativeProjectBinariesStaticLibFilter)" />
+ <NativeProjectBinaries Include="@(NativeProjectsBinariesSymbolsFilter)" />
+ <NativeProjectBinaries Include="@(NativeProjectBinariesManifestFilter)" />
+ </ItemGroup>
<!-- There are currently no native project binaries on wasm or Android -->
<Error Text="The native project files are missing in $(NativeProjectOutputFolder) please run build from the root of the repo at least once"
@@ -187,8 +201,8 @@
Condition="'$(_CopyNativeProjectBinaries)' == 'true'"
BeforeTargets="Build" >
<ItemGroup Condition="'@(NativeProjectReferenceNormalized)' != ''">
- <NativeProjectOutputFoldersToCopy Include="$([System.String]::Copy('%(NativeProjectReferenceNormalized.RelativeDir)').Replace($(TestSourceDir),$(__NativeTestIntermediatesDir)\))" Condition="'$(RunningOnUnix)' == 'true'" />
- <NativeProjectOutputFoldersToCopy Include="$([System.String]::Copy('%(NativeProjectReferenceNormalized.RelativeDir)').Replace($(TestSourceDir),$(__NativeTestIntermediatesDir)\))$(Configuration)\" Condition="'$(RunningOnUnix)' != 'true'" />
+ <NativeProjectOutputFoldersToCopy Include="$([System.String]::Copy('%(NativeProjectReferenceNormalized.RelativeDir)').Replace($(TestSourceDir),$(__NativeTestIntermediatesDir)\))" Condition="'$(UseVisualStudioNativeBinariesLayout)' != 'true'" />
+ <NativeProjectOutputFoldersToCopy Include="$([System.String]::Copy('%(NativeProjectReferenceNormalized.RelativeDir)').Replace($(TestSourceDir),$(__NativeTestIntermediatesDir)\))$(Configuration)\" Condition="'$(UseVisualStudioNativeBinariesLayout)' == 'true'" />
</ItemGroup>
<Message Text= "Full native project references are :%(NativeProjectReferenceNormalized.Identity)" />
@@ -271,7 +285,7 @@
<AllResolvedRuntimeDependencies Include="@(RuntimeCopyLocalItems -> '%(FileName)%(Extension)');@(NativeCopyLocalItems -> '%(FileName)%(Extension)')">
<File>%(Identity)</File>
</AllResolvedRuntimeDependencies>
-
+
<RunTimeDependencyCopyLocalFile Include="@(AllResolvedRuntimeDependencies)" Exclude="@(RunTimeDependencyExcludeFiles)"/>
<RunTimeDependencyCopyLocal Include="@(RunTimeDependencyCopyLocalFile -> '%(File)')" />
<RunTimeDependencyCopyLocal Include="$(TargetingPackPath)/*" />
@@ -367,7 +381,7 @@
<RunTimeDependencyCopyLocal
Include="$(RepoRoot)\src\tests\Common\wasm-test-runner\WasmTestRunner.proj"
TargetDir="wasm-test-runner/"/>
-
+
<RunTimeDependencyCopyLocal
Include="$(MonoProjectRoot)\wasm\runtime-test.js"
TargetDir="runtime-test/"/>
diff --git a/src/tests/Interop/COM/Dynamic/Server/CMakeLists.txt b/src/tests/Interop/COM/Dynamic/Server/CMakeLists.txt
index 2708ce303ae..51c8ecd4aed 100644
--- a/src/tests/Interop/COM/Dynamic/Server/CMakeLists.txt
+++ b/src/tests/Interop/COM/Dynamic/Server/CMakeLists.txt
@@ -11,7 +11,7 @@ add_custom_command(
COMMAND ${MIDL} ${MIDL_INCLUDE_DIRECTORIES}
/h ${IDL_OUTPUT_DIRECTORY}/${IDL_NAME}.h ${MIDL_DEFINITIONS}
/out ${IDL_OUTPUT_DIRECTORY}
- /tlb ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/DynamicTestServer.tlb
+ /tlb $<TARGET_FILE_DIR:${PROJECT_NAME}>/DynamicTestServer.tlb
${IDL_SOURCE}
DEPENDS ${IDL_SOURCE}
COMMENT "Compiling ${IDL_SOURCE}")
@@ -37,7 +37,7 @@ add_library (${PROJECT_NAME} SHARED ${SOURCES})
target_link_libraries(${PROJECT_NAME} ${LINK_LIBRARIES_ADDITIONAL})
# Copy manifest file to project output
-file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/DynamicTestServer.X.manifest INPUT ${CMAKE_CURRENT_SOURCE_DIR}/DynamicTestServer.X.manifest)
+file(GENERATE OUTPUT $<TARGET_FILE_DIR:${PROJECT_NAME}>/DynamicTestServer.X.manifest INPUT ${CMAKE_CURRENT_SOURCE_DIR}/DynamicTestServer.X.manifest)
# add the install targets
install (TARGETS ${PROJECT_NAME} DESTINATION bin)
diff --git a/src/tests/Interop/COM/NativeClients/DefaultInterfaces/CMakeLists.txt b/src/tests/Interop/COM/NativeClients/DefaultInterfaces/CMakeLists.txt
index 38954f3d1d2..b5eb8e0a557 100644
--- a/src/tests/Interop/COM/NativeClients/DefaultInterfaces/CMakeLists.txt
+++ b/src/tests/Interop/COM/NativeClients/DefaultInterfaces/CMakeLists.txt
@@ -11,7 +11,7 @@ add_executable (COMClientDefaultInterfaces ${SOURCES})
target_link_libraries(COMClientDefaultInterfaces ${LINK_LIBRARIES_ADDITIONAL})
# Copy CoreShim manifest to project output
-file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/CoreShim.X.manifest INPUT ${CMAKE_CURRENT_SOURCE_DIR}/CoreShim.X.manifest)
+file(GENERATE OUTPUT $<TARGET_FILE_DIR:${PROJECT_NAME}>/CoreShim.X.manifest INPUT ${CMAKE_CURRENT_SOURCE_DIR}/CoreShim.X.manifest)
# add the install targets
install (TARGETS COMClientDefaultInterfaces DESTINATION bin)
diff --git a/src/tests/Interop/COM/NativeClients/Dispatch/CMakeLists.txt b/src/tests/Interop/COM/NativeClients/Dispatch/CMakeLists.txt
index a8a8bba03cc..d377599d085 100644
--- a/src/tests/Interop/COM/NativeClients/Dispatch/CMakeLists.txt
+++ b/src/tests/Interop/COM/NativeClients/Dispatch/CMakeLists.txt
@@ -10,7 +10,7 @@ add_executable (COMClientDispatch ${SOURCES})
target_link_libraries(COMClientDispatch ${LINK_LIBRARIES_ADDITIONAL})
# Copy CoreShim manifest to project output
-file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/CoreShim.X.manifest INPUT ${CMAKE_CURRENT_SOURCE_DIR}/CoreShim.X.manifest)
+file(GENERATE OUTPUT $<TARGET_FILE_DIR:COMClientDispatch>/CoreShim.X.manifest INPUT ${CMAKE_CURRENT_SOURCE_DIR}/CoreShim.X.manifest)
# add the install targets
install (TARGETS COMClientDispatch DESTINATION bin)
diff --git a/src/tests/Interop/COM/NativeClients/Events/CMakeLists.txt b/src/tests/Interop/COM/NativeClients/Events/CMakeLists.txt
index 43063bd532d..d80b993c18f 100644
--- a/src/tests/Interop/COM/NativeClients/Events/CMakeLists.txt
+++ b/src/tests/Interop/COM/NativeClients/Events/CMakeLists.txt
@@ -11,7 +11,7 @@ add_executable (COMClientEvents ${SOURCES})
target_link_libraries(COMClientEvents ${LINK_LIBRARIES_ADDITIONAL})
# Copy CoreShim manifest to project output
-file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/CoreShim.X.manifest INPUT ${CMAKE_CURRENT_SOURCE_DIR}/CoreShim.X.manifest)
+file(GENERATE OUTPUT $<TARGET_FILE_DIR:${PROJECT_NAME}>/CoreShim.X.manifest INPUT ${CMAKE_CURRENT_SOURCE_DIR}/CoreShim.X.manifest)
# add the install targets
install (TARGETS COMClientEvents DESTINATION bin)
diff --git a/src/tests/Interop/COM/NativeClients/Licensing/CMakeLists.txt b/src/tests/Interop/COM/NativeClients/Licensing/CMakeLists.txt
index d850c7ee067..70b85b0cb0e 100644
--- a/src/tests/Interop/COM/NativeClients/Licensing/CMakeLists.txt
+++ b/src/tests/Interop/COM/NativeClients/Licensing/CMakeLists.txt
@@ -11,7 +11,7 @@ add_executable (COMClientLicensing ${SOURCES})
target_link_libraries(COMClientLicensing ${LINK_LIBRARIES_ADDITIONAL})
# Copy CoreShim manifest to project output
-file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/CoreShim.X.manifest INPUT ${CMAKE_CURRENT_SOURCE_DIR}/CoreShim.X.manifest)
+file(GENERATE OUTPUT $<TARGET_FILE_DIR:${PROJECT_NAME}>/CoreShim.X.manifest INPUT ${CMAKE_CURRENT_SOURCE_DIR}/CoreShim.X.manifest)
# add the install targets
install (TARGETS COMClientLicensing DESTINATION bin)
diff --git a/src/tests/Interop/COM/NativeClients/Primitives/CMakeLists.txt b/src/tests/Interop/COM/NativeClients/Primitives/CMakeLists.txt
index 57af5d8af9b..62ca91cd428 100644
--- a/src/tests/Interop/COM/NativeClients/Primitives/CMakeLists.txt
+++ b/src/tests/Interop/COM/NativeClients/Primitives/CMakeLists.txt
@@ -16,7 +16,7 @@ add_executable (COMClientPrimitives ${SOURCES})
target_link_libraries(COMClientPrimitives ${LINK_LIBRARIES_ADDITIONAL})
# Copy CoreShim manifest to project output
-file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/CoreShim.X.manifest INPUT ${CMAKE_CURRENT_SOURCE_DIR}/CoreShim.X.manifest)
+file(GENERATE OUTPUT $<TARGET_FILE_DIR:${PROJECT_NAME}>/CoreShim.X.manifest INPUT ${CMAKE_CURRENT_SOURCE_DIR}/CoreShim.X.manifest)
# add the install targets
install (TARGETS COMClientPrimitives DESTINATION bin)
diff --git a/src/tests/Interop/COM/NativeServer/CMakeLists.txt b/src/tests/Interop/COM/NativeServer/CMakeLists.txt
index 9f661bfb9e6..1f757d8e9cd 100644
--- a/src/tests/Interop/COM/NativeServer/CMakeLists.txt
+++ b/src/tests/Interop/COM/NativeServer/CMakeLists.txt
@@ -13,7 +13,7 @@ add_library (COMNativeServer SHARED ${SOURCES})
target_link_libraries(COMNativeServer ${LINK_LIBRARIES_ADDITIONAL})
# Copy manifest file to project output
-file(GENERATE OUTPUT ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/COMNativeServer.X.manifest INPUT ${CMAKE_CURRENT_SOURCE_DIR}/COMNativeServer.X.manifest)
+file(GENERATE OUTPUT $<TARGET_FILE_DIR:${PROJECT_NAME}>/COMNativeServer.X.manifest INPUT ${CMAKE_CURRENT_SOURCE_DIR}/COMNativeServer.X.manifest)
# add the install targets
install (TARGETS COMNativeServer DESTINATION bin)
diff --git a/src/tests/build.cmd b/src/tests/build.cmd
index 176dd072974..b4f9a7b0702 100644
--- a/src/tests/build.cmd
+++ b/src/tests/build.cmd
@@ -55,6 +55,7 @@ set __CopyNativeTestBinaries=0
set __CopyNativeProjectsAfterCombinedTestBuild=true
set __SkipGenerateLayout=0
set __GenerateLayoutOnly=0
+set __Ninja=1
@REM CMD has a nasty habit of eating "=" on the argument list, so passing:
@REM -priority=1
@@ -97,6 +98,7 @@ if /i "%1" == "copynativeonly" (set __CopyNativeTestBinaries=1&set __Skip
if /i "%1" == "generatelayoutonly" (set __SkipManaged=1&set __SkipNative=1&set __CopyNativeProjectsAfterCombinedTestBuild=false&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "buildtestwrappersonly" (set __SkipNative=1&set __SkipManaged=1&set __BuildTestWrappersOnly=1&set __SkipGenerateLayout=1&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
+if /i "%1" == "-msbuild" (set __Ninja=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "buildagainstpackages" (echo error: Remove /BuildAgainstPackages switch&&exit /b1)
if /i "%1" == "crossgen" (set __DoCrossgen=1&set __TestBuildMode=crossgen&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
if /i "%1" == "crossgen2" (set __DoCrossgen2=1&set __TestBuildMode=crossgen2&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop)
@@ -159,6 +161,7 @@ if not defined __TestIntermediateDir (
set "__TestIntermediateDir=tests\coreclr\obj\%__TargetOS%.%__BuildArch%.%__BuildType%"
)
set "__NativeTestIntermediatesDir=%__RootBinDir%\%__TestIntermediateDir%\Native"
+if "%__Ninja%"=="0" (set "__NativeTestIntermediatesDir=%__NativeTestIntermediatesDir%\ide")
set "__ManagedTestIntermediatesDir=%__RootBinDir%\%__TestIntermediateDir%\Managed"
REM Generate path to be set for CMAKE_INSTALL_PREFIX to contain forward slash
@@ -211,7 +214,13 @@ echo %__MsgPrefix%Using environment: "%__VCToolsRoot%\vcvarsall.bat" %__VCBuildA
call "%__VCToolsRoot%\vcvarsall.bat" %__VCBuildArch%
@if defined _echo @echo on
-set __ExtraCmakeArgs="-DCMAKE_SYSTEM_VERSION=10.0"
+set __ExtraCmakeArgs=
+
+if %__Ninja% EQU 1 (
+ set __ExtraCmakeArgs="-DCMAKE_SYSTEM_VERSION=10.0 -DCMAKE_BUILD_TYPE=!__BuildType!"
+) else (
+ set __ExtraCmakeArgs="-DCMAKE_SYSTEM_VERSION=10.0"
+)
call "%__RepoRootDir%\eng\native\gen-buildsys.cmd" "%__ProjectFilesDir%" "%__NativeTestIntermediatesDir%" %__VSVersion% %__BuildArch% !__ExtraCmakeArgs!
if not !errorlevel! == 0 (
@@ -237,8 +246,16 @@ set __MsbuildWrn=/flp1:WarningsOnly;LogFile=!__BuildWrn!
set __MsbuildErr=/flp2:ErrorsOnly;LogFile=!__BuildErr!
set __Logging=!__MsbuildLog! !__MsbuildWrn! !__MsbuildErr!
-REM We pass the /m flag directly to MSBuild so that we can get both MSBuild and CL parallelism, which is fastest for our builds.
-"%CMakePath%" --build %__NativeTestIntermediatesDir% --target install --config %__BuildType% -- /nologo /m !__Logging!
+set __CmakeBuildToolArgs=
+
+if %__Ninja% EQU 1 (
+ set __CmakeBuildToolArgs=
+) else (
+ REM We pass the /m flag directly to MSBuild so that we can get both MSBuild and CL parallelism, which is fastest for our builds.
+ set __CmakeBuildToolArgs=/nologo /m !__Logging!
+)
+
+"%CMakePath%" --build %__NativeTestIntermediatesDir% --target install --config %__BuildType% -- !__CmakeBuildToolArgs!
if errorlevel 1 (
echo %__ErrMsgPrefix%%__MsgPrefix%Error: native test build failed.
@@ -310,6 +327,12 @@ echo %__MsgPrefix%Building tests divided into %__NumberOfTestGroups% test groups
set __CommonMSBuildCmdPrefix=powershell -NoProfile -ExecutionPolicy ByPass -NoLogo -Command "!__RepoRootDir!\eng\common\msbuild.ps1" !__ArcadeScriptArgs!
+set __NativeBinariesLayoutTypeArg=
+
+if %__Ninja% == 0 (
+ set __NativeBinariesLayoutTypeArg=/p:UseVisualStudioNativeBinariesLayout=true
+)
+
for /l %%G in (1, 1, %__NumberOfTestGroups%) do (
set __MsbuildLog=/flp:Verbosity=normal;LogFile="%__BuildLog%";Append=!__AppendToLog!
@@ -330,6 +353,7 @@ for /l %%G in (1, 1, %__NumberOfTestGroups%) do (
set __MSBuildBuildArgs=!__MSBuildBuildArgs! !__UnprocessedBuildArgs!
set __MSBuildBuildArgs=!__MSBuildBuildArgs! /p:CopyNativeProjectBinaries=!__CopyNativeProjectsAfterCombinedTestBuild!
set __MSBuildBuildArgs=!__MSBuildBuildArgs! /p:__SkipPackageRestore=true
+ set __MSBuildBuildArgs=!__MSBuildBuildArgs! !__NativeBinariesLayoutTypeArg!
echo Running: msbuild !__MSBuildBuildArgs!
!__CommonMSBuildCmdPrefix! !__MSBuildBuildArgs!
@@ -344,7 +368,7 @@ for /l %%G in (1, 1, %__NumberOfTestGroups%) do (
goto :Exit_Failure
)
) else (
- set __MSBuildBuildArgs=!__RepoRootDir!\src\tests\build.proj -warnAsError:0 /nodeReuse:false !__Logging! !TargetsWindowsMsbuildArg! !__msbuildArgs! !__PriorityArg! !__BuildNeedTargetArg! !__UnprocessedBuildArgs! "/t:CopyAllNativeProjectReferenceBinaries"
+ set __MSBuildBuildArgs=!__RepoRootDir!\src\tests\build.proj -warnAsError:0 /nodeReuse:false !__Logging! !TargetsWindowsMsbuildArg! !__msbuildArgs! !__PriorityArg! !__BuildNeedTargetArg! !__NativeBinariesLayoutTypeArg! !__UnprocessedBuildArgs! "/t:CopyAllNativeProjectReferenceBinaries"
echo Running: msbuild !__MSBuildBuildArgs!
!__CommonMSBuildCmdPrefix! !__MSBuildBuildArgs!