From 72fe54e6fd9e14393a9713611963eb61112d4fe4 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Tue, 16 Mar 2021 16:31:26 -0700 Subject: [PATCH 01/18] Remove all references to the subset args in the CMakeLists.txt files Add a -component flag to the native build scripts to control which components are built. Remove the old -skipX flags and use the component flags instead. Move symbol stripping for CoreCLR out of the install step and into the add_library/executable step to ensure we only strip once when a file can be installed for multiple components. Fix specifying all subsets. mark corerun and coreshim as runtime components. Move cross-component build targets onto the componentized plan. Remove _install function since the check it does is no longer needed. Implicitly add dependencies for runtime/all_jits metatargets. Move paltests to the component plan. Fixes for unix platform builds Add clr.native subset to build the full clr project. Don't build pal tests as part of the default build. Make targets without a specific component automatically be built by any non-crosscomponent subcomponent. Move libraries CMake build to stop using environment variables. Don't rerun Cmake configure if the command line hasn't changed since the last run. Saves about 15 seconds on a no-op incremental build. Non-Windows impl still tbd Add iltools subset. Since we're at a point where combinatorial explosion makes it untenable to support combinatorial targets, use the multiple-targets feature of CMake when available (thankfully Windows is included in this set) and otherwise use the underlying build tool. Disable command line up-to-date check for VS. Implement command-line check for cmake reconfigure for Unix platforms as well. --- eng/Subsets.props | 15 +- eng/native/build-commons.sh | 30 ++-- eng/native/functions.cmake | 151 ++++++++++-------- eng/native/gen-buildsys.cmd | 26 ++- eng/native/gen-buildsys.sh | 13 ++ src/coreclr/CMakeLists.txt | 83 +++++----- src/coreclr/ToolBox/SOS/CMakeLists.txt | 2 +- .../ToolBox/superpmi/mcs/CMakeLists.txt | 6 +- .../superpmi-shim-collector/CMakeLists.txt | 6 +- .../superpmi-shim-counter/CMakeLists.txt | 6 +- .../superpmi-shim-simple/CMakeLists.txt | 6 +- .../ToolBox/superpmi/superpmi/CMakeLists.txt | 6 +- src/coreclr/_build-commons.sh | 2 +- src/coreclr/build-runtime.cmd | 45 ++++-- src/coreclr/build-runtime.sh | 47 +++--- src/coreclr/components.cmake | 21 +++ src/coreclr/crosscomponents.cmake | 22 +-- src/coreclr/debug/createdump/CMakeLists.txt | 8 +- src/coreclr/debug/debug-pal/CMakeLists.txt | 2 +- src/coreclr/debug/runtimeinfo/CMakeLists.txt | 2 +- src/coreclr/dlls/clretwrc/CMakeLists.txt | 2 +- src/coreclr/dlls/dbgshim/CMakeLists.txt | 2 +- src/coreclr/dlls/mscordac/CMakeLists.txt | 6 +- src/coreclr/dlls/mscordbi/CMakeLists.txt | 2 +- .../dlls/mscoree/coreclr/CMakeLists.txt | 3 +- src/coreclr/dlls/mscorrc/CMakeLists.txt | 2 +- src/coreclr/gc/CMakeLists.txt | 2 +- src/coreclr/gc/sample/CMakeLists.txt | 2 +- src/coreclr/gcinfo/CMakeLists.txt | 33 ++-- src/coreclr/hosts/corerun/CMakeLists.txt | 4 +- src/coreclr/hosts/coreshim/CMakeLists.txt | 2 +- src/coreclr/ilasm/CMakeLists.txt | 4 +- src/coreclr/ildasm/exe/CMakeLists.txt | 4 +- src/coreclr/inc/CMakeLists.txt | 4 +- src/coreclr/jit/CMakeLists.txt | 48 +++--- src/coreclr/nativeresources/CMakeLists.txt | 2 +- src/coreclr/pal/CMakeLists.txt | 6 +- src/coreclr/pal/prebuilt/inc/CMakeLists.txt | 2 +- src/coreclr/pal/src/CMakeLists.txt | 2 +- .../lttngprovider/CMakeLists.txt | 9 +- src/coreclr/pal/tests/palsuite/CMakeLists.txt | 9 +- .../palsuite/eventprovider/CMakeLists.txt | 6 +- .../pal_sxs/test1/CMakeLists.txt | 13 +- src/coreclr/palrt/CMakeLists.txt | 2 +- src/coreclr/runtime.proj | 11 +- src/coreclr/tools/CMakeLists.txt | 4 +- .../tools/GenClrDebugResource/CMakeLists.txt | 2 +- .../tools/InjectResource/CMakeLists.txt | 2 +- src/coreclr/vm/CMakeLists.txt | 14 +- src/libraries/Native/Windows/CMakeLists.txt | 8 +- .../CMakeLists.txt | 2 +- src/libraries/Native/build-native.cmd | 1 - src/libraries/Native/build-native.sh | 4 +- src/native/corehost/build.sh | 2 +- src/native/corehost/setup.cmake | 2 +- src/tests/build.sh | 2 +- 56 files changed, 419 insertions(+), 305 deletions(-) create mode 100644 src/coreclr/components.cmake diff --git a/eng/Subsets.props b/eng/Subsets.props index 882de1fdc4b59f..705ac571d820ab 100644 --- a/eng/Subsets.props +++ b/eng/Subsets.props @@ -40,7 +40,7 @@ - clr.runtime+clr.jit+clr.alljits+linuxdac+clr.corelib+clr.tools+clr.nativecorelib+clr.packages + clr.native+linuxdac+clr.corelib+clr.tools+clr.nativecorelib+clr.packages mono.llvm+ mono.llvm+ @@ -78,8 +78,9 @@ - - + + + @@ -150,7 +151,11 @@ - $(ClrRuntimeBuildSubsets);ClrRuntimeSubset=true;ClrJitSubset=true + $(ClrRuntimeBuildSubsets);ClrRuntimeSubset=true + + + + $(ClrRuntimeBuildSubsets);ClrFullNativeBuild=true @@ -162,7 +167,7 @@ - $(ClrRuntimeBuildSubsets);ClrAllJitsSubset=true;ClrJitSubset=true + $(ClrRuntimeBuildSubsets);ClrAllJitsSubset=true diff --git a/eng/native/build-commons.sh b/eng/native/build-commons.sh index 400a3f3d4226ac..d6efc448e57430 100755 --- a/eng/native/build-commons.sh +++ b/eng/native/build-commons.sh @@ -72,11 +72,12 @@ build_native() platformArch="$2" cmakeDir="$3" intermediatesDir="$4" - cmakeArgs="$5" - message="$6" + target="$5" + cmakeArgs="$6" + message="$7" # All set to commence the build - echo "Commencing build of \"$message\" for $__TargetOS.$__BuildArch.$__BuildType in $intermediatesDir" + echo "Commencing build of \"$target\" target in \"$message\" for $__TargetOS.$__BuildArch.$__BuildType in $intermediatesDir" if [[ "$targetOS" == OSX || "$targetOS" == MacCatalyst ]]; then if [[ "$platformArch" == x64 ]]; then @@ -188,20 +189,29 @@ EOF pushd "$intermediatesDir" buildTool="$SCAN_BUILD_COMMAND -o $__BinDir/scan-build-log $buildTool" - echo "Executing $buildTool install -j $__NumProc" - "$buildTool" install -j "$__NumProc" + echo "Executing $buildTool $target -j $__NumProc" + "$buildTool" $target -j "$__NumProc" exit_code="$?" popd else cmake_command=cmake if [[ "$build_arch" == "wasm" ]]; then - cmake_command="emcmake $cmake_command" - fi + cmake_command="emcmake cmake" + echo "Executing $cmake_command --build \"$intermediatesDir\" --target $target -- -j $__NumProc" + $cmake_command --build "$intermediatesDir" --target $target -- -j "$__NumProc" + exit_code="$?" + else + # For non-wasm Unix scenarios, we may have to use an old version of CMake that doesn't support + # multiple targets. Instead, directly invoke the build tool to build multiple targets in one invocation. + pushd "$intermediatesDir" - echo "Executing $cmake_command --build \"$intermediatesDir\" --target install -- -j $__NumProc" - $cmake_command --build "$intermediatesDir" --target install -- -j "$__NumProc" - exit_code="$?" + echo "Executing $buildTool $target -j $__NumProc" + "$buildTool" $target -j "$__NumProc" + exit_code="$?" + + popd + fi fi CFLAGS="${SAVED_CFLAGS}" diff --git a/eng/native/functions.cmake b/eng/native/functions.cmake index f39fb67bd0cf53..db9d235ea9276a 100644 --- a/eng/native/functions.cmake +++ b/eng/native/functions.cmake @@ -206,6 +206,27 @@ function(compile_asm) set(${COMPILE_ASM_OUTPUT_OBJECTS} ${ASSEMBLED_OBJECTS} PARENT_SCOPE) endfunction() +# add_component(componentName [targetName] [EXCLUDE_FROM_ALL]) +function(add_component componentName) + if (${ARGC} GREATER 2 OR ${ARGC} EQUAL 2) + set(componentTargetName "${ARGV1}") + else() + set(componentTargetName "${componentName}") + endif() + if (${ARGC} EQUAL 3 AND "${ARG2}" STREQUAL "EXCLUDE_FROM_ALL") + set(exclude_from_all_flag "EXCLUDE_FROM_ALL") + endif() + get_property(definedComponents GLOBAL PROPERTY CLR_CMAKE_COMPONENTS) + list (FIND definedComponents "${componentName}" componentIndex) + if (${componentIndex} EQUAL -1) + list (APPEND definedComponents "${componentName}") + add_custom_target("${componentTargetName}" + COMMAND "${CMAKE_COMMAND}" "-DCMAKE_INSTALL_COMPONENT=${componentName}" -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" + ${exclude_from_all_flag}) + set_property(GLOBAL PROPERTY CLR_CMAKE_COMPONENTS ${definedComponents}) + endif() +endfunction() + function(generate_exports_file) set(INPUT_LIST ${ARGN}) list(GET INPUT_LIST -1 outputFilename) @@ -248,12 +269,29 @@ function(generate_exports_file_prefix inputFilename outputFilename prefix) PROPERTIES GENERATED TRUE) endfunction() +function (get_symbol_file_name targetName outputSymbolFilename) + if (CLR_CMAKE_HOST_UNIX) + if (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) + set(strip_destination_file $.dwarf) + else () + set(strip_destination_file $.dbg) + endif () + + set(${outputSymbolFilename} ${strip_destination_file} PARENT_SCOPE) + else(CLR_CMAKE_HOST_UNIX) + # We can't use the $ generator expression here since + # the generator expression isn't supported on resource DLLs. + set(${outputSymbolFilename} $/$$.pdb PARENT_SCOPE) + endif(CLR_CMAKE_HOST_UNIX) +endfunction() + function(strip_symbols targetName outputFilename) + get_symbol_file_name(${targetName} strip_destination_file) + set(${outputFilename} ${strip_destination_file} PARENT_SCOPE) if (CLR_CMAKE_HOST_UNIX) set(strip_source_file $) if (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) - set(strip_destination_file ${strip_source_file}.dwarf) # Ensure that dsymutil and strip are present find_program(DSYMUTIL dsymutil) @@ -282,7 +320,6 @@ function(strip_symbols targetName outputFilename) COMMENT "Stripping symbols from ${strip_source_file} into file ${strip_destination_file}" ) else (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) - set(strip_destination_file ${strip_source_file}.dbg) add_custom_command( TARGET ${targetName} @@ -294,26 +331,13 @@ function(strip_symbols targetName outputFilename) COMMENT "Stripping symbols from ${strip_source_file} into file ${strip_destination_file}" ) endif (CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) - - set(${outputFilename} ${strip_destination_file} PARENT_SCOPE) - else(CLR_CMAKE_HOST_UNIX) - get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) - if(is_multi_config) - # We can't use the $ generator expression here since - # the generator expression isn't supported on resource DLLs. - set(${outputFilename} ${CMAKE_CURRENT_BINARY_DIR}/$/${targetName}.pdb PARENT_SCOPE) - else() - # We can't use the $ generator expression here since - # the generator expression isn't supported on resource DLLs. - set(${outputFilename} ${CMAKE_CURRENT_BINARY_DIR}/${targetName}.pdb PARENT_SCOPE) - endif() endif(CLR_CMAKE_HOST_UNIX) endfunction() function(install_with_stripped_symbols targetName kind destination) if(NOT CLR_CMAKE_KEEP_NATIVE_SYMBOLS) strip_symbols(${targetName} symbol_file) - install_symbols(${symbol_file} ${destination}) + install_symbol_file(${symbol_file} ${destination}) endif() if ((CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) AND ("${kind}" STREQUAL "TARGETS")) @@ -331,18 +355,20 @@ function(install_with_stripped_symbols targetName kind destination) install(${kind} ${install_source} DESTINATION ${destination}) endfunction() -function(install_symbols symbol_file destination_path) +function(install_symbol_file symbol_file destination_path) if(CLR_CMAKE_TARGET_WIN32) - install(FILES ${symbol_file} DESTINATION ${destination_path}/PDB) + install(FILES ${symbol_file} DESTINATION ${destination_path}/PDB ${ARGN}) else() - install(FILES ${symbol_file} DESTINATION ${destination_path}) + install(FILES ${symbol_file} DESTINATION ${destination_path} ${ARGN}) endif() endfunction() -# install_clr(TARGETS TARGETS targetName [targetName2 ...] [ADDITIONAL_DESTINATIONS destination]) +# install_clr(TARGETS targetName [targetName2 ...] [ADDITIONAL_DESTINATIONS destination]) function(install_clr) set(multiValueArgs TARGETS ADDITIONAL_DESTINATIONS) - cmake_parse_arguments(INSTALL_CLR "" "" "${multiValueArgs}" ${ARGV}) + set(singleValueArgs COMPONENT) + set(options "") + cmake_parse_arguments(INSTALL_CLR "${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGV}) if ("${INSTALL_CLR_TARGETS}" STREQUAL "") message(FATAL_ERROR "At least one target must be passed to install_clr(TARGETS )") @@ -354,33 +380,42 @@ function(install_clr) list(APPEND destinations ${INSTALL_CLR_ADDITIONAL_DESTINATIONS}) endif() + if ("${INSTALL_CLR_COMPONENT}" STREQUAL "") + set(INSTALL_CLR_COMPONENT ${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}) + endif() + foreach(targetName ${INSTALL_CLR_TARGETS}) - list(FIND CLR_CROSS_COMPONENTS_LIST ${targetName} INDEX) - if (NOT DEFINED CLR_CROSS_COMPONENTS_LIST OR NOT ${INDEX} EQUAL -1) - if (NOT CLR_CMAKE_KEEP_NATIVE_SYMBOLS) - strip_symbols(${targetName} symbol_file) - endif() + if (NOT "${INSTALL_CLR_COMPONENT}" STREQUAL "${targetName}") + get_property(definedComponents GLOBAL PROPERTY CLR_CMAKE_COMPONENTS) + list(FIND definedComponents "${INSTALL_CLR_COMPONENT}" componentIdx) + if (${componentIdx} EQUAL -1) + message(FATAL_ERROR "The ${INSTALL_CLR_COMPONENT} component is not defined. Call add_component to define the component in the build.") + endif() + add_dependencies(${INSTALL_CLR_COMPONENT} ${targetName}) + endif() + if (NOT CLR_CMAKE_KEEP_NATIVE_SYMBOLS) + get_symbol_file_name(${targetName} symbol_file) + endif() - foreach(destination ${destinations}) - # We don't need to install the export libraries for our DLLs - # since they won't be directly linked against. - install(PROGRAMS $ DESTINATION ${destination}) - if (NOT CLR_CMAKE_KEEP_NATIVE_SYMBOLS) - install_symbols(${symbol_file} ${destination}) - endif() + foreach(destination ${destinations}) + # We don't need to install the export libraries for our DLLs + # since they won't be directly linked against. + install(PROGRAMS $ DESTINATION ${destination} COMPONENT ${INSTALL_CLR_COMPONENT}) + if (NOT CLR_CMAKE_KEEP_NATIVE_SYMBOLS) + install_symbol_file(${symbol_file} ${destination} COMPONENT ${INSTALL_CLR_COMPONENT}) + endif() - if(CLR_CMAKE_PGO_INSTRUMENT) - if(WIN32) - get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) - if(is_multi_config) - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/$/${targetName}.pgd DESTINATION ${destination}/PGD OPTIONAL) - else() - install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${targetName}.pgd DESTINATION ${destination}/PGD OPTIONAL) - endif() - endif() + if(CLR_CMAKE_PGO_INSTRUMENT) + if(WIN32) + get_property(is_multi_config GLOBAL PROPERTY GENERATOR_IS_MULTI_CONFIG) + if(is_multi_config) + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/$/${targetName}.pgd DESTINATION ${destination}/PGD OPTIONAL COMPONENT ${INSTALL_CLR_COMPONENT}) + else() + install(FILES ${CMAKE_CURRENT_BINARY_DIR}/${targetName}.pgd DESTINATION ${destination}/PGD OPTIONAL COMPONENT ${INSTALL_CLR_COMPONENT}) endif() - endforeach() - endif() + endif() + endif() + endforeach() endforeach() endfunction() @@ -422,45 +457,29 @@ if (CMAKE_VERSION VERSION_LESS "3.16") endfunction() endif() -function(_add_executable) +function(add_executable_clr) if(NOT WIN32) add_executable(${ARGV} ${VERSION_FILE_PATH}) disable_pax_mprotect(${ARGV}) else() add_executable(${ARGV}) endif(NOT WIN32) - list(FIND CLR_CROSS_COMPONENTS_LIST ${ARGV0} INDEX) - if (DEFINED CLR_CROSS_COMPONENTS_LIST AND ${INDEX} EQUAL -1) - set_target_properties(${ARGV0} PROPERTIES EXCLUDE_FROM_ALL 1) + if(NOT CLR_CMAKE_KEEP_NATIVE_SYMBOLS) + strip_symbols(${ARGV0} symbolFile) endif() endfunction() -function(_add_library) +function(add_library_clr) if(NOT WIN32 AND "${ARGV1}" STREQUAL "SHARED") add_library(${ARGV} ${VERSION_FILE_PATH}) else() add_library(${ARGV}) endif(NOT WIN32 AND "${ARGV1}" STREQUAL "SHARED") - list(FIND CLR_CROSS_COMPONENTS_LIST ${ARGV0} INDEX) - if (DEFINED CLR_CROSS_COMPONENTS_LIST AND ${INDEX} EQUAL -1) - set_target_properties(${ARGV0} PROPERTIES EXCLUDE_FROM_ALL 1) + if("${ARGV1}" STREQUAL "SHARED" AND NOT CLR_CMAKE_KEEP_NATIVE_SYMBOLS) + strip_symbols(${ARGV0} symbolFile) endif() endfunction() -function(_install) - if(NOT DEFINED CLR_CROSS_COMPONENTS_BUILD) - install(${ARGV}) - endif() -endfunction() - -function(add_library_clr) - _add_library(${ARGV}) -endfunction() - -function(add_executable_clr) - _add_executable(${ARGV}) -endfunction() - function(generate_module_index Target ModuleIndexFile) if(CLR_CMAKE_HOST_WIN32) set(scriptExt ".cmd") diff --git a/eng/native/gen-buildsys.cmd b/eng/native/gen-buildsys.cmd index aef95a01857d3e..69bd394360b479 100644 --- a/eng/native/gen-buildsys.cmd +++ b/eng/native/gen-buildsys.cmd @@ -30,7 +30,7 @@ if /i "%__Ninja%" == "1" ( if /i NOT "%__Arch%" == "wasm" ( if /i "%__VSVersion%" == "vs2019" (set __CmakeGenerator=%__CmakeGenerator% 16 2019) if /i "%__VSVersion%" == "vs2017" (set __CmakeGenerator=%__CmakeGenerator% 15 2017) - + if /i "%__Arch%" == "x64" (set __ExtraCmakeParams=%__ExtraCmakeParams% -A x64) if /i "%__Arch%" == "arm" (set __ExtraCmakeParams=%__ExtraCmakeParams% -A ARM) if /i "%__Arch%" == "arm64" (set __ExtraCmakeParams=%__ExtraCmakeParams% -A ARM64) @@ -67,10 +67,32 @@ goto loop set __ExtraCmakeParams="-DCMAKE_INSTALL_PREFIX=%__CMakeBinDir%" "-DCLR_CMAKE_HOST_ARCH=%__Arch%" %__ExtraCmakeParams% +set __CmdLineOptionsUpToDateFile=%__IntermediatesDir%\cmake_cmd_line.txt +set __CMakeCmdLineCache= +if not "%__ConfigureOnly%" == "1" ( + REM MSBuild can't reload from a CMake reconfigure during build correctly, so only do this + REM command-line up to date check for non-VS generators. + if not "%__CmakeGenerator%" == "Visual Studio" ( + if exist "%__CmdLineOptionsUpToDateFile%" ( + set /p __CMakeCmdLineCache=<"%__CmdLineOptionsUpToDateFile%" + REM Strip the extra space from the end of the cached command line + if [!__ExtraCmakeParams!] == [!__CMakeCmdLineCache:~0,-1!] ( + echo The CMake command line is the same as the last run. Skipping running CMake. + exit /B 0 + ) else ( + echo The CMake command line different from the last run. Running CMake again. + echo %__ExtraCmakeParams% > %__CmdLineOptionsUpToDateFile% + ) + ) else ( + echo %__ExtraCmakeParams% > %__CmdLineOptionsUpToDateFile% + ) + ) +) + if /i "%__UseEmcmake%" == "1" ( call !EMSDK_PATH!/emsdk_env.bat > nul 2>&1 && emcmake "%CMakePath%" %__ExtraCmakeParams% --no-warn-unused-cli -G "%__CmakeGenerator%" -B %__IntermediatesDir% -S %__SourceDir% ) else ( - "%CMakePath%" %__ExtraCmakeParams% --no-warn-unused-cli -G "%__CmakeGenerator%" -B %__IntermediatesDir% -S %__SourceDir% + "%CMakePath%" %__ExtraCmakeParams% --no-warn-unused-cli -G "%__CmakeGenerator%" -B %__IntermediatesDir% -S %__SourceDir% ) endlocal exit /B %errorlevel% diff --git a/eng/native/gen-buildsys.sh b/eng/native/gen-buildsys.sh index f852ae0b25c862..f671182e473e90 100755 --- a/eng/native/gen-buildsys.sh +++ b/eng/native/gen-buildsys.sh @@ -97,6 +97,19 @@ if [[ "$build_arch" == "wasm" ]]; then cmake_command="emcmake $cmake_command" fi +cmake_args_to_cache="$scan_build\n$SCAN_BUILD_COMMAND\n$generator\n$__UnprocessedCMakeArgs" +cmake_args_cache_file="$__CMakeBinDir/cmake_cmd_line.txt" +if [[ -z "$__ConfigureOnly" ]]; then + if [[ -e "$cmake_args_cache_file" ]]; then + cmake_args_cache=$(<"$cmake_args_cache_file") + if [[ "$cmake_args_cache" == "$cmake_args_to_cache" ]]; then + echo "CMake command line is unchanged. Reusing previous cache instead of regenerating." + exit 0 + fi + fi + echo $cmake_args_to_cache > $cmake_args_cache_file +fi + # We have to be able to build with CMake 3.6.2, so we can't use the -S or -B options pushd "$2" diff --git a/src/coreclr/CMakeLists.txt b/src/coreclr/CMakeLists.txt index 28ecbf7f16296e..f1912534668709 100644 --- a/src/coreclr/CMakeLists.txt +++ b/src/coreclr/CMakeLists.txt @@ -40,7 +40,11 @@ OPTION(CLR_CMAKE_ENABLE_CODE_COVERAGE "Enable code coverage" OFF) # Cross target Component build specific configuration #---------------------------------------------------- if(CLR_CROSS_COMPONENTS_BUILD) - include(crosscomponents.cmake) + add_definitions(-DCROSS_COMPILE) + + if(CLR_CMAKE_HOST_ARCH_AMD64 AND (CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_ARCH_I386)) + set(FEATURE_CROSSBITNESS 1) + endif(CLR_CMAKE_HOST_ARCH_AMD64 AND (CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_ARCH_I386)) endif(CLR_CROSS_COMPONENTS_BUILD) #------------------- @@ -48,10 +52,15 @@ endif(CLR_CROSS_COMPONENTS_BUILD) #------------------- include(pgosupport.cmake) +#--------------------------------------------------- +# Define sub-component targets for the build +#--------------------------------------------------- +include(components.cmake) + #------------------------------- # Include libraries native shims #------------------------------- -if(NOT CLR_CROSS_COMPONENTS_BUILD AND CLR_CMAKE_BUILD_SUBSET_RUNTIME) +if(NOT CLR_CROSS_COMPONENTS_BUILD) set(STATIC_LIBS_ONLY 1) if(CLR_CMAKE_TARGET_WIN32) @@ -59,7 +68,7 @@ if(NOT CLR_CROSS_COMPONENTS_BUILD AND CLR_CMAKE_BUILD_SUBSET_RUNTIME) else() add_subdirectory(${CLR_REPO_ROOT_DIR}/src/libraries/Native/Unix Native.Unix) endif() -endif(NOT CLR_CROSS_COMPONENTS_BUILD AND CLR_CMAKE_BUILD_SUBSET_RUNTIME) +endif(NOT CLR_CROSS_COMPONENTS_BUILD) #----------------------------------------- # Add Projects @@ -92,7 +101,7 @@ add_subdirectory(pal/prebuilt/inc) add_subdirectory(debug/debug-pal) -if(CLR_CMAKE_TARGET_WIN32 AND CLR_CMAKE_BUILD_SUBSET_RUNTIME) +if(CLR_CMAKE_TARGET_WIN32) add_subdirectory(gc/sample) endif() @@ -105,6 +114,7 @@ include_directories("../../artifacts/obj/coreclr") add_subdirectory(tools/aot/jitinterface) + # Above projects do not build with these compile options # All of the compiler options are specified in file compileoptions.cmake # Do not add any new options here. They should be added in compileoptions.cmake @@ -121,13 +131,16 @@ include(clrdefinitions.cmake) if(FEATURE_STANDALONE_GC) add_definitions(-DFEATURE_STANDALONE_GC) - if (CLR_CMAKE_BUILD_SUBSET_RUNTIME) - add_subdirectory(gc) - endif (CLR_CMAKE_BUILD_SUBSET_RUNTIME) + add_subdirectory(gc) endif(FEATURE_STANDALONE_GC) -if(CLR_CMAKE_BUILD_SUBSET_RUNTIME AND NOT CLR_CROSS_COMPONENTS_BUILD) +if(NOT CLR_CROSS_COMPONENTS_BUILD) + set(CLR_SINGLE_FILE_HOST_ONLY 1) add_subdirectory(${CLR_SRC_NATIVE_DIR}/corehost/apphost/static Corehost.Static) + add_dependencies(runtime singlefilehost) + install(TARGETS singlefilehost COMPONENT runtime) + get_symbol_file_name(singlefilehost singlefile_symbols) + install_symbol_file(${singlefile_symbols} . COMPONENT runtime) endif() if (CLR_CMAKE_HOST_UNIX) @@ -157,11 +170,9 @@ endif(CLR_CMAKE_TARGET_WIN32 AND FEATURE_EVENT_TRACE) add_subdirectory(debug/dbgutil) if(CLR_CMAKE_HOST_UNIX) - if(CLR_CMAKE_BUILD_SUBSET_RUNTIME) - if(CLR_CMAKE_HOST_OSX OR (CLR_CMAKE_HOST_LINUX AND NOT CLR_CMAKE_HOST_UNIX_X86 AND NOT CLR_CMAKE_HOST_ANDROID)) - add_subdirectory(debug/createdump) - endif(CLR_CMAKE_HOST_OSX OR (CLR_CMAKE_HOST_LINUX AND NOT CLR_CMAKE_HOST_UNIX_X86 AND NOT CLR_CMAKE_HOST_ANDROID)) - endif(CLR_CMAKE_BUILD_SUBSET_RUNTIME) + if(CLR_CMAKE_HOST_OSX OR (CLR_CMAKE_HOST_LINUX AND NOT CLR_CMAKE_HOST_UNIX_X86 AND NOT CLR_CMAKE_HOST_ANDROID)) + add_subdirectory(debug/createdump) + endif(CLR_CMAKE_HOST_OSX OR (CLR_CMAKE_HOST_LINUX AND NOT CLR_CMAKE_HOST_UNIX_X86 AND NOT CLR_CMAKE_HOST_ANDROID)) # Include the dummy c++ include files include_directories("pal/inc/rt/cpp") @@ -215,27 +226,25 @@ if(CLR_CMAKE_HOST_UNIX) endif(CLR_CMAKE_HOST_UNIX) add_subdirectory(vm) -if (CLR_CMAKE_BUILD_SUBSET_RUNTIME) - add_subdirectory(md) - add_subdirectory(debug) - add_subdirectory(binder) - add_subdirectory(classlibnative) - add_subdirectory(dlls) - add_subdirectory(ToolBox) - add_subdirectory(tools) - add_subdirectory(unwinder) - add_subdirectory(ildasm) - add_subdirectory(ilasm) - add_subdirectory(interop) - - if(CLR_CMAKE_HOST_WIN32) - add_subdirectory(hosts) - endif(CLR_CMAKE_HOST_WIN32) -else() - if(CLR_CMAKE_HOST_UNIX) - # this is needed to compile the jit on unix platforms. - # When the runtime subset is compiled, the add_subdirectory(dlls) above - # brings the mscorrc library into the build graph - add_subdirectory(dlls/mscorrc) - endif(CLR_CMAKE_HOST_UNIX) -endif(CLR_CMAKE_BUILD_SUBSET_RUNTIME) +add_subdirectory(md) +add_subdirectory(debug) +add_subdirectory(binder) +add_subdirectory(classlibnative) +add_subdirectory(dlls) +add_subdirectory(ToolBox) +add_subdirectory(tools) +add_subdirectory(unwinder) +add_subdirectory(ildasm) +add_subdirectory(ilasm) +add_subdirectory(interop) + +if(CLR_CMAKE_HOST_WIN32) + add_subdirectory(hosts) +endif(CLR_CMAKE_HOST_WIN32) + +#---------------------------------------------------- +# Cross target Component install configuration +#---------------------------------------------------- +if(CLR_CROSS_COMPONENTS_BUILD) + include(crosscomponents.cmake) +endif(CLR_CROSS_COMPONENTS_BUILD) diff --git a/src/coreclr/ToolBox/SOS/CMakeLists.txt b/src/coreclr/ToolBox/SOS/CMakeLists.txt index 1474c5466f0a60..a8b51128947744 100644 --- a/src/coreclr/ToolBox/SOS/CMakeLists.txt +++ b/src/coreclr/ToolBox/SOS/CMakeLists.txt @@ -1 +1 @@ -_install(FILES SOS_README.md DESTINATION .) +install(FILES SOS_README.md DESTINATION .) diff --git a/src/coreclr/ToolBox/superpmi/mcs/CMakeLists.txt b/src/coreclr/ToolBox/superpmi/mcs/CMakeLists.txt index e928c48d0cad24..3167680bd16e99 100644 --- a/src/coreclr/ToolBox/superpmi/mcs/CMakeLists.txt +++ b/src/coreclr/ToolBox/superpmi/mcs/CMakeLists.txt @@ -47,7 +47,7 @@ set(MCS_SOURCES ../superpmi-shared/spmidumphelper.cpp ) -_add_executable(mcs +add_executable_clr(mcs ${MCS_SOURCES} ) target_precompile_headers(mcs PRIVATE "$<$:standardpch.h>") @@ -66,7 +66,7 @@ else() ${STATIC_MT_CPP_LIB} ) - _install (FILES $ DESTINATION PDB) + install (FILES $ DESTINATION PDB) endif(CLR_CMAKE_HOST_UNIX) -_install (TARGETS mcs DESTINATION .) +install (TARGETS mcs DESTINATION .) diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/CMakeLists.txt b/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/CMakeLists.txt index 27ab46758f821a..48b08ee9de35fc 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/CMakeLists.txt +++ b/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/CMakeLists.txt @@ -39,7 +39,7 @@ if (CLR_CMAKE_TARGET_WIN32) list(APPEND SUPERPMI_SHIM_COLLECTOR_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/superpmi-shim-collector.def) endif (CLR_CMAKE_TARGET_WIN32) -_add_library(superpmi-shim-collector +add_library_clr(superpmi-shim-collector SHARED ${SUPERPMI_SHIM_COLLECTOR_SOURCES} ) @@ -60,7 +60,7 @@ else() ${STATIC_MT_CPP_LIB} ) - _install (FILES $ DESTINATION PDB) + install (FILES $ DESTINATION PDB) endif(CLR_CMAKE_HOST_UNIX) -_install (PROGRAMS $ DESTINATION .) +install (PROGRAMS $ DESTINATION .) diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/CMakeLists.txt b/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/CMakeLists.txt index 57a42a5ba031bb..51e6a1e77ce389 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/CMakeLists.txt +++ b/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/CMakeLists.txt @@ -41,7 +41,7 @@ if (CLR_CMAKE_TARGET_WIN32) list(APPEND SUPERPMI_SHIM_COUNTER_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/superpmi-shim-counter.def) endif (CLR_CMAKE_TARGET_WIN32) -_add_library(superpmi-shim-counter +add_library_clr(superpmi-shim-counter SHARED ${SUPERPMI_SHIM_COUNTER_SOURCES} ) @@ -62,7 +62,7 @@ else() ${STATIC_MT_CPP_LIB} ) - _install (FILES $ DESTINATION PDB) + install (FILES $ DESTINATION PDB) endif(CLR_CMAKE_HOST_UNIX) -_install (PROGRAMS $ DESTINATION .) +install (PROGRAMS $ DESTINATION .) diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/CMakeLists.txt b/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/CMakeLists.txt index 58afa789de1a17..f735b68a8348a7 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/CMakeLists.txt +++ b/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/CMakeLists.txt @@ -40,7 +40,7 @@ if (CLR_CMAKE_TARGET_WIN32) list(APPEND SUPERPMI_SHIM_SIMPLE_SOURCES ${CMAKE_CURRENT_BINARY_DIR}/superpmi-shim-simple.def) endif (CLR_CMAKE_TARGET_WIN32) -_add_library(superpmi-shim-simple +add_library_clr(superpmi-shim-simple SHARED ${SUPERPMI_SHIM_SIMPLE_SOURCES} ) @@ -61,7 +61,7 @@ else() ${STATIC_MT_CPP_LIB} ) - _install (FILES $ DESTINATION PDB) + install (FILES $ DESTINATION PDB) endif(CLR_CMAKE_HOST_UNIX) -_install (PROGRAMS $ DESTINATION .) +install (PROGRAMS $ DESTINATION .) diff --git a/src/coreclr/ToolBox/superpmi/superpmi/CMakeLists.txt b/src/coreclr/ToolBox/superpmi/superpmi/CMakeLists.txt index 3bc6ca865572f5..3a620228487af0 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi/CMakeLists.txt +++ b/src/coreclr/ToolBox/superpmi/superpmi/CMakeLists.txt @@ -41,7 +41,7 @@ set(SUPERPMI_SOURCES ../superpmi-shared/spmidumphelper.cpp ) -_add_executable(superpmi +add_executable_clr(superpmi ${SUPERPMI_SOURCES} ) @@ -62,7 +62,7 @@ else() ${STATIC_MT_CPP_LIB} ) - _install (FILES $ DESTINATION PDB) + install (FILES $ DESTINATION PDB) endif(CLR_CMAKE_HOST_UNIX) -_install (TARGETS superpmi DESTINATION .) +install (TARGETS superpmi DESTINATION .) diff --git a/src/coreclr/_build-commons.sh b/src/coreclr/_build-commons.sh index 8bac206f28ff4d..9b1ee88d52a1a1 100755 --- a/src/coreclr/_build-commons.sh +++ b/src/coreclr/_build-commons.sh @@ -23,7 +23,7 @@ handle_arguments() { ;; *) - handle_arguments_local "$1" + handle_arguments_local "$1" "$2" ;; esac } diff --git a/src/coreclr/build-runtime.cmd b/src/coreclr/build-runtime.cmd index 18a7f392354800..e51b139b992766 100644 --- a/src/coreclr/build-runtime.cmd +++ b/src/coreclr/build-runtime.cmd @@ -68,16 +68,13 @@ set __BuildCrossArchNative=0 set __SkipCrossArchNative=0 set __SkipGenerateVersion=0 set __RestoreOptData=1 -set __BuildJit=1 -set __BuildPALTests=0 -set __BuildAllJits=1 -set __BuildRuntime=1 set __CrossArch= set __CrossArch2= set __CrossOS=0 set __PgoOptDataPath= set __CMakeArgs= set __Ninja=0 +set __RequestedBuildComponents= @REM CMD has a nasty habit of eating "=" on the argument list, so passing: @REM -priority=1 @@ -155,9 +152,7 @@ if /i "%1" == "-ninja" (set __Ninja=1&set processedArgs=!processed 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) -if /i "%1" == "-skipjit" (set __BuildJit=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) -if /i "%1" == "-skipalljits" (set __BuildAllJits=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) -if /i "%1" == "-skipruntime" (set __BuildRuntime=0&set processedArgs=!processedArgs! %1&shift&goto Arg_Loop) +if /i "%1" == "-component" (set __RequestedBuildComponents=%__RequestedBuildComponents%-%2&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop) REM TODO these are deprecated remove them eventually REM don't add more, use the - syntax instead @@ -416,7 +411,28 @@ if NOT DEFINED PYTHON ( goto ExitWithError ) -set __CMakeClrBuildSubsetArgs="-DCLR_CMAKE_BUILD_SUBSET_JIT=%__BuildJit%" "-DCLR_CMAKE_BUILD_SUBSET_ALLJITS=%__BuildAllJits%" "-DCLR_CMAKE_BUILD_SUBSET_RUNTIME=%__BuildRuntime%" +set __CMakeTarget= +for /f "delims=" %%a in ("-%__RequestedBuildComponents%-") do ( + set "string=%%a" + if not "!string:-jit-=!"=="!string!" ( + set __CMakeTarget=!__CMakeTarget! clrjit_install + ) + if not "!string:-alljits-=!"=="!string!" ( + set __CMakeTarget=!__CMakeTarget! all_jits + ) + if not "!string:-runtime-=!"=="!string!" ( + set __CMakeTarget=!__CMakeTarget! runtime + ) + if not "!string:-paltests-=!"=="!string!" ( + set __CMakeTarget=!__CMakeTarget! paltests_install + ) + if not "!string:-iltools-=!"=="!string!" ( + set __CMakeTarget=!__CMakeTarget! iltools + ) +) +if [!__CMakeTarget!] == [] ( + set __CMakeTarget=install +) REM ========================================================================================= REM === @@ -448,7 +464,7 @@ if %__BuildCrossArchNative% EQU 1 ( set __ExtraCmakeArgs="-DCMAKE_BUILD_TYPE=!__BuildType!" ) - set __ExtraCmakeArgs=!__ExtraCmakeArgs! %__CMakeClrBuildSubsetArgs% "-DCLR_CROSS_COMPONENTS_BUILD=1" "-DCLR_CMAKE_TARGET_ARCH=%__BuildArch%" "-DCLR_CMAKE_TARGET_OS=%__TargetOS%" "-DCLR_CMAKE_PGO_INSTRUMENT=0" "-DCLR_CMAKE_OPTDATA_PATH=%__PgoOptDataPath%" "-DCLR_CMAKE_PGO_OPTIMIZE=0" %__CMakeArgs% + set __ExtraCmakeArgs=!__ExtraCmakeArgs! "-DCLR_CROSS_COMPONENTS_BUILD=1" "-DCLR_CMAKE_TARGET_ARCH=%__BuildArch%" "-DCLR_CMAKE_TARGET_OS=%__TargetOS%" "-DCLR_CMAKE_PGO_INSTRUMENT=0" "-DCLR_CMAKE_OPTDATA_PATH=%__PgoOptDataPath%" "-DCLR_CMAKE_PGO_OPTIMIZE=0" %__CMakeArgs% call "%__RepoRootDir%\eng\native\gen-buildsys.cmd" "%__ProjectDir%" "%__CrossCompIntermediatesDir%" %__VSVersion% %__CrossArch% !__ExtraCmakeArgs! if not !errorlevel! == 0 ( @@ -485,7 +501,7 @@ if %__BuildCrossArchNative% EQU 1 ( set __CmakeBuildToolArgs=/nologo /m !__Logging! ) - "%CMakePath%" --build %__CrossCompIntermediatesDir% --target install --config %__BuildType% -- !__CmakeBuildToolArgs! + "%CMakePath%" --build %__CrossCompIntermediatesDir% --target crosscomponents --config %__BuildType% -- !__CmakeBuildToolArgs! if not !errorlevel! == 0 ( set __exitCode=!errorlevel! @@ -522,7 +538,7 @@ if %__BuildCrossArchNative% EQU 1 ( set __ExtraCmakeArgs="-DCMAKE_BUILD_TYPE=!__BuildType!" ) - set __ExtraCmakeArgs=!__ExtraCmakeArgs! %__CMakeClrBuildSubsetArgs% "-DCLR_CROSS_COMPONENTS_BUILD=1" "-DCLR_CMAKE_TARGET_ARCH=%__BuildArch%" "-DCLR_CMAKE_TARGET_OS=%__TargetOS%" "-DCLR_CMAKE_PGO_INSTRUMENT=0" "-DCLR_CMAKE_OPTDATA_PATH=%__PgoOptDataPath%" "-DCLR_CMAKE_PGO_OPTIMIZE=0" "-DCMAKE_SYSTEM_VERSION=10.0" %__CMakeArgs% + set __ExtraCmakeArgs=!__ExtraCmakeArgs! "-DCLR_CROSS_COMPONENTS_BUILD=1" "-DCLR_CMAKE_TARGET_ARCH=%__BuildArch%" "-DCLR_CMAKE_TARGET_OS=%__TargetOS%" "-DCLR_CMAKE_PGO_INSTRUMENT=0" "-DCLR_CMAKE_OPTDATA_PATH=%__PgoOptDataPath%" "-DCLR_CMAKE_PGO_OPTIMIZE=0" "-DCMAKE_SYSTEM_VERSION=10.0" %__CMakeArgs% call "%__RepoRootDir%\eng\native\gen-buildsys.cmd" "%__ProjectDir%" "%__CrossComp2IntermediatesDir%" %__VSVersion% %__CrossArch2% !__ExtraCmakeArgs! if not !errorlevel! == 0 ( @@ -560,7 +576,7 @@ if %__BuildCrossArchNative% EQU 1 ( set __CmakeBuildToolArgs=/nologo /m !__Logging! ) - "%CMakePath%" --build %__CrossComp2IntermediatesDir% --target install --config %__BuildType% -- !__CmakeBuildToolArgs! + "%CMakePath%" --build %__CrossComp2IntermediatesDir% --target crosscomponents --config %__BuildType% -- !__CmakeBuildToolArgs! if not !errorlevel! == 0 ( set __exitCode=!errorlevel! @@ -612,7 +628,7 @@ if %__BuildNative% EQU 1 ( set __ExtraCmakeArgs="-DCMAKE_BUILD_TYPE=!__BuildType!" ) - set __ExtraCmakeArgs=!__ExtraCmakeArgs! !___CrossBuildDefine! %__CMakeClrBuildSubsetArgs% "-DCLR_CMAKE_PGO_INSTRUMENT=%__PgoInstrument%" "-DCLR_CMAKE_OPTDATA_PATH=%__PgoOptDataPath%" "-DCLR_CMAKE_PGO_OPTIMIZE=%__PgoOptimize%" %__CMakeArgs% + set __ExtraCmakeArgs=!__ExtraCmakeArgs! !___CrossBuildDefine! "-DCLR_CMAKE_PGO_INSTRUMENT=%__PgoInstrument%" "-DCLR_CMAKE_OPTDATA_PATH=%__PgoOptDataPath%" "-DCLR_CMAKE_PGO_OPTIMIZE=%__PgoOptimize%" %__CMakeArgs% call "%__RepoRootDir%\eng\native\gen-buildsys.cmd" "%__ProjectDir%" "%__IntermediatesDir%" %__VSVersion% %__BuildArch% !__ExtraCmakeArgs! if not !errorlevel! == 0 ( echo %__ErrMsgPrefix%%__MsgPrefix%Error: failed to generate native component build project! @@ -648,7 +664,8 @@ if %__BuildNative% EQU 1 ( set __CmakeBuildToolArgs=/nologo /m !__Logging! ) - "%CMakePath%" --build %__IntermediatesDir% --target install --config %__BuildType% -- !__CmakeBuildToolArgs! + echo running "%CMakePath%" --build %__IntermediatesDir% --target %__CMakeTarget% --config %__BuildType% -- !__CmakeBuildToolArgs! + "%CMakePath%" --build %__IntermediatesDir% --target %__CMakeTarget% --config %__BuildType% -- !__CmakeBuildToolArgs! if not !errorlevel! == 0 ( set __exitCode=!errorlevel! diff --git a/src/coreclr/build-runtime.sh b/src/coreclr/build-runtime.sh index 25cf3e06ea6b90..8740cb695a966b 100755 --- a/src/coreclr/build-runtime.sh +++ b/src/coreclr/build-runtime.sh @@ -99,7 +99,7 @@ build_cross_architecture_components() export __CMakeBinDir CROSSCOMPILE __CMakeArgs="-DCLR_CMAKE_TARGET_ARCH=$__BuildArch -DCLR_CROSS_COMPONENTS_BUILD=1 $__CMakeArgs" - build_native "$__TargetOS" "$__CrossArch" "$__ProjectRoot" "$intermediatesForBuild" "$__CMakeArgs" "cross-architecture components" + build_native "$__TargetOS" "$__CrossArch" "$__ProjectRoot" "$intermediatesForBuild" "crosscomponents" "$__CMakeArgs" "cross-architecture components" CROSSCOMPILE=1 export CROSSCOMPILE @@ -125,20 +125,9 @@ handle_arguments_local() { __StaticAnalyzer=1 ;; - skipjit|-skipjit) - __BuildJit=0 - ;; - - skipalljits|-skipalljits) - __BuildAllJits=0 - ;; - - skipruntime|-skipruntime) - __BuildRuntime=0 - ;; - - paltests|-paltests) - __BuildPALTests=1 + component|-component) + __RequestedBuildComponents="$__RequestedBuildComponents${__RequestedBuildComponents:+-}$2" + __ShiftArgs=1 ;; *) __UnprocessedBuildArgs="$__UnprocessedBuildArgs $1" @@ -192,7 +181,7 @@ __UseNinja=0 __VerboseBuild=0 __ValidateCrossArg=1 __CMakeArgs="" -__BuildPALTests=0 +__RequestedBuildComponents="" __BuildAllJits=1 __BuildRuntime=1 @@ -247,17 +236,37 @@ restore_optdata # Build the coreclr (native) components. __CMakeArgs="-DCLR_CMAKE_PGO_INSTRUMENT=$__PgoInstrument -DCLR_CMAKE_OPTDATA_PATH=$__PgoOptDataPath -DCLR_CMAKE_PGO_OPTIMIZE=$__PgoOptimize $__CMakeArgs" -__CMakeArgs="-DCLR_CMAKE_BUILD_SUBSET_JIT=$__BuildJit -DCLR_CMAKE_BUILD_SUBSET_ALLJITS=$__BuildAllJits -DCLR_CMAKE_BUILD_SUBSET_RUNTIME=$__BuildRuntime $__CMakeArgs" -__CMakeArgs="-DCLR_CMAKE_BUILD_TESTS=$__BuildPALTests $__CMakeArgs" if [[ "$__SkipConfigure" == 0 && "$__CodeCoverage" == 1 ]]; then __CMakeArgs="-DCLR_CMAKE_ENABLE_CODE_COVERAGE=1 $__CMakeArgs" fi +__CMakeTarget="" +echo "Requested build components: -$__RequestedBuildComponents-" +if [[ "-$__RequestedBuildComponents-" =~ "-jit-" ]]; then + __CMakeTarget="${__CMakeTarget} clrjit_install" +fi +if [[ "-$__RequestedBuildComponents-" =~ "-alljits-" ]]; then + __CMakeTarget="${__CMakeTarget} all_jits" +fi +if [[ "-$__RequestedBuildComponents-" =~ "-runtime-" ]]; then + __CMakeTarget="${__CMakeTarget} runtime" +fi +if [[ "-$__RequestedBuildComponents-" =~ "-paltests-" ]]; then + __CMakeTarget="${__CMakeTarget} paltests_install" +fi +if [[ "-$__RequestedBuildComponents-" =~ "-iltools-" ]]; then + __CMakeTarget="${__CMakeTarget} iltools" +fi + +if [[ -z "$__CMakeTarget" ]]; then + __CMakeTarget="install" +fi + if [[ "$__SkipNative" == 1 ]]; then echo "Skipping CoreCLR component build." else - build_native "$__TargetOS" "$__BuildArch" "$__ProjectRoot" "$__IntermediatesDir" "$__CMakeArgs" "CoreCLR component" + build_native "$__TargetOS" "$__BuildArch" "$__ProjectRoot" "$__IntermediatesDir" "$__CMakeTarget" "$__CMakeArgs" "CoreCLR component" # Build cross-architecture components if [[ "$__SkipCrossArchNative" != 1 ]]; then diff --git a/src/coreclr/components.cmake b/src/coreclr/components.cmake new file mode 100644 index 00000000000000..1052ee84207691 --- /dev/null +++ b/src/coreclr/components.cmake @@ -0,0 +1,21 @@ +# Define all the individually buildable components of the CoreCLR build and their respective targets +add_component(clrjit clrjit_install) +add_component(all_jits) +add_component(runtime) +add_component(paltests paltests_install) +add_component(iltools) + +# Define coreclr_all as the fallback component and make every component depend on this component. +set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME coreclr_misc) +add_component(coreclr_misc) +add_dependencies(clrjit_install coreclr_misc) +add_dependencies(all_jits coreclr_misc) +add_dependencies(runtime coreclr_misc) +add_dependencies(paltests_install coreclr_misc) +add_dependencies(iltools coreclr_misc) + +# The runtime build requires the clrjit and iltools builds +add_dependencies(runtime clrjit_install iltools) + +# The cross-components build is separate, so we don't need to add a dependency on coreclr_misc +add_component(crosscomponents) diff --git a/src/coreclr/crosscomponents.cmake b/src/coreclr/crosscomponents.cmake index c66531887daa0d..f2d7c959ae1242 100644 --- a/src/coreclr/crosscomponents.cmake +++ b/src/coreclr/crosscomponents.cmake @@ -1,31 +1,35 @@ -add_definitions(-DCROSS_COMPILE) - -if(CLR_CMAKE_HOST_ARCH_AMD64 AND (CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_ARCH_I386)) - set(FEATURE_CROSSBITNESS 1) -endif(CLR_CMAKE_HOST_ARCH_AMD64 AND (CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_ARCH_I386)) +# Add targets to the crosscomponents subcomponent build if (CLR_CMAKE_HOST_OS STREQUAL CLR_CMAKE_TARGET_OS) - set (CLR_CROSS_COMPONENTS_LIST + install_clr (TARGETS clrjit jitinterface_${ARCH_HOST_NAME} + COMPONENT crosscomponents ) if(CLR_CMAKE_HOST_LINUX OR NOT FEATURE_CROSSBITNESS) - list (APPEND CLR_CROSS_COMPONENTS_LIST + install_clr (TARGETS crossgen + COMPONENT crosscomponents ) endif() if (CLR_CMAKE_TARGET_UNIX) - list (APPEND CLR_CROSS_COMPONENTS_LIST + install_clr (TARGETS clrjit_unix_${ARCH_TARGET_NAME}_${ARCH_HOST_NAME} + COMPONENT crosscomponents ) endif(CLR_CMAKE_TARGET_UNIX) endif() if(NOT CLR_CMAKE_HOST_LINUX AND NOT CLR_CMAKE_HOST_OSX AND NOT FEATURE_CROSSBITNESS) - list (APPEND CLR_CROSS_COMPONENTS_LIST + install_clr (TARGETS mscordaccore mscordbi + COMPONENT crosscomponents ) endif() + +if (CLR_CMAKE_TARGET_WIN32 AND NOT CLR_CMAKE_CROSS_ARCH) + add_dependencies(crosscomponents InjectResource GenClrDebugResource) +endif() diff --git a/src/coreclr/debug/createdump/CMakeLists.txt b/src/coreclr/debug/createdump/CMakeLists.txt index 2e55b9a991f1e2..81f536ab1e5ab4 100644 --- a/src/coreclr/debug/createdump/CMakeLists.txt +++ b/src/coreclr/debug/createdump/CMakeLists.txt @@ -19,7 +19,7 @@ if(CLR_CMAKE_HOST_WIN32) createdump.rc ) - _add_executable(createdump + add_executable_clr(createdump ${CREATEDUMP_SOURCES} ) @@ -60,13 +60,13 @@ else(CLR_CMAKE_HOST_WIN32) ) if(CLR_CMAKE_HOST_OSX) - _add_executable(createdump + add_executable_clr(createdump crashinfomac.cpp threadinfomac.cpp ${CREATEDUMP_SOURCES} ) else() - _add_executable(createdump + add_executable_clr(createdump crashinfounix.cpp threadinfounix.cpp ${CREATEDUMP_SOURCES} @@ -86,4 +86,4 @@ endif(CLR_CMAKE_HOST_OSX) endif(CLR_CMAKE_HOST_WIN32) -install_clr(TARGETS createdump ADDITIONAL_DESTINATIONS sharedFramework) +install_clr(TARGETS createdump ADDITIONAL_DESTINATIONS sharedFramework COMPONENT runtime) diff --git a/src/coreclr/debug/debug-pal/CMakeLists.txt b/src/coreclr/debug/debug-pal/CMakeLists.txt index da51b34fdf6d8b..f2121b18abc9a1 100644 --- a/src/coreclr/debug/debug-pal/CMakeLists.txt +++ b/src/coreclr/debug/debug-pal/CMakeLists.txt @@ -52,6 +52,6 @@ if(CLR_CMAKE_HOST_UNIX) endif(CLR_CMAKE_HOST_UNIX) -_add_library(debug-pal_obj OBJECT ${TWO_WAY_PIPE_SOURCES}) +add_library_clr(debug-pal_obj OBJECT ${TWO_WAY_PIPE_SOURCES}) add_library(debug-pal INTERFACE) target_sources(debug-pal INTERFACE $) diff --git a/src/coreclr/debug/runtimeinfo/CMakeLists.txt b/src/coreclr/debug/runtimeinfo/CMakeLists.txt index a7811d6ce2c2e0..35e71b432ba500 100644 --- a/src/coreclr/debug/runtimeinfo/CMakeLists.txt +++ b/src/coreclr/debug/runtimeinfo/CMakeLists.txt @@ -14,4 +14,4 @@ if (NOT (CLR_CMAKE_TARGET_WIN32 AND (CLR_CMAKE_TARGET_ARCH_I386 OR CLR_CMAKE_TAR endif() # publish runtimeinfo lib -_install(TARGETS runtimeinfo DESTINATION lib) +install(TARGETS runtimeinfo DESTINATION lib) diff --git a/src/coreclr/dlls/clretwrc/CMakeLists.txt b/src/coreclr/dlls/clretwrc/CMakeLists.txt index d2cb5cfae98e8e..c4e6f95cd4840a 100644 --- a/src/coreclr/dlls/clretwrc/CMakeLists.txt +++ b/src/coreclr/dlls/clretwrc/CMakeLists.txt @@ -20,6 +20,6 @@ add_library_clr(clretwrc SHARED ) # add the install targets -install_clr(TARGETS clretwrc ADDITIONAL_DESTINATIONS sharedFramework) +install_clr(TARGETS clretwrc ADDITIONAL_DESTINATIONS sharedFramework COMPONENT runtime) add_dependencies(clretwrc eventing_headers) diff --git a/src/coreclr/dlls/dbgshim/CMakeLists.txt b/src/coreclr/dlls/dbgshim/CMakeLists.txt index 1092799c866c6c..5b7c7f29140a29 100644 --- a/src/coreclr/dlls/dbgshim/CMakeLists.txt +++ b/src/coreclr/dlls/dbgshim/CMakeLists.txt @@ -84,4 +84,4 @@ endif(CLR_CMAKE_HOST_WIN32) target_link_libraries(dbgshim ${DBGSHIM_LIBRARIES}) # add the install targets -install_clr(TARGETS dbgshim ADDITIONAL_DESTINATIONS sharedFramework) +install_clr(TARGETS dbgshim ADDITIONAL_DESTINATIONS sharedFramework COMPONENT runtime) diff --git a/src/coreclr/dlls/mscordac/CMakeLists.txt b/src/coreclr/dlls/mscordac/CMakeLists.txt index 91e4d66c9244ef..76723010f32324 100644 --- a/src/coreclr/dlls/mscordac/CMakeLists.txt +++ b/src/coreclr/dlls/mscordac/CMakeLists.txt @@ -98,7 +98,7 @@ endif(CLR_CMAKE_HOST_WIN32) # 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_clr(mscordacobj OBJECT mscordac.cpp) add_library_clr(mscordaccore SHARED ${CLR_DAC_SOURCES} $) @@ -199,7 +199,7 @@ if(FEATURE_SINGLE_FILE_DIAGNOSTICS) endif(FEATURE_SINGLE_FILE_DIAGNOSTICS) # add the install targets -install_clr(TARGETS mscordaccore ADDITIONAL_DESTINATIONS sharedFramework) +install_clr(TARGETS mscordaccore ADDITIONAL_DESTINATIONS sharedFramework COMPONENT runtime) if(CLR_CMAKE_HOST_WIN32) set(LONG_NAME_HOST_ARCH ${CLR_CMAKE_HOST_ARCH}) @@ -216,5 +216,5 @@ if(CLR_CMAKE_HOST_WIN32) string(REGEX MATCH "#define VER_FILEVERSION[ \t]+[0-9]+(,[0-9]+)+" FILE_VERSION_LINE "${NATIVE_VERSION_HEADER}") string(REGEX MATCHALL "[0-9]+" FILE_VERSION_COMPONENTS "${FILE_VERSION_LINE}") list(JOIN FILE_VERSION_COMPONENTS "." FILE_VERSION) - install(FILES $ RENAME mscordaccore_${LONG_NAME_HOST_ARCH}_${LONG_NAME_TARGET_ARCH}_${FILE_VERSION}.dll DESTINATION sharedFramework) + install(FILES $ RENAME mscordaccore_${LONG_NAME_HOST_ARCH}_${LONG_NAME_TARGET_ARCH}_${FILE_VERSION}.dll DESTINATION sharedFramework COMPONENT runtime) endif() diff --git a/src/coreclr/dlls/mscordbi/CMakeLists.txt b/src/coreclr/dlls/mscordbi/CMakeLists.txt index a0fae4948469ff..ee626faf1e246f 100644 --- a/src/coreclr/dlls/mscordbi/CMakeLists.txt +++ b/src/coreclr/dlls/mscordbi/CMakeLists.txt @@ -126,4 +126,4 @@ if(FEATURE_SINGLE_FILE_DIAGNOSTICS) endif(FEATURE_SINGLE_FILE_DIAGNOSTICS) # add the install targets -install_clr(TARGETS mscordbi ADDITIONAL_DESTINATIONS sharedFramework) +install_clr(TARGETS mscordbi ADDITIONAL_DESTINATIONS sharedFramework COMPONENT runtime) diff --git a/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt b/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt index b22ccf1a6bc580..f1e31ef9135e70 100644 --- a/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt +++ b/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt @@ -230,11 +230,12 @@ if(CLR_CMAKE_TARGET_WIN32) 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_dependencies(runtime inject_debug_resources) endif() endif(CLR_CMAKE_TARGET_WIN32) # add the install targets -install_clr(TARGETS coreclr ADDITIONAL_DESTINATIONS sharedFramework) +install_clr(TARGETS coreclr ADDITIONAL_DESTINATIONS sharedFramework COMPONENT runtime) # Enable profile guided optimization add_pgo(coreclr) diff --git a/src/coreclr/dlls/mscorrc/CMakeLists.txt b/src/coreclr/dlls/mscorrc/CMakeLists.txt index 040b12a240a2a3..81bb0501977b73 100644 --- a/src/coreclr/dlls/mscorrc/CMakeLists.txt +++ b/src/coreclr/dlls/mscorrc/CMakeLists.txt @@ -15,7 +15,7 @@ if(CLR_CMAKE_HOST_WIN32) include.rc ) - install_clr(TARGETS mscorrc ADDITIONAL_DESTINATIONS sharedFramework) + install_clr(TARGETS mscorrc ADDITIONAL_DESTINATIONS sharedFramework COMPONENT runtime) else() build_resources(${CMAKE_CURRENT_SOURCE_DIR}/include.rc mscorrc TARGET_CPP_FILE) diff --git a/src/coreclr/gc/CMakeLists.txt b/src/coreclr/gc/CMakeLists.txt index 3ba1e888eb4018..ac2c85011b7782 100644 --- a/src/coreclr/gc/CMakeLists.txt +++ b/src/coreclr/gc/CMakeLists.txt @@ -110,7 +110,7 @@ convert_to_absolute_path(GC_SOURCES ${GC_SOURCES}) add_library_clr(clrgc SHARED ${GC_SOURCES}) add_dependencies(clrgc eventing_headers) target_link_libraries(clrgc ${GC_LINK_LIBRARIES}) -install_clr(TARGETS clrgc) +install_clr(TARGETS clrgc COMPONENT runtime) if(CLR_CMAKE_HOST_UNIX) # dprintf causes many warnings (https://github.com/dotnet/runtime/issues/8737) diff --git a/src/coreclr/gc/sample/CMakeLists.txt b/src/coreclr/gc/sample/CMakeLists.txt index 8dbdca3dc57799..cf8c1694961e8a 100644 --- a/src/coreclr/gc/sample/CMakeLists.txt +++ b/src/coreclr/gc/sample/CMakeLists.txt @@ -58,7 +58,7 @@ else() ../gcenv.unix.cpp) endif() -_add_executable(gcsample +add_executable_clr(gcsample ${SOURCES} ) diff --git a/src/coreclr/gcinfo/CMakeLists.txt b/src/coreclr/gcinfo/CMakeLists.txt index abdcd53fae3b77..70b0f7396d89b3 100644 --- a/src/coreclr/gcinfo/CMakeLists.txt +++ b/src/coreclr/gcinfo/CMakeLists.txt @@ -39,7 +39,7 @@ add_library_clr(gcinfo_crossgen set_target_properties(gcinfo_crossgen PROPERTIES CROSSGEN_COMPONENT TRUE) -_install (FILES gcinfoencoder.cpp +install (FILES gcinfoencoder.cpp DESTINATION gcinfo) function(create_gcinfo_lib) @@ -71,23 +71,14 @@ else() set(TARGET_OS_NAME win) endif() -if (CLR_CMAKE_BUILD_SUBSET_ALLJITS AND NOT CLR_CROSS_COMPONENTS_BUILD) - if (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64) - create_gcinfo_lib(TARGET gcinfo_unix_arm64 OS unix ARCH arm64) - create_gcinfo_lib(TARGET gcinfo_unix_x64 OS unix ARCH x64) - create_gcinfo_lib(TARGET gcinfo_win_arm64 OS win ARCH arm64) - create_gcinfo_lib(TARGET gcinfo_win_x64 OS win ARCH x64) - endif (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64) - - create_gcinfo_lib(TARGET gcinfo_unix_armel OS unix ARCH armel) - create_gcinfo_lib(TARGET gcinfo_unix_arm OS unix ARCH arm) - create_gcinfo_lib(TARGET gcinfo_win_arm OS win ARCH arm) - create_gcinfo_lib(TARGET gcinfo_win_x86 OS win ARCH x86) -else() - create_gcinfo_lib(TARGET gcinfo_${TARGET_OS_NAME}_${ARCH_TARGET_NAME} OS ${TARGET_OS_NAME} ARCH ${ARCH_TARGET_NAME}) - - if (CLR_CMAKE_HOST_ARCH_I386 AND NOT ((TARGET_OS_NAME STREQUAL unix) AND (ARCH_TARGET_NAME STREQUAL "armel"))) - # On x86, build gcinfo for RyuJIT/ARM32 cross-compiling altjit for ARM_SOFTFP (armel). - create_gcinfo_lib(TARGET gcinfo_unix_armel OS unix ARCH armel) - endif() -endif (CLR_CMAKE_BUILD_SUBSET_ALLJITS AND NOT CLR_CROSS_COMPONENTS_BUILD) +if (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64) + create_gcinfo_lib(TARGET gcinfo_unix_arm64 OS unix ARCH arm64) + create_gcinfo_lib(TARGET gcinfo_unix_x64 OS unix ARCH x64) + create_gcinfo_lib(TARGET gcinfo_win_arm64 OS win ARCH arm64) + create_gcinfo_lib(TARGET gcinfo_win_x64 OS win ARCH x64) +endif (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64) + +create_gcinfo_lib(TARGET gcinfo_unix_armel OS unix ARCH armel) +create_gcinfo_lib(TARGET gcinfo_unix_arm OS unix ARCH arm) +create_gcinfo_lib(TARGET gcinfo_win_arm OS win ARCH arm) +create_gcinfo_lib(TARGET gcinfo_win_x86 OS win ARCH x86) diff --git a/src/coreclr/hosts/corerun/CMakeLists.txt b/src/coreclr/hosts/corerun/CMakeLists.txt index fc1745c2af3962..83abab40f9f618 100644 --- a/src/coreclr/hosts/corerun/CMakeLists.txt +++ b/src/coreclr/hosts/corerun/CMakeLists.txt @@ -9,7 +9,7 @@ else(CLR_CMAKE_HOST_WIN32) include(configure.cmake) endif(CLR_CMAKE_HOST_WIN32) -_add_executable(corerun +add_executable_clr(corerun corerun.cpp native.rc ) @@ -32,4 +32,4 @@ else(CLR_CMAKE_HOST_WIN32) endif() endif(CLR_CMAKE_HOST_WIN32) -install_clr(TARGETS corerun) +install_clr(TARGETS corerun COMPONENT runtime) diff --git a/src/coreclr/hosts/coreshim/CMakeLists.txt b/src/coreclr/hosts/coreshim/CMakeLists.txt index 51061e11d1dd3f..1fba0341198fac 100644 --- a/src/coreclr/hosts/coreshim/CMakeLists.txt +++ b/src/coreclr/hosts/coreshim/CMakeLists.txt @@ -22,4 +22,4 @@ target_link_libraries(CoreShim ${STATIC_MT_VCRT_LIB} ) -install_clr(TARGETS CoreShim) +install_clr(TARGETS CoreShim COMPONENT runtime) diff --git a/src/coreclr/ilasm/CMakeLists.txt b/src/coreclr/ilasm/CMakeLists.txt index 3d385551b93521..2c9a4a4771d400 100644 --- a/src/coreclr/ilasm/CMakeLists.txt +++ b/src/coreclr/ilasm/CMakeLists.txt @@ -65,7 +65,7 @@ if(CLR_CMAKE_HOST_LINUX OR CLR_CMAKE_HOST_FREEBSD OR CLR_CMAKE_HOST_NETBSD OR CL set(END_LIBRARY_GROUP -Wl,--end-group) endif(CLR_CMAKE_HOST_LINUX OR CLR_CMAKE_HOST_FREEBSD OR CLR_CMAKE_HOST_NETBSD OR CLR_CMAKE_HOST_SUNOS) -_add_executable(ilasm +add_executable_clr(ilasm ${ILASM_SOURCES} ${ILASM_RESOURCES} ) @@ -126,4 +126,4 @@ else() ) endif(CLR_CMAKE_HOST_UNIX) -install_clr(TARGETS ilasm) +install_clr(TARGETS ilasm COMPONENT iltools) diff --git a/src/coreclr/ildasm/exe/CMakeLists.txt b/src/coreclr/ildasm/exe/CMakeLists.txt index fe0892f6bd30f4..9daa46bf8ae146 100644 --- a/src/coreclr/ildasm/exe/CMakeLists.txt +++ b/src/coreclr/ildasm/exe/CMakeLists.txt @@ -58,7 +58,7 @@ if(CLR_CMAKE_HOST_LINUX OR CLR_CMAKE_HOST_FREEBSD OR CLR_CMAKE_HOST_NETBSD OR CL set(END_LIBRARY_GROUP -Wl,--end-group) endif(CLR_CMAKE_HOST_LINUX OR CLR_CMAKE_HOST_FREEBSD OR CLR_CMAKE_HOST_NETBSD OR CLR_CMAKE_HOST_SUNOS) -_add_executable(ildasm +add_executable_clr(ildasm ${ILDASM_SOURCES} ${ILDASM_RESOURCES} ) @@ -115,4 +115,4 @@ else() ) endif(CLR_CMAKE_HOST_UNIX) -install_clr(TARGETS ildasm) +install_clr(TARGETS ildasm COMPONENT iltools) diff --git a/src/coreclr/inc/CMakeLists.txt b/src/coreclr/inc/CMakeLists.txt index 456cdf90965345..535be85af85db3 100644 --- a/src/coreclr/inc/CMakeLists.txt +++ b/src/coreclr/inc/CMakeLists.txt @@ -58,13 +58,13 @@ if(FEATURE_JIT_PITCHING) endif(FEATURE_JIT_PITCHING) # Compile *_i.cpp to lib -_add_library(corguids_obj OBJECT ${CORGUIDS_SOURCES}) +add_library_clr(corguids_obj OBJECT ${CORGUIDS_SOURCES}) add_library(corguids INTERFACE) target_sources(corguids INTERFACE $) # Binplace the inc files for packaging later. -_install (FILES cfi.h +install (FILES cfi.h cor.h cordebuginfo.h coredistools.h diff --git a/src/coreclr/jit/CMakeLists.txt b/src/coreclr/jit/CMakeLists.txt index 570a2e99469297..fb4549c444276f 100644 --- a/src/coreclr/jit/CMakeLists.txt +++ b/src/coreclr/jit/CMakeLists.txt @@ -14,8 +14,7 @@ function(create_standalone_jit) set(oneValueArgs TARGET OS ARCH) set(multiValueArgs ADDITIONAL_DESTINATIONS) - set(options) - cmake_parse_arguments(TARGETDETAILS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) + cmake_parse_arguments(TARGETDETAILS "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) if(TARGETDETAILS_OS STREQUAL "unix_osx") if (NOT (TARGETDETAILS_ARCH STREQUAL "arm64")) @@ -454,7 +453,7 @@ function(add_jit jitName) ) # add the install targets - install_clr(TARGETS ${jitName} ${ARGN}) + install_clr(TARGETS ${jitName} ${ARGN} COMPONENT all_jits) endfunction() set(JIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) @@ -475,35 +474,34 @@ else() endif() create_standalone_jit(TARGET clrjit OS ${TARGET_OS_NAME} ARCH ${ARCH_TARGET_NAME} ADDITIONAL_DESTINATIONS sharedFramework) +install_clr(TARGETS clrjit ADDITIONAL_DESTINATIONS sharedFramework COMPONENT clrjit) +add_dependencies(clrjit_install clrjit) # Enable profile guided optimization add_pgo(clrjit) -if (CLR_CMAKE_BUILD_SUBSET_ALLJITS AND NOT CLR_CROSS_COMPONENTS_BUILD) - if (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64) - create_standalone_jit(TARGET clrjit_unix_arm64_${ARCH_HOST_NAME} OS unix ARCH arm64) - create_standalone_jit(TARGET clrjit_unix_osx_arm64_${ARCH_HOST_NAME} OS unix_osx ARCH arm64) - create_standalone_jit(TARGET clrjit_unix_x64_${ARCH_HOST_NAME} OS unix ARCH x64) - create_standalone_jit(TARGET clrjit_win_arm64_${ARCH_HOST_NAME} OS win ARCH arm64) - create_standalone_jit(TARGET clrjit_win_x64_${ARCH_HOST_NAME} OS win ARCH x64) - endif (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64) - - create_standalone_jit(TARGET clrjit_unix_armel_${ARCH_HOST_NAME} OS unix ARCH armel) - create_standalone_jit(TARGET clrjit_unix_arm_${ARCH_HOST_NAME} OS unix ARCH arm) - target_compile_definitions(clrjit_unix_arm_${ARCH_HOST_NAME} PRIVATE ARM_SOFTFP CONFIGURABLE_ARM_ABI) - create_standalone_jit(TARGET clrjit_win_arm_${ARCH_HOST_NAME} OS win ARCH arm) - create_standalone_jit(TARGET clrjit_win_x86_${ARCH_HOST_NAME} OS win ARCH x86) -else() - if (CLR_CMAKE_TARGET_UNIX) - create_standalone_jit(TARGET clrjit_unix_${ARCH_TARGET_NAME}_${ARCH_HOST_NAME} OS unix ARCH ${ARCH_TARGET_NAME}) - endif(CLR_CMAKE_TARGET_UNIX) -endif (CLR_CMAKE_BUILD_SUBSET_ALLJITS AND NOT CLR_CROSS_COMPONENTS_BUILD) - +if (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64) + create_standalone_jit(TARGET clrjit_unix_arm64_${ARCH_HOST_NAME} OS unix ARCH arm64) + create_standalone_jit(TARGET clrjit_unix_osx_arm64_${ARCH_HOST_NAME} OS unix_osx ARCH arm64) + create_standalone_jit(TARGET clrjit_unix_x64_${ARCH_HOST_NAME} OS unix ARCH x64) + create_standalone_jit(TARGET clrjit_win_arm64_${ARCH_HOST_NAME} OS win ARCH arm64) + create_standalone_jit(TARGET clrjit_win_x64_${ARCH_HOST_NAME} OS win ARCH x64) +endif (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64) + +create_standalone_jit(TARGET clrjit_unix_armel_${ARCH_HOST_NAME} OS unix ARCH armel) +create_standalone_jit(TARGET clrjit_unix_arm_${ARCH_HOST_NAME} OS unix ARCH arm) +target_compile_definitions(clrjit_unix_arm_${ARCH_HOST_NAME} PRIVATE ARM_SOFTFP CONFIGURABLE_ARM_ABI) +create_standalone_jit(TARGET clrjit_win_arm_${ARCH_HOST_NAME} OS win ARCH arm) +create_standalone_jit(TARGET clrjit_win_x86_${ARCH_HOST_NAME} OS win ARCH x86) + +if (CLR_CMAKE_TARGET_UNIX) + install_clr(TARGETS clrjit_unix_${ARCH_TARGET_NAME}_${ARCH_HOST_NAME}) +endif() if (CLR_CMAKE_TARGET_WIN32 AND CLR_CMAKE_PGO_INSTRUMENT) # Copy PGO dependency to target dir set(PGORT_DLL "pgort140.dll") find_path(PGORT_DIR ${PGORT_DLL} REQUIRED) - _install(FILES "${PGORT_DIR}/${PGORT_DLL}" DESTINATION ${CMAKE_INSTALL_PREFIX}) - _install(FILES "${PGORT_DIR}/${PGORT_DLL}" DESTINATION ${CMAKE_INSTALL_PREFIX}/sharedFramework) + install(FILES "${PGORT_DIR}/${PGORT_DLL}" DESTINATION ${CMAKE_INSTALL_PREFIX}) + install(FILES "${PGORT_DIR}/${PGORT_DLL}" DESTINATION ${CMAKE_INSTALL_PREFIX}/sharedFramework) endif () diff --git a/src/coreclr/nativeresources/CMakeLists.txt b/src/coreclr/nativeresources/CMakeLists.txt index ab3e53863e3fc9..9d330b5e5f0352 100644 --- a/src/coreclr/nativeresources/CMakeLists.txt +++ b/src/coreclr/nativeresources/CMakeLists.txt @@ -5,4 +5,4 @@ add_library_clr(nativeresourcestring resourcestring.cpp ) -_install (TARGETS nativeresourcestring DESTINATION lib) +install (TARGETS nativeresourcestring DESTINATION lib) diff --git a/src/coreclr/pal/CMakeLists.txt b/src/coreclr/pal/CMakeLists.txt index dec1191a323db1..4509e9fc0f8b5b 100644 --- a/src/coreclr/pal/CMakeLists.txt +++ b/src/coreclr/pal/CMakeLists.txt @@ -10,8 +10,4 @@ add_compile_options(-fexceptions) add_definitions(-DUSE_STL) add_subdirectory(src) - -if(CLR_CMAKE_BUILD_TESTS) - add_subdirectory(tests) -endif(CLR_CMAKE_BUILD_TESTS) - +add_subdirectory(tests) diff --git a/src/coreclr/pal/prebuilt/inc/CMakeLists.txt b/src/coreclr/pal/prebuilt/inc/CMakeLists.txt index 79f8e541e02a81..7fc6cb8bc9a523 100644 --- a/src/coreclr/pal/prebuilt/inc/CMakeLists.txt +++ b/src/coreclr/pal/prebuilt/inc/CMakeLists.txt @@ -1,4 +1,4 @@ project(COREPAL) -_install (FILES corerror.h corprof.h DESTINATION inc) +install (FILES corerror.h corprof.h DESTINATION inc) diff --git a/src/coreclr/pal/src/CMakeLists.txt b/src/coreclr/pal/src/CMakeLists.txt index cde932098692d4..7d4e532f78c9a8 100644 --- a/src/coreclr/pal/src/CMakeLists.txt +++ b/src/coreclr/pal/src/CMakeLists.txt @@ -345,4 +345,4 @@ if(FEATURE_EVENT_TRACE) endif(FEATURE_EVENT_TRACE) # Install the static PAL library for VS -_install (TARGETS coreclrpal DESTINATION lib) +install (TARGETS coreclrpal DESTINATION lib) diff --git a/src/coreclr/pal/src/eventprovider/lttngprovider/CMakeLists.txt b/src/coreclr/pal/src/eventprovider/lttngprovider/CMakeLists.txt index 5c3a04d84197e2..f39a5c7f00364a 100644 --- a/src/coreclr/pal/src/eventprovider/lttngprovider/CMakeLists.txt +++ b/src/coreclr/pal/src/eventprovider/lttngprovider/CMakeLists.txt @@ -52,10 +52,9 @@ add_library(eventprovider eventproviderhelpers.cpp ) -add_library(coreclrtraceptprovider +add_library_clr(coreclrtraceptprovider SHARED ${TRACEPOINT_PROVIDER_SOURCES} - ${VERSION_FILE_PATH} ) add_dependencies(eventprovider generated_eventing_headers) @@ -70,6 +69,8 @@ target_link_libraries(coreclrtraceptprovider set_target_properties(coreclrtraceptprovider PROPERTIES LINKER_LANGUAGE CXX) # Install the static eventprovider library -_install(TARGETS eventprovider DESTINATION lib) +install(TARGETS eventprovider DESTINATION lib) # Install the static coreclrtraceptprovider library -install_clr(TARGETS coreclrtraceptprovider ADDITIONAL_DESTINATIONS sharedFramework paltests) +install_clr(TARGETS coreclrtraceptprovider ADDITIONAL_DESTINATIONS sharedFramework COMPONENT runtime) +install(TARGETS coreclrtraceptprovider DESTINATION paltests COMPONENT paltests EXCLUDE_FROM_ALL) +add_dependencies(paltests_install coreclrtraceptprovider) diff --git a/src/coreclr/pal/tests/palsuite/CMakeLists.txt b/src/coreclr/pal/tests/palsuite/CMakeLists.txt index f59e6f43f9619b..f58757a1f6d5fc 100644 --- a/src/coreclr/pal/tests/palsuite/CMakeLists.txt +++ b/src/coreclr/pal/tests/palsuite/CMakeLists.txt @@ -32,7 +32,8 @@ if(FEATURE_EVENT_TRACE) add_subdirectory(eventprovider) endif(FEATURE_EVENT_TRACE) -_add_executable(paltests +add_executable_clr(paltests + EXCLUDE_FROM_ALL paltests.cpp common/palsuite.cpp #composite/object_management/event/nonshared/event.cpp @@ -918,7 +919,6 @@ _add_executable(paltests threading/WaitForSingleObject/WFSOSemaphoreTest/WFSOSemaphoreTest.cpp threading/WaitForSingleObject/WFSOThreadTest/WFSOThreadTest.cpp threading/YieldProcessor/test1/test1.cpp - ) add_dependencies(paltests coreclrpal) @@ -927,5 +927,6 @@ target_link_libraries(paltests ${COMMON_TEST_LIBRARIES} ) -_install (TARGETS paltests DESTINATION paltests) -_install (PROGRAMS runpaltests.sh runpaltestshelix.sh DESTINATION paltests) +install (TARGETS paltests DESTINATION paltests COMPONENT paltests EXCLUDE_FROM_ALL) +add_dependencies(paltests_install paltests) +install (PROGRAMS runpaltests.sh runpaltestshelix.sh DESTINATION paltests COMPONENT paltests EXCLUDE_FROM_ALL) diff --git a/src/coreclr/pal/tests/palsuite/eventprovider/CMakeLists.txt b/src/coreclr/pal/tests/palsuite/eventprovider/CMakeLists.txt index ccb40b05444a26..fdf326edb83781 100644 --- a/src/coreclr/pal/tests/palsuite/eventprovider/CMakeLists.txt +++ b/src/coreclr/pal/tests/palsuite/eventprovider/CMakeLists.txt @@ -20,7 +20,8 @@ if(TARGET_UNIX) include_directories(${COREPAL_SOURCE_DIR}/inc/rt) endif(TARGET_UNIX) -_add_executable(eventprovidertest +add_executable_clr(eventprovidertest + EXCLUDE_FROM_ALL ${SOURCES} ) set(EVENT_PROVIDER_DEPENDENCIES "") @@ -39,4 +40,5 @@ endif(FEATURE_EVENT_TRACE) target_link_libraries(eventprovidertest ${EVENT_PROVIDER_DEPENDENCIES} coreclrpal) add_dependencies(eventprovidertest eventing_headers) -_install (TARGETS eventprovidertest DESTINATION paltests/eventprovider) \ No newline at end of file +install (TARGETS eventprovidertest DESTINATION paltests/eventprovider COMPONENT paltests EXCLUDE_FROM_ALL) +add_dependencies(paltests_install eventprovidertest) diff --git a/src/coreclr/pal/tests/palsuite/exception_handling/pal_sxs/test1/CMakeLists.txt b/src/coreclr/pal/tests/palsuite/exception_handling/pal_sxs/test1/CMakeLists.txt index aec809d3fbc70e..08de84f25e8de4 100644 --- a/src/coreclr/pal/tests/palsuite/exception_handling/pal_sxs/test1/CMakeLists.txt +++ b/src/coreclr/pal/tests/palsuite/exception_handling/pal_sxs/test1/CMakeLists.txt @@ -23,7 +23,7 @@ if(CLR_CMAKE_HOST_UNIX) endif(CLR_CMAKE_HOST_UNIX) set(DLL1SOURCES dlltest1.cpp) -_add_library(paltest_pal_sxs_test1_dll1 SHARED ${DLL1SOURCES}) +add_library_clr(paltest_pal_sxs_test1_dll1 SHARED EXCLUDE_FROM_ALL ${DLL1SOURCES}) add_custom_target(dlltest1_exports DEPENDS ${EXPORTS_FILE1}) set_property(TARGET paltest_pal_sxs_test1_dll1 APPEND_STRING PROPERTY LINK_FLAGS ${EXPORTS_LINKER_OPTION1}) set_property(TARGET paltest_pal_sxs_test1_dll1 APPEND_STRING PROPERTY LINK_DEPENDS ${EXPORTS_FILE1}) @@ -55,7 +55,7 @@ if(CLR_CMAKE_TARGET_OSX) endif(CLR_CMAKE_TARGET_OSX) set(DLL2SOURCES dlltest2.cpp) -_add_library(paltest_pal_sxs_test1_dll2 SHARED ${DLL2SOURCES}) +add_library_clr(paltest_pal_sxs_test1_dll2 SHARED EXCLUDE_FROM_ALL ${DLL2SOURCES}) add_custom_target(dlltest2_exports DEPENDS ${EXPORTS_FILE2}) set_property(TARGET paltest_pal_sxs_test1_dll2 APPEND_STRING PROPERTY LINK_FLAGS ${EXPORTS_LINKER_OPTION2}) set_property(TARGET paltest_pal_sxs_test1_dll2 APPEND_STRING PROPERTY LINK_DEPENDS ${EXPORTS_FILE2}) @@ -72,7 +72,7 @@ target_link_libraries(paltest_pal_sxs_test1_dll2 set(TESTSOURCES exceptionsxs.cpp) -_add_executable(paltest_pal_sxs_test1 ${TESTSOURCES}) +add_executable_clr(paltest_pal_sxs_test1 EXCLUDE_FROM_ALL ${TESTSOURCES}) add_dependencies(paltest_pal_sxs_test1 paltest_pal_sxs_test1_dll1 @@ -84,6 +84,7 @@ target_link_libraries(paltest_pal_sxs_test1 paltest_pal_sxs_test1_dll2 ) -_install (TARGETS paltest_pal_sxs_test1 DESTINATION paltests/exception_handling/pal_sxs/test1) -_install (TARGETS paltest_pal_sxs_test1_dll1 DESTINATION paltests/exception_handling/pal_sxs/test1) -_install (TARGETS paltest_pal_sxs_test1_dll2 DESTINATION paltests/exception_handling/pal_sxs/test1) \ No newline at end of file +install (TARGETS paltest_pal_sxs_test1 DESTINATION paltests/exception_handling/pal_sxs/test1 COMPONENT paltests EXCLUDE_FROM_ALL) +install (TARGETS paltest_pal_sxs_test1_dll1 DESTINATION paltests/exception_handling/pal_sxs/test1 COMPONENT paltests EXCLUDE_FROM_ALL) +install (TARGETS paltest_pal_sxs_test1_dll2 DESTINATION paltests/exception_handling/pal_sxs/test1 COMPONENT paltests EXCLUDE_FROM_ALL) +add_dependencies(paltests_install paltest_pal_sxs_test1 paltest_pal_sxs_test1_dll1 paltest_pal_sxs_test1_dll2) diff --git a/src/coreclr/palrt/CMakeLists.txt b/src/coreclr/palrt/CMakeLists.txt index a4c6fdd5ae8313..251bbc11183333 100644 --- a/src/coreclr/palrt/CMakeLists.txt +++ b/src/coreclr/palrt/CMakeLists.txt @@ -17,4 +17,4 @@ add_library_clr(palrt ) # Install the static PAL library for VS -_install (TARGETS palrt DESTINATION lib) +install (TARGETS palrt DESTINATION lib) diff --git a/src/coreclr/runtime.proj b/src/coreclr/runtime.proj index 502090b0c5f89f..ccde644bf084ab 100644 --- a/src/coreclr/runtime.proj +++ b/src/coreclr/runtime.proj @@ -27,15 +27,18 @@ Include="-enforcepgo" /> <_CoreClrBuildArg Condition="$([MSBuild]::IsOsPlatform(Windows)) and '$(CrossDac)' != ''" Include="-$(CrossDac)dac" /> <_CoreClrBuildArg Condition="'$(Ninja)' == 'true'" Include="-ninja" /> - <_CoreClrBuildArg Condition="'$(ClrRuntimeSubset)' != 'true'" Include="-skipruntime" /> - <_CoreClrBuildArg Condition="'$(ClrJitSubset)' != 'true'" Include="-skipjit" /> - <_CoreClrBuildArg Condition="'$(ClrPalTestsSubset)' == 'true'" Include="-paltests" /> - <_CoreClrBuildArg Condition="'$(ClrAllJitsSubset)' != 'true'" Include="-skipalljits" /> <_CoreClrBuildArg Condition="'$(PgoInstrument)' == 'true'" Include="-pgoinstrument" /> <_CoreClrBuildArg Condition="'$(NoPgoOptimize)' == 'true' or '$(PgoInstrument)' == 'true'" Include="-nopgooptimize" /> <_CoreClrBuildArg Condition="'$(OfficialBuildId)' != ''" Include="/p:OfficialBuildId=$(OfficialBuildId)" /> + + <_CoreClrBuildArg Condition="'$(ClrRuntimeSubset)' == 'true'" Include="-component runtime" /> + <_CoreClrBuildArg Condition="'$(ClrJitSubset)' == 'true'" Include="-component jit" /> + <_CoreClrBuildArg Condition="'$(ClrPalTestsSubset)' == 'true'" Include="-component paltests" /> + <_CoreClrBuildArg Condition="'$(ClrAllJitsSubset)' == 'true'" Include="-component alljits" /> + + <_CoreClrBuildScript Condition="$([MSBuild]::IsOsPlatform(Windows))">build-runtime.cmd <_CoreClrBuildScript Condition="!$([MSBuild]::IsOsPlatform(Windows))">build-runtime.sh diff --git a/src/coreclr/tools/CMakeLists.txt b/src/coreclr/tools/CMakeLists.txt index 350a100df159e2..e2e3083136be4f 100644 --- a/src/coreclr/tools/CMakeLists.txt +++ b/src/coreclr/tools/CMakeLists.txt @@ -3,7 +3,5 @@ if (CLR_CMAKE_TARGET_WIN32 AND NOT CLR_CMAKE_CROSS_ARCH) add_subdirectory(GenClrDebugResource) add_subdirectory(InjectResource) - if (CLR_CROSS_COMPONENTS_BUILD) - install(EXPORT dactabletools DESTINATION dactabletools) - endif() + install(EXPORT dactabletools DESTINATION dactabletools COMPONENT crosscomponents) endif() diff --git a/src/coreclr/tools/GenClrDebugResource/CMakeLists.txt b/src/coreclr/tools/GenClrDebugResource/CMakeLists.txt index 0db21fa5d7ccd8..2ea56e1ea871de 100644 --- a/src/coreclr/tools/GenClrDebugResource/CMakeLists.txt +++ b/src/coreclr/tools/GenClrDebugResource/CMakeLists.txt @@ -6,4 +6,4 @@ target_link_libraries(GenClrDebugResource ${STATIC_MT_VCRT_LIB} ) -install(TARGETS GenClrDebugResource EXPORT dactabletools DESTINATION dactabletools) +install(TARGETS GenClrDebugResource EXPORT dactabletools DESTINATION dactabletools COMPONENT crosscomponents) diff --git a/src/coreclr/tools/InjectResource/CMakeLists.txt b/src/coreclr/tools/InjectResource/CMakeLists.txt index 0e987aedd1eee9..51f2b19349b820 100644 --- a/src/coreclr/tools/InjectResource/CMakeLists.txt +++ b/src/coreclr/tools/InjectResource/CMakeLists.txt @@ -9,4 +9,4 @@ target_link_libraries(InjectResource ${STATIC_MT_VCRT_LIB} ) -install(TARGETS InjectResource EXPORT dactabletools DESTINATION dactabletools) +install(TARGETS InjectResource EXPORT dactabletools DESTINATION dactabletools COMPONENT crosscomponents) diff --git a/src/coreclr/vm/CMakeLists.txt b/src/coreclr/vm/CMakeLists.txt index 5bd32629f3d5b1..0e1c2513fbca03 100644 --- a/src/coreclr/vm/CMakeLists.txt +++ b/src/coreclr/vm/CMakeLists.txt @@ -909,14 +909,12 @@ convert_to_absolute_path(VM_SOURCES_WKS_ARCH_ASM ${VM_SOURCES_WKS_ARCH_ASM}) convert_to_absolute_path(VM_SOURCES_DAC ${VM_SOURCES_DAC}) convert_to_absolute_path(VM_SOURCES_WKS_SPECIAL ${VM_SOURCES_WKS_SPECIAL}) -if (CLR_CMAKE_BUILD_SUBSET_RUNTIME) - add_library_clr(cee_dac ${VM_SOURCES_DAC}) - add_dependencies(cee_dac eventing_headers) - set_target_properties(cee_dac PROPERTIES DAC_COMPONENT TRUE) - target_precompile_headers(cee_dac PRIVATE [["common.h"]]) - - add_subdirectory(wks) -endif(CLR_CMAKE_BUILD_SUBSET_RUNTIME) +add_library_clr(cee_dac ${VM_SOURCES_DAC}) +add_dependencies(cee_dac eventing_headers) +set_target_properties(cee_dac PROPERTIES DAC_COMPONENT TRUE) +target_precompile_headers(cee_dac PRIVATE [["common.h"]]) + +add_subdirectory(wks) if(FEATURE_PERFTRACING) add_subdirectory(eventing) diff --git a/src/libraries/Native/Windows/CMakeLists.txt b/src/libraries/Native/Windows/CMakeLists.txt index 3f9924adb0a9d2..176f3983fdd891 100644 --- a/src/libraries/Native/Windows/CMakeLists.txt +++ b/src/libraries/Native/Windows/CMakeLists.txt @@ -9,15 +9,11 @@ SET (CMAKE_C_FLAGS_RELWITHDEBINFO_INIT "/O2 /Zi") SET (CMAKE_ASM_MASM_FLAGS "${CMAKE_ASM_MASM_FLAGS} /ZH:SHA_256") # Configuration of our libray specs and our directories -SET (CMAKE_INSTALL_PREFIX $ENV{__CMakeBinDir}) SET (CMAKE_INCLUDE_CURRENT_DIR ON) SET (CMAKE_SHARED_LIBRARY_PREFIX "") set(__SharedLinkArgs) set(__LinkArgs) -if ($ENV{__LinkArgs}) - SET (__LinkArgs $ENV{__LinkArgs}) -endif() # Force an out of source build if("${CMAKE_SOURCE_DIR}" STREQUAL "${CMAKE_BINARY_DIR}") @@ -62,7 +58,7 @@ add_compile_options(/Zl) # enable debugging information add_compile_options(/wd4960 /wd4961 /wd4603 /wd4627 /wd4838 /wd4456 /wd4457 /wd4458 /wd4459 /wd4091 /we4640) add_compile_options(/ZH:SHA_256) # use SHA256 for generating hashes of compiler processed source files. -if ($ENV{__BuildArch} STREQUAL "x86") +if (${CLR_CMAKE_HOST_ARCH} STREQUAL "x86") add_compile_options(/Gz) endif () @@ -115,7 +111,7 @@ endif() # Debug build specific flags list(INSERT __SharedLinkArgs 0 $<$,$>:/NOVCFEATURE>) -if ($ENV{__BuildArch} STREQUAL "x86_64" OR $ENV{__BuildArch} STREQUAL "amd64") +if (${CLR_CMAKE_HOST_ARCH} STREQUAL "x86_64" OR ${CLR_CMAKE_HOST_ARCH} STREQUAL "amd64") add_definitions(-DTARGET_64BIT=1) endif () diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/CMakeLists.txt b/src/libraries/Native/Windows/System.IO.Compression.Native/CMakeLists.txt index e161657b3960d7..f83e837cd58c6d 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/CMakeLists.txt +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/CMakeLists.txt @@ -10,7 +10,7 @@ if (GEN_SHARED_LIB) include (GenerateExportHeader) endif() -if($ENV{__BuildArch} STREQUAL x86 OR $ENV{__BuildArch} STREQUAL x64) +if(${CLR_CMAKE_HOST_ARCH} STREQUAL x86 OR ${CLR_CMAKE_HOST_ARCH} STREQUAL x64) set(NATIVECOMPRESSION_SOURCES zlib-intel/adler32.c zlib-intel/compress.c diff --git a/src/libraries/Native/build-native.cmd b/src/libraries/Native/build-native.cmd index 29037e2ef91253..14f70970983fe3 100644 --- a/src/libraries/Native/build-native.cmd +++ b/src/libraries/Native/build-native.cmd @@ -13,7 +13,6 @@ set __BuildArch=x64 set __BuildTarget="build" set __TargetOS=windows set CMAKE_BUILD_TYPE=Debug -set "__LinkArgs= " set "__LinkLibraries= " set __Ninja=0 diff --git a/src/libraries/Native/build-native.sh b/src/libraries/Native/build-native.sh index 0dc7c80d674fab..f0b934539d8e39 100755 --- a/src/libraries/Native/build-native.sh +++ b/src/libraries/Native/build-native.sh @@ -127,7 +127,7 @@ elif [[ "$__TargetOS" == iOS ]]; then fi elif [[ "$__TargetOS" == tvOS ]]; then __CMakeArgs="-DCMAKE_SYSTEM_NAME=tvOS $__CMakeArgs" - # set default tvOS device deployment target + # set default tvOS device deployment target # keep in sync with tvOSVersionMin in src/mono/Directory.Build.props __CMakeArgs="-DCMAKE_OSX_DEPLOYMENT_TARGET=9.0 $__CMakeArgs" if [[ "$__BuildArch" == x64 ]]; then @@ -157,4 +157,4 @@ setup_dirs check_prereqs # Build the corefx native components. -build_native "$__TargetOS" "$__BuildArch" "$__nativeroot" "$__IntermediatesDir" "$__CMakeArgs" "native libraries component" +build_native "$__TargetOS" "$__BuildArch" "$__nativeroot" "$__IntermediatesDir" "install" "$__CMakeArgs" "native libraries component" diff --git a/src/native/corehost/build.sh b/src/native/corehost/build.sh index 0c7d5128950aaa..3aa6820e73a10f 100755 --- a/src/native/corehost/build.sh +++ b/src/native/corehost/build.sh @@ -106,7 +106,7 @@ setup_dirs check_prereqs # Build the installer native components. -build_native "$__TargetOS" "$__BuildArch" "$__scriptpath" "$__IntermediatesDir" "$__CMakeArgs" "installer component" +build_native "$__TargetOS" "$__BuildArch" "$__scriptpath" "$__IntermediatesDir" "install" "$__CMakeArgs" "installer component" if [[ "$__RuntimeFlavor" != "Mono" ]]; then echo Copying "$__CoreClrArtifacts/corehost/." to "$__CMakeBinDir/corehost" diff --git a/src/native/corehost/setup.cmake b/src/native/corehost/setup.cmake index 5dd2c7ef643f56..d2e4715eaf53b8 100644 --- a/src/native/corehost/setup.cmake +++ b/src/native/corehost/setup.cmake @@ -1,7 +1,7 @@ # Licensed to the .NET Foundation under one or more agreements. # The .NET Foundation licenses this file to you under the MIT license. -if(CLR_CMAKE_BUILD_SUBSET_RUNTIME) +if(CLR_SINGLE_FILE_HOST_ONLY) # CLR partition builds only the single file host where hosting components are all statically linked. # the versioning information is irrelevant and may only come up in tracing. # so we will use "static" diff --git a/src/tests/build.sh b/src/tests/build.sh index 1ca22cce6edb9c..84674a8a339b54 100755 --- a/src/tests/build.sh +++ b/src/tests/build.sh @@ -280,7 +280,7 @@ build_Tests() fi if [[ "$__SkipNative" != 1 && "$__TargetOS" != "Browser" && "$__TargetOS" != "Android" ]]; then - build_native "$__TargetOS" "$__BuildArch" "$__TestDir" "$__NativeTestIntermediatesDir" "CoreCLR test component" + build_native "$__TargetOS" "$__BuildArch" "$__TestDir" "$__NativeTestIntermediatesDir" "install" "CoreCLR test component" if [[ "$?" -ne 0 ]]; then echo "${__ErrMsgPrefix}${__MsgPrefix}Error: native test build failed. Refer to the build log files for details (above)" From 1d4dfe186cda2ea19473976a22799274b4b41101 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Fri, 19 Mar 2021 10:44:21 -0700 Subject: [PATCH 02/18] Fixups after merging with upstream clr.iltools work. --- eng/native/functions.cmake | 3 ++- src/coreclr/build-runtime.cmd | 2 +- src/coreclr/build-runtime.sh | 11 +++-------- src/coreclr/components.cmake | 6 +++--- src/coreclr/tools/aot/jitinterface/CMakeLists.txt | 3 ++- src/coreclr/tools/crossgen/CMakeLists.txt | 2 +- src/coreclr/vm/eventing/CMakeLists.txt | 5 +---- 7 files changed, 13 insertions(+), 19 deletions(-) diff --git a/eng/native/functions.cmake b/eng/native/functions.cmake index 076d92d75aa193..5446fadfb1e207 100644 --- a/eng/native/functions.cmake +++ b/eng/native/functions.cmake @@ -385,11 +385,12 @@ function(install_clr) endif() foreach(targetName ${INSTALL_CLR_TARGETS}) + message("${targetName} is part of ${INSTALL_CLR_COMPONENT} component") if (NOT "${INSTALL_CLR_COMPONENT}" STREQUAL "${targetName}") get_property(definedComponents GLOBAL PROPERTY CLR_CMAKE_COMPONENTS) list(FIND definedComponents "${INSTALL_CLR_COMPONENT}" componentIdx) if (${componentIdx} EQUAL -1) - message(FATAL_ERROR "The ${INSTALL_CLR_COMPONENT} component is not defined. Call add_component to define the component in the build.") + message(FATAL_ERROR "The ${INSTALL_CLR_COMPONENT} component is not defined. Add a call to `add_component(${INSTALL_CLR_COMPONENT})` to define the component in the build.") endif() add_dependencies(${INSTALL_CLR_COMPONENT} ${targetName}) endif() diff --git a/src/coreclr/build-runtime.cmd b/src/coreclr/build-runtime.cmd index e51b139b992766..71021fc2803894 100644 --- a/src/coreclr/build-runtime.cmd +++ b/src/coreclr/build-runtime.cmd @@ -415,7 +415,7 @@ set __CMakeTarget= for /f "delims=" %%a in ("-%__RequestedBuildComponents%-") do ( set "string=%%a" if not "!string:-jit-=!"=="!string!" ( - set __CMakeTarget=!__CMakeTarget! clrjit_install + set __CMakeTarget=!__CMakeTarget! jit ) if not "!string:-alljits-=!"=="!string!" ( set __CMakeTarget=!__CMakeTarget! all_jits diff --git a/src/coreclr/build-runtime.sh b/src/coreclr/build-runtime.sh index ab17439007e3cd..7414909a8a20c8 100755 --- a/src/coreclr/build-runtime.sh +++ b/src/coreclr/build-runtime.sh @@ -21,12 +21,8 @@ export PYTHON usage_list+=("-nopgooptimize: do not use profile guided optimizations.") usage_list+=("-pgoinstrument: generate instrumented code for profile guided optimization enabled binaries.") usage_list+=("-skipcrossarchnative: Skip building cross-architecture native binaries.") -usage_list+=("-staticanalyzer: skip native image generation.") -usage_list+=("-skipjit: skip building jit.") -usage_list+=("-skipalljits: skip building crosstargetting jits.") -usage_list+=("-skipruntime: skip building runtime.") -usage_list+=("-skipiltools: skip building IL tools.") -usage_list+=("-paltests: build the pal tests.") +usage_list+=("-staticanalyzer: use scan_build static analyzer.") +usage_list+=("-component: Build individual components instead of the full project. Available options are 'jit', 'runtime', 'paltests', 'alljits', and 'iltools'. Can be specified multiple times.") setup_dirs_local() { @@ -244,9 +240,8 @@ if [[ "$__SkipConfigure" == 0 && "$__CodeCoverage" == 1 ]]; then fi __CMakeTarget="" -echo "Requested build components: -$__RequestedBuildComponents-" if [[ "-$__RequestedBuildComponents-" =~ "-jit-" ]]; then - __CMakeTarget="${__CMakeTarget} clrjit_install" + __CMakeTarget="${__CMakeTarget} jit" fi if [[ "-$__RequestedBuildComponents-" =~ "-alljits-" ]]; then __CMakeTarget="${__CMakeTarget} all_jits" diff --git a/src/coreclr/components.cmake b/src/coreclr/components.cmake index 1052ee84207691..a37e40dea0bf84 100644 --- a/src/coreclr/components.cmake +++ b/src/coreclr/components.cmake @@ -1,5 +1,5 @@ # Define all the individually buildable components of the CoreCLR build and their respective targets -add_component(clrjit clrjit_install) +add_component(jit) add_component(all_jits) add_component(runtime) add_component(paltests paltests_install) @@ -8,14 +8,14 @@ add_component(iltools) # Define coreclr_all as the fallback component and make every component depend on this component. set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME coreclr_misc) add_component(coreclr_misc) -add_dependencies(clrjit_install coreclr_misc) +add_dependencies(jit coreclr_misc) add_dependencies(all_jits coreclr_misc) add_dependencies(runtime coreclr_misc) add_dependencies(paltests_install coreclr_misc) add_dependencies(iltools coreclr_misc) # The runtime build requires the clrjit and iltools builds -add_dependencies(runtime clrjit_install iltools) +add_dependencies(runtime jit iltools) # The cross-components build is separate, so we don't need to add a dependency on coreclr_misc add_component(crosscomponents) diff --git a/src/coreclr/tools/aot/jitinterface/CMakeLists.txt b/src/coreclr/tools/aot/jitinterface/CMakeLists.txt index 9b7640e1a49b8b..fad93882f41a1a 100644 --- a/src/coreclr/tools/aot/jitinterface/CMakeLists.txt +++ b/src/coreclr/tools/aot/jitinterface/CMakeLists.txt @@ -17,4 +17,5 @@ add_library_clr(jitinterface_${ARCH_HOST_NAME} ${JITINTERFACE_RESOURCES} ) -install_clr(TARGETS jitinterface_${ARCH_HOST_NAME}) +install_clr(TARGETS jitinterface_${ARCH_HOST_NAME} COMPONENT jit) +install_clr(TARGETS jitinterface_${ARCH_HOST_NAME} COMPONENT all_jits) diff --git a/src/coreclr/tools/crossgen/CMakeLists.txt b/src/coreclr/tools/crossgen/CMakeLists.txt index eff97b01a882c5..d419f522031043 100644 --- a/src/coreclr/tools/crossgen/CMakeLists.txt +++ b/src/coreclr/tools/crossgen/CMakeLists.txt @@ -80,4 +80,4 @@ add_subdirectory(../../zap ../../zap) add_subdirectory(../../vm/crossgen ../../vm/crossgen) # add the install targets -install_clr(TARGETS crossgen ADDITIONAL_DESTINATIONS sharedFramework) +install_clr(TARGETS crossgen ADDITIONAL_DESTINATIONS sharedFramework COMPONENT runtime) diff --git a/src/coreclr/vm/eventing/CMakeLists.txt b/src/coreclr/vm/eventing/CMakeLists.txt index 814364799206e1..1e27a3c0693428 100644 --- a/src/coreclr/vm/eventing/CMakeLists.txt +++ b/src/coreclr/vm/eventing/CMakeLists.txt @@ -37,10 +37,7 @@ set_source_files_properties(${EventingHeaders} PROPERTIES GENERATED TRUE) add_custom_target(eventing_headers DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/eventing_headers.timestamp) add_dependencies(eventing_headers eventprovider) -# When we are not building the JIT, we only build the headers here -if(CLR_CMAKE_BUILD_SUBSET_JIT) - add_subdirectory(eventpipe) -endif() +add_subdirectory(eventpipe) if(CLR_CMAKE_HOST_WIN32) add_subdirectory(EtwProvider) From 35d617f0ed824b0634bd34301267503bba32ed57 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Fri, 19 Mar 2021 10:52:37 -0700 Subject: [PATCH 03/18] Make iltools a minimal subset that doesn't build all dependencies. --- src/coreclr/components.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/coreclr/components.cmake b/src/coreclr/components.cmake index a37e40dea0bf84..4381457c30ea49 100644 --- a/src/coreclr/components.cmake +++ b/src/coreclr/components.cmake @@ -6,13 +6,13 @@ add_component(paltests paltests_install) add_component(iltools) # Define coreclr_all as the fallback component and make every component depend on this component. +# iltools should be a minimal subset, so don't add a dependency on coreclr_misc set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME coreclr_misc) add_component(coreclr_misc) add_dependencies(jit coreclr_misc) add_dependencies(all_jits coreclr_misc) add_dependencies(runtime coreclr_misc) add_dependencies(paltests_install coreclr_misc) -add_dependencies(iltools coreclr_misc) # The runtime build requires the clrjit and iltools builds add_dependencies(runtime jit iltools) From a6ebd8c12b3fcc77953c5e92565c1bb7bbc55de8 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Fri, 19 Mar 2021 14:47:34 -0700 Subject: [PATCH 04/18] Add missing target to mono build expected in coreclr build. --- src/mono/dbi/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) diff --git a/src/mono/dbi/CMakeLists.txt b/src/mono/dbi/CMakeLists.txt index 9a0c2367e072df..6f15edc1d21a0d 100644 --- a/src/mono/dbi/CMakeLists.txt +++ b/src/mono/dbi/CMakeLists.txt @@ -93,6 +93,8 @@ include(${PROJECT_SOURCE_DIR}/../../../eng/native/configureplatform.cmake) include(${PROJECT_SOURCE_DIR}/../../../eng/native/configurecompiler.cmake) if (CLR_CMAKE_HOST_UNIX) + # Add custom target that the pal tests build expects. + add_custom_target(paltests_install) include_directories("${PROJECT_SOURCE_DIR}/../../coreclr/pal/inc") include_directories("${PROJECT_SOURCE_DIR}/../../coreclr/pal/inc/rt") include_directories("${PROJECT_SOURCE_DIR}/../../coreclr/pal/src/safecrt") From e42ed30528423019de0a4b3a600abfa15cbe940b Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Fri, 19 Mar 2021 15:33:21 -0700 Subject: [PATCH 05/18] Fix paltests arg in CI. --- eng/pipelines/coreclr/templates/build-job.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/pipelines/coreclr/templates/build-job.yml b/eng/pipelines/coreclr/templates/build-job.yml index d857a6fd375954..1ade784c566761 100644 --- a/eng/pipelines/coreclr/templates/build-job.yml +++ b/eng/pipelines/coreclr/templates/build-job.yml @@ -130,7 +130,7 @@ jobs: value: '' - ${{ if ne(parameters.testGroup, 'innerloop') }}: - name: clrBuildPALTestsBuildArg - value: '-paltests ' + value: '-component runtime -component alljits -component paltests ' - name: ninjaArg value: '' From 6f4166c9e0f228017415bc034fa7952f33340016 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Fri, 19 Mar 2021 15:34:36 -0700 Subject: [PATCH 06/18] Fix DacTableGen missing in linker tests. --- eng/Subsets.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/Subsets.props b/eng/Subsets.props index 4cf678dbb742c0..243acd6f88f395 100644 --- a/eng/Subsets.props +++ b/eng/Subsets.props @@ -145,7 +145,7 @@ - + From ecfa8c549d4e5d0bf9ec9d8269f804844b381689 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Mon, 22 Mar 2021 10:06:41 -0700 Subject: [PATCH 07/18] Fix typo --- eng/Subsets.props | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/eng/Subsets.props b/eng/Subsets.props index 243acd6f88f395..6b1a9e6a68126c 100644 --- a/eng/Subsets.props +++ b/eng/Subsets.props @@ -145,7 +145,7 @@ - + From 8d6e369485a858c57c4827ab77a510f56747e3d8 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Mon, 22 Mar 2021 10:11:37 -0700 Subject: [PATCH 08/18] Explicitly pass config down to install command line. Fixes VS build. --- eng/native/functions.cmake | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/eng/native/functions.cmake b/eng/native/functions.cmake index 5446fadfb1e207..5cabb300db5f41 100644 --- a/eng/native/functions.cmake +++ b/eng/native/functions.cmake @@ -221,7 +221,7 @@ function(add_component componentName) if (${componentIndex} EQUAL -1) list (APPEND definedComponents "${componentName}") add_custom_target("${componentTargetName}" - COMMAND "${CMAKE_COMMAND}" "-DCMAKE_INSTALL_COMPONENT=${componentName}" -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" + COMMAND "${CMAKE_COMMAND}" "-DCMAKE_INSTALL_COMPONENT=${componentName}" "-DBUILD_TYPE=$" -P "${CMAKE_BINARY_DIR}/cmake_install.cmake" ${exclude_from_all_flag}) set_property(GLOBAL PROPERTY CLR_CMAKE_COMPONENTS ${definedComponents}) endif() @@ -385,7 +385,6 @@ function(install_clr) endif() foreach(targetName ${INSTALL_CLR_TARGETS}) - message("${targetName} is part of ${INSTALL_CLR_COMPONENT} component") if (NOT "${INSTALL_CLR_COMPONENT}" STREQUAL "${targetName}") get_property(definedComponents GLOBAL PROPERTY CLR_CMAKE_COMPONENTS) list(FIND definedComponents "${INSTALL_CLR_COMPONENT}" componentIdx) From 8d198d1c4e0511efe2b247d91477d3b32847087c Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Mon, 22 Mar 2021 10:43:34 -0700 Subject: [PATCH 09/18] Specify a component for the static lib installations from libraries since they don't need to be installed in the coreclr build. --- .../Native/Unix/System.Globalization.Native/CMakeLists.txt | 2 +- .../Native/Unix/System.IO.Compression.Native/CMakeLists.txt | 2 +- src/libraries/Native/Unix/System.IO.Ports.Native/CMakeLists.txt | 2 +- src/libraries/Native/Unix/System.Native/CMakeLists.txt | 2 +- .../Native/Unix/System.Net.Security.Native/CMakeLists.txt | 2 +- .../System.Security.Cryptography.Native.Apple/CMakeLists.txt | 2 +- .../Unix/System.Security.Cryptography.Native/CMakeLists.txt | 2 +- .../Native/Windows/System.IO.Compression.Native/CMakeLists.txt | 2 +- 8 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/libraries/Native/Unix/System.Globalization.Native/CMakeLists.txt b/src/libraries/Native/Unix/System.Globalization.Native/CMakeLists.txt index b580d34856a80d..5784eb2ecc61f3 100644 --- a/src/libraries/Native/Unix/System.Globalization.Native/CMakeLists.txt +++ b/src/libraries/Native/Unix/System.Globalization.Native/CMakeLists.txt @@ -97,7 +97,7 @@ if(CLR_CMAKE_TARGET_UNIX) set_target_properties(System.Globalization.Native-Static PROPERTIES OUTPUT_NAME System.Globalization.Native CLEAN_DIRECT_OUTPUT 1) endif() -install (TARGETS System.Globalization.Native-Static DESTINATION ${STATIC_LIB_DESTINATION}) +install (TARGETS System.Globalization.Native-Static DESTINATION ${STATIC_LIB_DESTINATION} COMPONENT libs) if(NOT CLR_CMAKE_TARGET_OSX AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS AND NOT CLR_CMAKE_TARGET_ANDROID) if (GEN_SHARED_LIB) diff --git a/src/libraries/Native/Unix/System.IO.Compression.Native/CMakeLists.txt b/src/libraries/Native/Unix/System.IO.Compression.Native/CMakeLists.txt index e45d404b895191..f68e1acef69b00 100644 --- a/src/libraries/Native/Unix/System.IO.Compression.Native/CMakeLists.txt +++ b/src/libraries/Native/Unix/System.IO.Compression.Native/CMakeLists.txt @@ -100,4 +100,4 @@ add_library(System.IO.Compression.Native-Static set_target_properties(System.IO.Compression.Native-Static PROPERTIES OUTPUT_NAME System.IO.Compression.Native CLEAN_DIRECT_OUTPUT 1) -install (TARGETS System.IO.Compression.Native-Static DESTINATION ${STATIC_LIB_DESTINATION}) +install (TARGETS System.IO.Compression.Native-Static DESTINATION ${STATIC_LIB_DESTINATION} COMPONENT libs) diff --git a/src/libraries/Native/Unix/System.IO.Ports.Native/CMakeLists.txt b/src/libraries/Native/Unix/System.IO.Ports.Native/CMakeLists.txt index ede448009f2e9e..b78dce7aa2e0af 100644 --- a/src/libraries/Native/Unix/System.IO.Ports.Native/CMakeLists.txt +++ b/src/libraries/Native/Unix/System.IO.Ports.Native/CMakeLists.txt @@ -21,4 +21,4 @@ if (GEN_SHARED_LIB) install_with_stripped_symbols (System.IO.Ports.Native PROGRAMS .) endif() -install (TARGETS System.IO.Ports.Native-Static DESTINATION ${STATIC_LIB_DESTINATION}) +install (TARGETS System.IO.Ports.Native-Static DESTINATION ${STATIC_LIB_DESTINATION} COMPONENT libs) diff --git a/src/libraries/Native/Unix/System.Native/CMakeLists.txt b/src/libraries/Native/Unix/System.Native/CMakeLists.txt index 2ff29dafa48837..12245f802024fb 100644 --- a/src/libraries/Native/Unix/System.Native/CMakeLists.txt +++ b/src/libraries/Native/Unix/System.Native/CMakeLists.txt @@ -92,4 +92,4 @@ add_library(System.Native-Static set_target_properties(System.Native-Static PROPERTIES OUTPUT_NAME System.Native CLEAN_DIRECT_OUTPUT 1) -install (TARGETS System.Native-Static DESTINATION ${STATIC_LIB_DESTINATION}) +install (TARGETS System.Native-Static DESTINATION ${STATIC_LIB_DESTINATION} COMPONENT libs) diff --git a/src/libraries/Native/Unix/System.Net.Security.Native/CMakeLists.txt b/src/libraries/Native/Unix/System.Net.Security.Native/CMakeLists.txt index 3c03fa1696793b..6fbe18f76872ef 100644 --- a/src/libraries/Native/Unix/System.Net.Security.Native/CMakeLists.txt +++ b/src/libraries/Native/Unix/System.Net.Security.Native/CMakeLists.txt @@ -49,4 +49,4 @@ if (GEN_SHARED_LIB) install_with_stripped_symbols (System.Net.Security.Native PROGRAMS .) endif() -install (TARGETS System.Net.Security.Native-Static DESTINATION ${STATIC_LIB_DESTINATION}) +install (TARGETS System.Net.Security.Native-Static DESTINATION ${STATIC_LIB_DESTINATION} COMPONENT libs) diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/CMakeLists.txt b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/CMakeLists.txt index a22275331045cb..56d07f732e1010 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/CMakeLists.txt +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native.Apple/CMakeLists.txt @@ -65,4 +65,4 @@ if (GEN_SHARED_LIB) install_with_stripped_symbols (System.Security.Cryptography.Native.Apple PROGRAMS .) endif() -install (TARGETS System.Security.Cryptography.Native.Apple-Static DESTINATION ${STATIC_LIB_DESTINATION}) +install (TARGETS System.Security.Cryptography.Native.Apple-Static DESTINATION ${STATIC_LIB_DESTINATION} COMPONENT libs) diff --git a/src/libraries/Native/Unix/System.Security.Cryptography.Native/CMakeLists.txt b/src/libraries/Native/Unix/System.Security.Cryptography.Native/CMakeLists.txt index 83b9ae5999816f..62668e747c7043 100644 --- a/src/libraries/Native/Unix/System.Security.Cryptography.Native/CMakeLists.txt +++ b/src/libraries/Native/Unix/System.Security.Cryptography.Native/CMakeLists.txt @@ -119,4 +119,4 @@ if (GEN_SHARED_LIB) install_with_stripped_symbols (System.Security.Cryptography.Native.OpenSsl PROGRAMS .) endif() -install (TARGETS System.Security.Cryptography.Native.OpenSsl-Static DESTINATION ${STATIC_LIB_DESTINATION}) +install (TARGETS System.Security.Cryptography.Native.OpenSsl-Static DESTINATION ${STATIC_LIB_DESTINATION} COMPONENT libs) diff --git a/src/libraries/Native/Windows/System.IO.Compression.Native/CMakeLists.txt b/src/libraries/Native/Windows/System.IO.Compression.Native/CMakeLists.txt index f83e837cd58c6d..0ca238d56fd92d 100644 --- a/src/libraries/Native/Windows/System.IO.Compression.Native/CMakeLists.txt +++ b/src/libraries/Native/Windows/System.IO.Compression.Native/CMakeLists.txt @@ -122,4 +122,4 @@ if (GEN_SHARED_LIB) install (FILES $ DESTINATION .) endif() -install (TARGETS System.IO.Compression.Native-Static DESTINATION ${STATIC_LIB_DESTINATION}) +install (TARGETS System.IO.Compression.Native-Static DESTINATION ${STATIC_LIB_DESTINATION} COMPONENT libs) From 4b86b76299b985920d923570ab03ec4d13802bc2 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Mon, 22 Mar 2021 14:46:40 -0700 Subject: [PATCH 10/18] Move over the test of the CoreCLR targets to use install_clr to ensure components are hooked up. Update mono build to set up enough of the infra to be able to build the pal. --- eng/native/functions.cmake | 23 +++++++------ src/coreclr/CMakeLists.txt | 3 -- .../ToolBox/superpmi/mcs/CMakeLists.txt | 3 +- .../superpmi-shim-collector/CMakeLists.txt | 4 +-- .../superpmi-shim-counter/CMakeLists.txt | 4 +-- .../superpmi-shim-simple/CMakeLists.txt | 4 +-- .../ToolBox/superpmi/superpmi/CMakeLists.txt | 4 +-- src/coreclr/debug/createdump/CMakeLists.txt | 2 +- src/coreclr/debug/runtimeinfo/CMakeLists.txt | 2 +- src/coreclr/dlls/clretwrc/CMakeLists.txt | 2 +- src/coreclr/dlls/dbgshim/CMakeLists.txt | 2 +- src/coreclr/dlls/mscordac/CMakeLists.txt | 2 +- src/coreclr/dlls/mscordbi/CMakeLists.txt | 2 +- .../dlls/mscoree/coreclr/CMakeLists.txt | 2 +- src/coreclr/dlls/mscorrc/CMakeLists.txt | 2 +- src/coreclr/gc/CMakeLists.txt | 2 +- src/coreclr/hosts/corerun/CMakeLists.txt | 2 +- src/coreclr/hosts/coreshim/CMakeLists.txt | 2 +- src/coreclr/ilasm/CMakeLists.txt | 2 +- src/coreclr/ildasm/exe/CMakeLists.txt | 2 +- src/coreclr/jit/CMakeLists.txt | 32 +++++++++---------- src/coreclr/nativeresources/CMakeLists.txt | 2 +- src/coreclr/pal/src/CMakeLists.txt | 2 +- .../lttngprovider/CMakeLists.txt | 4 +-- src/coreclr/palrt/CMakeLists.txt | 2 +- .../tools/aot/jitinterface/CMakeLists.txt | 4 +-- src/coreclr/tools/crossgen/CMakeLists.txt | 2 +- src/mono/dbi/CMakeLists.txt | 5 +-- .../corehost/apphost/static/CMakeLists.txt | 4 +++ src/native/corehost/exe.cmake | 2 +- 30 files changed, 64 insertions(+), 66 deletions(-) diff --git a/eng/native/functions.cmake b/eng/native/functions.cmake index 5cabb300db5f41..c7427e4b7d3ab1 100644 --- a/eng/native/functions.cmake +++ b/eng/native/functions.cmake @@ -337,7 +337,7 @@ endfunction() function(install_with_stripped_symbols targetName kind destination) if(NOT CLR_CMAKE_KEEP_NATIVE_SYMBOLS) strip_symbols(${targetName} symbol_file) - install_symbol_file(${symbol_file} ${destination}) + install_symbol_file(${symbol_file} ${destination} ${ARGN}) endif() if ((CLR_CMAKE_TARGET_OSX OR CLR_CMAKE_TARGET_MACCATALYST OR CLR_CMAKE_TARGET_IOS OR CLR_CMAKE_TARGET_TVOS) AND ("${kind}" STREQUAL "TARGETS")) @@ -352,7 +352,7 @@ function(install_with_stripped_symbols targetName kind destination) else() message(FATAL_ERROR "The `kind` argument has to be either TARGETS or PROGRAMS, ${kind} was provided instead") endif() - install(${kind} ${install_source} DESTINATION ${destination}) + install(${kind} ${install_source} DESTINATION ${destination} ${ARGN}) endfunction() function(install_symbol_file symbol_file destination_path) @@ -363,9 +363,9 @@ function(install_symbol_file symbol_file destination_path) endif() endfunction() -# install_clr(TARGETS targetName [targetName2 ...] [ADDITIONAL_DESTINATIONS destination]) +# install_clr(TARGETS targetName [targetName2 ...] [DESTINATIONS destination [destination2 ...]] [COMPONENT componentName]) function(install_clr) - set(multiValueArgs TARGETS ADDITIONAL_DESTINATIONS) + set(multiValueArgs TARGETS DESTINATIONS) set(singleValueArgs COMPONENT) set(options "") cmake_parse_arguments(INSTALL_CLR "${options}" "${singleValueArgs}" "${multiValueArgs}" ${ARGV}) @@ -374,10 +374,14 @@ function(install_clr) message(FATAL_ERROR "At least one target must be passed to install_clr(TARGETS )") endif() - set(destinations ".") + if ("${INSTALL_CLR_DESTINATIONS}" STREQUAL "") + message(FATAL_ERROR "At least one destination must be passed to install_clr.") + endif() + + set(destinations "") - if (NOT "${INSTALL_CLR_ADDITIONAL_DESTINATIONS}" STREQUAL "") - list(APPEND destinations ${INSTALL_CLR_ADDITIONAL_DESTINATIONS}) + if (NOT "${INSTALL_CLR_DESTINATIONS}" STREQUAL "") + list(APPEND destinations ${INSTALL_CLR_DESTINATIONS}) endif() if ("${INSTALL_CLR_COMPONENT}" STREQUAL "") @@ -393,7 +397,8 @@ function(install_clr) endif() add_dependencies(${INSTALL_CLR_COMPONENT} ${targetName}) endif() - if (NOT CLR_CMAKE_KEEP_NATIVE_SYMBOLS) + get_target_property(targetType ${targetName} TYPE) + if (NOT CLR_CMAKE_KEEP_NATIVE_SYMBOLS AND NOT "${targetType}" STREQUAL "STATIC") get_symbol_file_name(${targetName} symbol_file) endif() @@ -401,7 +406,7 @@ function(install_clr) # We don't need to install the export libraries for our DLLs # since they won't be directly linked against. install(PROGRAMS $ DESTINATION ${destination} COMPONENT ${INSTALL_CLR_COMPONENT}) - if (NOT CLR_CMAKE_KEEP_NATIVE_SYMBOLS) + if (NOT "${symbolFile}" STREQUAL "") install_symbol_file(${symbol_file} ${destination} COMPONENT ${INSTALL_CLR_COMPONENT}) endif() diff --git a/src/coreclr/CMakeLists.txt b/src/coreclr/CMakeLists.txt index a24b0ccb0b2c92..7bcacd662da64a 100644 --- a/src/coreclr/CMakeLists.txt +++ b/src/coreclr/CMakeLists.txt @@ -138,9 +138,6 @@ if(NOT CLR_CROSS_COMPONENTS_BUILD) set(CLR_SINGLE_FILE_HOST_ONLY 1) add_subdirectory(${CLR_SRC_NATIVE_DIR}/corehost/apphost/static Corehost.Static) add_dependencies(runtime singlefilehost) - install(TARGETS singlefilehost COMPONENT runtime) - get_symbol_file_name(singlefilehost singlefile_symbols) - install_symbol_file(${singlefile_symbols} . COMPONENT runtime) endif() if (CLR_CMAKE_HOST_UNIX) diff --git a/src/coreclr/ToolBox/superpmi/mcs/CMakeLists.txt b/src/coreclr/ToolBox/superpmi/mcs/CMakeLists.txt index 3167680bd16e99..56dcaff658cc5a 100644 --- a/src/coreclr/ToolBox/superpmi/mcs/CMakeLists.txt +++ b/src/coreclr/ToolBox/superpmi/mcs/CMakeLists.txt @@ -66,7 +66,6 @@ else() ${STATIC_MT_CPP_LIB} ) - install (FILES $ DESTINATION PDB) endif(CLR_CMAKE_HOST_UNIX) -install (TARGETS mcs DESTINATION .) +install_clr(TARGETS mcs DESTINATIONS .) diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/CMakeLists.txt b/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/CMakeLists.txt index 48b08ee9de35fc..1eb640c4cb9c08 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/CMakeLists.txt +++ b/src/coreclr/ToolBox/superpmi/superpmi-shim-collector/CMakeLists.txt @@ -59,8 +59,6 @@ else() ${STATIC_MT_CRT_LIB} ${STATIC_MT_CPP_LIB} ) - - install (FILES $ DESTINATION PDB) endif(CLR_CMAKE_HOST_UNIX) -install (PROGRAMS $ DESTINATION .) +install_clr(TARGETS superpmi-shim-collector DESTINATIONS .) diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/CMakeLists.txt b/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/CMakeLists.txt index 51e6a1e77ce389..602a6751b02da9 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/CMakeLists.txt +++ b/src/coreclr/ToolBox/superpmi/superpmi-shim-counter/CMakeLists.txt @@ -61,8 +61,6 @@ else() ${STATIC_MT_CRT_LIB} ${STATIC_MT_CPP_LIB} ) - - install (FILES $ DESTINATION PDB) endif(CLR_CMAKE_HOST_UNIX) -install (PROGRAMS $ DESTINATION .) +install_clr(TARGETS superpmi-shim-counter DESTINATIONS .) diff --git a/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/CMakeLists.txt b/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/CMakeLists.txt index f735b68a8348a7..b6f4d52ea4cab0 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/CMakeLists.txt +++ b/src/coreclr/ToolBox/superpmi/superpmi-shim-simple/CMakeLists.txt @@ -60,8 +60,6 @@ else() ${STATIC_MT_CRT_LIB} ${STATIC_MT_CPP_LIB} ) - - install (FILES $ DESTINATION PDB) endif(CLR_CMAKE_HOST_UNIX) -install (PROGRAMS $ DESTINATION .) +install_clr(TARGETS superpmi-shim-simple DESTINATIONS .) diff --git a/src/coreclr/ToolBox/superpmi/superpmi/CMakeLists.txt b/src/coreclr/ToolBox/superpmi/superpmi/CMakeLists.txt index 3a620228487af0..92cda6d5600feb 100644 --- a/src/coreclr/ToolBox/superpmi/superpmi/CMakeLists.txt +++ b/src/coreclr/ToolBox/superpmi/superpmi/CMakeLists.txt @@ -61,8 +61,6 @@ else() ${STATIC_MT_CRT_LIB} ${STATIC_MT_CPP_LIB} ) - - install (FILES $ DESTINATION PDB) endif(CLR_CMAKE_HOST_UNIX) -install (TARGETS superpmi DESTINATION .) +install_clr(TARGETS superpmi DESTINATIONS .) diff --git a/src/coreclr/debug/createdump/CMakeLists.txt b/src/coreclr/debug/createdump/CMakeLists.txt index 81f536ab1e5ab4..5e6eda6ee95f69 100644 --- a/src/coreclr/debug/createdump/CMakeLists.txt +++ b/src/coreclr/debug/createdump/CMakeLists.txt @@ -86,4 +86,4 @@ endif(CLR_CMAKE_HOST_OSX) endif(CLR_CMAKE_HOST_WIN32) -install_clr(TARGETS createdump ADDITIONAL_DESTINATIONS sharedFramework COMPONENT runtime) +install_clr(TARGETS createdump DESTINATIONS . sharedFramework COMPONENT runtime) diff --git a/src/coreclr/debug/runtimeinfo/CMakeLists.txt b/src/coreclr/debug/runtimeinfo/CMakeLists.txt index 35e71b432ba500..2eb87bad5d18e7 100644 --- a/src/coreclr/debug/runtimeinfo/CMakeLists.txt +++ b/src/coreclr/debug/runtimeinfo/CMakeLists.txt @@ -14,4 +14,4 @@ if (NOT (CLR_CMAKE_TARGET_WIN32 AND (CLR_CMAKE_TARGET_ARCH_I386 OR CLR_CMAKE_TAR endif() # publish runtimeinfo lib -install(TARGETS runtimeinfo DESTINATION lib) +install_clr(TARGETS runtimeinfo DESTINATIONS lib COMPONENT runtime) diff --git a/src/coreclr/dlls/clretwrc/CMakeLists.txt b/src/coreclr/dlls/clretwrc/CMakeLists.txt index c4e6f95cd4840a..cc427efcde4880 100644 --- a/src/coreclr/dlls/clretwrc/CMakeLists.txt +++ b/src/coreclr/dlls/clretwrc/CMakeLists.txt @@ -20,6 +20,6 @@ add_library_clr(clretwrc SHARED ) # add the install targets -install_clr(TARGETS clretwrc ADDITIONAL_DESTINATIONS sharedFramework COMPONENT runtime) +install_clr(TARGETS clretwrc DESTINATIONS . sharedFramework COMPONENT runtime) add_dependencies(clretwrc eventing_headers) diff --git a/src/coreclr/dlls/dbgshim/CMakeLists.txt b/src/coreclr/dlls/dbgshim/CMakeLists.txt index 5b7c7f29140a29..5f323b243399c4 100644 --- a/src/coreclr/dlls/dbgshim/CMakeLists.txt +++ b/src/coreclr/dlls/dbgshim/CMakeLists.txt @@ -84,4 +84,4 @@ endif(CLR_CMAKE_HOST_WIN32) target_link_libraries(dbgshim ${DBGSHIM_LIBRARIES}) # add the install targets -install_clr(TARGETS dbgshim ADDITIONAL_DESTINATIONS sharedFramework COMPONENT runtime) +install_clr(TARGETS dbgshim DESTINATIONS . sharedFramework COMPONENT runtime) diff --git a/src/coreclr/dlls/mscordac/CMakeLists.txt b/src/coreclr/dlls/mscordac/CMakeLists.txt index 76723010f32324..f4fd1d9ef712ff 100644 --- a/src/coreclr/dlls/mscordac/CMakeLists.txt +++ b/src/coreclr/dlls/mscordac/CMakeLists.txt @@ -199,7 +199,7 @@ if(FEATURE_SINGLE_FILE_DIAGNOSTICS) endif(FEATURE_SINGLE_FILE_DIAGNOSTICS) # add the install targets -install_clr(TARGETS mscordaccore ADDITIONAL_DESTINATIONS sharedFramework COMPONENT runtime) +install_clr(TARGETS mscordaccore DESTINATIONS . sharedFramework COMPONENT runtime) if(CLR_CMAKE_HOST_WIN32) set(LONG_NAME_HOST_ARCH ${CLR_CMAKE_HOST_ARCH}) diff --git a/src/coreclr/dlls/mscordbi/CMakeLists.txt b/src/coreclr/dlls/mscordbi/CMakeLists.txt index ee626faf1e246f..7bda345b2ba3f8 100644 --- a/src/coreclr/dlls/mscordbi/CMakeLists.txt +++ b/src/coreclr/dlls/mscordbi/CMakeLists.txt @@ -126,4 +126,4 @@ if(FEATURE_SINGLE_FILE_DIAGNOSTICS) endif(FEATURE_SINGLE_FILE_DIAGNOSTICS) # add the install targets -install_clr(TARGETS mscordbi ADDITIONAL_DESTINATIONS sharedFramework COMPONENT runtime) +install_clr(TARGETS mscordbi DESTINATIONS . sharedFramework COMPONENT runtime) diff --git a/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt b/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt index f1e31ef9135e70..d15af04d65458e 100644 --- a/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt +++ b/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt @@ -235,7 +235,7 @@ if(CLR_CMAKE_TARGET_WIN32) endif(CLR_CMAKE_TARGET_WIN32) # add the install targets -install_clr(TARGETS coreclr ADDITIONAL_DESTINATIONS sharedFramework COMPONENT runtime) +install_clr(TARGETS coreclr DESTINATIONS . sharedFramework COMPONENT runtime) # Enable profile guided optimization add_pgo(coreclr) diff --git a/src/coreclr/dlls/mscorrc/CMakeLists.txt b/src/coreclr/dlls/mscorrc/CMakeLists.txt index 81bb0501977b73..c6618f0b77b238 100644 --- a/src/coreclr/dlls/mscorrc/CMakeLists.txt +++ b/src/coreclr/dlls/mscorrc/CMakeLists.txt @@ -15,7 +15,7 @@ if(CLR_CMAKE_HOST_WIN32) include.rc ) - install_clr(TARGETS mscorrc ADDITIONAL_DESTINATIONS sharedFramework COMPONENT runtime) + install_clr(TARGETS mscorrc DESTINATIONS . sharedFramework COMPONENT runtime) else() build_resources(${CMAKE_CURRENT_SOURCE_DIR}/include.rc mscorrc TARGET_CPP_FILE) diff --git a/src/coreclr/gc/CMakeLists.txt b/src/coreclr/gc/CMakeLists.txt index ac2c85011b7782..a6c4073d0b148d 100644 --- a/src/coreclr/gc/CMakeLists.txt +++ b/src/coreclr/gc/CMakeLists.txt @@ -110,7 +110,7 @@ convert_to_absolute_path(GC_SOURCES ${GC_SOURCES}) add_library_clr(clrgc SHARED ${GC_SOURCES}) add_dependencies(clrgc eventing_headers) target_link_libraries(clrgc ${GC_LINK_LIBRARIES}) -install_clr(TARGETS clrgc COMPONENT runtime) +install_clr(TARGETS clrgc DESTINATIONS . COMPONENT runtime) if(CLR_CMAKE_HOST_UNIX) # dprintf causes many warnings (https://github.com/dotnet/runtime/issues/8737) diff --git a/src/coreclr/hosts/corerun/CMakeLists.txt b/src/coreclr/hosts/corerun/CMakeLists.txt index 83abab40f9f618..da545877ca3180 100644 --- a/src/coreclr/hosts/corerun/CMakeLists.txt +++ b/src/coreclr/hosts/corerun/CMakeLists.txt @@ -32,4 +32,4 @@ else(CLR_CMAKE_HOST_WIN32) endif() endif(CLR_CMAKE_HOST_WIN32) -install_clr(TARGETS corerun COMPONENT runtime) +install_clr(TARGETS corerun DESTINATIONS . COMPONENT runtime) diff --git a/src/coreclr/hosts/coreshim/CMakeLists.txt b/src/coreclr/hosts/coreshim/CMakeLists.txt index 1fba0341198fac..5c6a2fd28899d8 100644 --- a/src/coreclr/hosts/coreshim/CMakeLists.txt +++ b/src/coreclr/hosts/coreshim/CMakeLists.txt @@ -22,4 +22,4 @@ target_link_libraries(CoreShim ${STATIC_MT_VCRT_LIB} ) -install_clr(TARGETS CoreShim COMPONENT runtime) +install_clr(TARGETS CoreShim DESTINATIONS . COMPONENT runtime) diff --git a/src/coreclr/ilasm/CMakeLists.txt b/src/coreclr/ilasm/CMakeLists.txt index 2c9a4a4771d400..c2747a83aec60c 100644 --- a/src/coreclr/ilasm/CMakeLists.txt +++ b/src/coreclr/ilasm/CMakeLists.txt @@ -126,4 +126,4 @@ else() ) endif(CLR_CMAKE_HOST_UNIX) -install_clr(TARGETS ilasm COMPONENT iltools) +install_clr(TARGETS ilasm DESTINATIONS . COMPONENT iltools) diff --git a/src/coreclr/ildasm/exe/CMakeLists.txt b/src/coreclr/ildasm/exe/CMakeLists.txt index 9daa46bf8ae146..f946f33ffa2133 100644 --- a/src/coreclr/ildasm/exe/CMakeLists.txt +++ b/src/coreclr/ildasm/exe/CMakeLists.txt @@ -115,4 +115,4 @@ else() ) endif(CLR_CMAKE_HOST_UNIX) -install_clr(TARGETS ildasm COMPONENT iltools) +install_clr(TARGETS ildasm DESTINATIONS . COMPONENT iltools) diff --git a/src/coreclr/jit/CMakeLists.txt b/src/coreclr/jit/CMakeLists.txt index 2da1577ce58e69..e25d98bd35a33d 100644 --- a/src/coreclr/jit/CMakeLists.txt +++ b/src/coreclr/jit/CMakeLists.txt @@ -13,7 +13,7 @@ add_compile_options($<$:-W4>) function(create_standalone_jit) set(oneValueArgs TARGET OS ARCH) - set(multiValueArgs ADDITIONAL_DESTINATIONS) + set(multiValueArgs DESTINATIONS) cmake_parse_arguments(TARGETDETAILS "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN}) if(TARGETDETAILS_OS STREQUAL "unix_osx") @@ -37,10 +37,10 @@ function(create_standalone_jit) clr_unknown_arch() endif() - if (TARGETDETAILS_ADDITIONAL_DESTINATIONS STREQUAL "") + if (TARGETDETAILS_DESTINATIONS STREQUAL "") add_jit(${TARGETDETAILS_TARGET}) else() - add_jit(${TARGETDETAILS_TARGET} ADDITIONAL_DESTINATIONS "${TARGETDETAILS_ADDITIONAL_DESTINATIONS}") + add_jit(${TARGETDETAILS_TARGET} DESTINATIONS "${TARGETDETAILS_DESTINATIONS}") endif() set_target_definitions_to_custom_os_and_arch(${ARGN}) @@ -421,7 +421,7 @@ else() endif(CLR_CMAKE_HOST_UNIX) # Shared function for generating JIT -# optional arguments: ADDITIONAL_DESTINATIONS path +# optional arguments: DESTINATIONS path function(add_jit jitName) set_source_files_properties(${JIT_EXPORTS_FILE} PROPERTIES GENERATED TRUE) @@ -473,28 +473,28 @@ else() set(TARGET_OS_NAME win) endif() -create_standalone_jit(TARGET clrjit OS ${TARGET_OS_NAME} ARCH ${ARCH_TARGET_NAME} ADDITIONAL_DESTINATIONS sharedFramework) -install_clr(TARGETS clrjit ADDITIONAL_DESTINATIONS sharedFramework COMPONENT jit) +create_standalone_jit(TARGET clrjit OS ${TARGET_OS_NAME} ARCH ${ARCH_TARGET_NAME} DESTINATIONS . sharedFramework) +install_clr(TARGETS clrjit DESTINATIONS . sharedFramework COMPONENT jit) # Enable profile guided optimization add_pgo(clrjit) if (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64) - create_standalone_jit(TARGET clrjit_unix_arm64_${ARCH_HOST_NAME} OS unix ARCH arm64) - create_standalone_jit(TARGET clrjit_unix_osx_arm64_${ARCH_HOST_NAME} OS unix_osx ARCH arm64) - create_standalone_jit(TARGET clrjit_unix_x64_${ARCH_HOST_NAME} OS unix ARCH x64) - create_standalone_jit(TARGET clrjit_win_arm64_${ARCH_HOST_NAME} OS win ARCH arm64) - create_standalone_jit(TARGET clrjit_win_x64_${ARCH_HOST_NAME} OS win ARCH x64) + create_standalone_jit(TARGET clrjit_unix_arm64_${ARCH_HOST_NAME} OS unix ARCH arm64 DESTINATIONS .) + create_standalone_jit(TARGET clrjit_unix_osx_arm64_${ARCH_HOST_NAME} OS unix_osx ARCH arm64 DESTINATIONS .) + create_standalone_jit(TARGET clrjit_unix_x64_${ARCH_HOST_NAME} OS unix ARCH x64 DESTINATIONS .) + create_standalone_jit(TARGET clrjit_win_arm64_${ARCH_HOST_NAME} OS win ARCH arm64 DESTINATIONS .) + create_standalone_jit(TARGET clrjit_win_x64_${ARCH_HOST_NAME} OS win ARCH x64 DESTINATIONS .) endif (CLR_CMAKE_TARGET_ARCH_ARM64 OR CLR_CMAKE_TARGET_ARCH_AMD64) -create_standalone_jit(TARGET clrjit_unix_armel_${ARCH_HOST_NAME} OS unix ARCH armel) -create_standalone_jit(TARGET clrjit_unix_arm_${ARCH_HOST_NAME} OS unix ARCH arm) +create_standalone_jit(TARGET clrjit_unix_armel_${ARCH_HOST_NAME} OS unix ARCH armel DESTINATIONS .) +create_standalone_jit(TARGET clrjit_unix_arm_${ARCH_HOST_NAME} OS unix ARCH arm DESTINATIONS .) target_compile_definitions(clrjit_unix_arm_${ARCH_HOST_NAME} PRIVATE ARM_SOFTFP CONFIGURABLE_ARM_ABI) -create_standalone_jit(TARGET clrjit_win_arm_${ARCH_HOST_NAME} OS win ARCH arm) -create_standalone_jit(TARGET clrjit_win_x86_${ARCH_HOST_NAME} OS win ARCH x86) +create_standalone_jit(TARGET clrjit_win_arm_${ARCH_HOST_NAME} OS win ARCH arm DESTINATIONS .) +create_standalone_jit(TARGET clrjit_win_x86_${ARCH_HOST_NAME} OS win ARCH x86 DESTINATIONS .) if (CLR_CMAKE_TARGET_UNIX) - install_clr(TARGETS clrjit_unix_${ARCH_TARGET_NAME}_${ARCH_HOST_NAME} COMPONENT jit) + install_clr(TARGETS clrjit_unix_${ARCH_TARGET_NAME}_${ARCH_HOST_NAME} DESTINATIONS . COMPONENT jit) if (ARCH_TARGET_NAME STREQUAL arm) target_compile_definitions(clrjit_unix_arm_${ARCH_HOST_NAME} PRIVATE ARM_SOFTFP CONFIGURABLE_ARM_ABI) endif (ARCH_TARGET_NAME STREQUAL arm) diff --git a/src/coreclr/nativeresources/CMakeLists.txt b/src/coreclr/nativeresources/CMakeLists.txt index 9d330b5e5f0352..6959ca2497ad57 100644 --- a/src/coreclr/nativeresources/CMakeLists.txt +++ b/src/coreclr/nativeresources/CMakeLists.txt @@ -5,4 +5,4 @@ add_library_clr(nativeresourcestring resourcestring.cpp ) -install (TARGETS nativeresourcestring DESTINATION lib) +install_clr (TARGETS nativeresourcestring DESTINATIONS lib) diff --git a/src/coreclr/pal/src/CMakeLists.txt b/src/coreclr/pal/src/CMakeLists.txt index 7d4e532f78c9a8..0c2021dab02d92 100644 --- a/src/coreclr/pal/src/CMakeLists.txt +++ b/src/coreclr/pal/src/CMakeLists.txt @@ -345,4 +345,4 @@ if(FEATURE_EVENT_TRACE) endif(FEATURE_EVENT_TRACE) # Install the static PAL library for VS -install (TARGETS coreclrpal DESTINATION lib) +install_clr (TARGETS coreclrpal DESTINATIONS lib) diff --git a/src/coreclr/pal/src/eventprovider/lttngprovider/CMakeLists.txt b/src/coreclr/pal/src/eventprovider/lttngprovider/CMakeLists.txt index f39a5c7f00364a..8773cd797bcfb6 100644 --- a/src/coreclr/pal/src/eventprovider/lttngprovider/CMakeLists.txt +++ b/src/coreclr/pal/src/eventprovider/lttngprovider/CMakeLists.txt @@ -69,8 +69,8 @@ target_link_libraries(coreclrtraceptprovider set_target_properties(coreclrtraceptprovider PROPERTIES LINKER_LANGUAGE CXX) # Install the static eventprovider library -install(TARGETS eventprovider DESTINATION lib) +install_clr(TARGETS eventprovider DESTINATIONS lib COMPONENT runtime) # Install the static coreclrtraceptprovider library -install_clr(TARGETS coreclrtraceptprovider ADDITIONAL_DESTINATIONS sharedFramework COMPONENT runtime) +install_clr(TARGETS coreclrtraceptprovider DESTINATIONS . sharedFramework COMPONENT runtime) install(TARGETS coreclrtraceptprovider DESTINATION paltests COMPONENT paltests EXCLUDE_FROM_ALL) add_dependencies(paltests_install coreclrtraceptprovider) diff --git a/src/coreclr/palrt/CMakeLists.txt b/src/coreclr/palrt/CMakeLists.txt index 251bbc11183333..f3042f2875352f 100644 --- a/src/coreclr/palrt/CMakeLists.txt +++ b/src/coreclr/palrt/CMakeLists.txt @@ -17,4 +17,4 @@ add_library_clr(palrt ) # Install the static PAL library for VS -install (TARGETS palrt DESTINATION lib) +install_clr(TARGETS palrt DESTINATIONS lib) diff --git a/src/coreclr/tools/aot/jitinterface/CMakeLists.txt b/src/coreclr/tools/aot/jitinterface/CMakeLists.txt index fad93882f41a1a..372271c120d0e7 100644 --- a/src/coreclr/tools/aot/jitinterface/CMakeLists.txt +++ b/src/coreclr/tools/aot/jitinterface/CMakeLists.txt @@ -17,5 +17,5 @@ add_library_clr(jitinterface_${ARCH_HOST_NAME} ${JITINTERFACE_RESOURCES} ) -install_clr(TARGETS jitinterface_${ARCH_HOST_NAME} COMPONENT jit) -install_clr(TARGETS jitinterface_${ARCH_HOST_NAME} COMPONENT all_jits) +install_clr(TARGETS jitinterface_${ARCH_HOST_NAME} DESTINATIONS . COMPONENT jit) +install_clr(TARGETS jitinterface_${ARCH_HOST_NAME} DESTINATIONS . COMPONENT all_jits) diff --git a/src/coreclr/tools/crossgen/CMakeLists.txt b/src/coreclr/tools/crossgen/CMakeLists.txt index d419f522031043..6b998ebb9e1ad1 100644 --- a/src/coreclr/tools/crossgen/CMakeLists.txt +++ b/src/coreclr/tools/crossgen/CMakeLists.txt @@ -80,4 +80,4 @@ add_subdirectory(../../zap ../../zap) add_subdirectory(../../vm/crossgen ../../vm/crossgen) # add the install targets -install_clr(TARGETS crossgen ADDITIONAL_DESTINATIONS sharedFramework COMPONENT runtime) +install_clr(TARGETS crossgen DESTINATIONS . sharedFramework COMPONENT runtime) diff --git a/src/mono/dbi/CMakeLists.txt b/src/mono/dbi/CMakeLists.txt index 6f15edc1d21a0d..5f8c0db8b8f14d 100644 --- a/src/mono/dbi/CMakeLists.txt +++ b/src/mono/dbi/CMakeLists.txt @@ -93,8 +93,9 @@ include(${PROJECT_SOURCE_DIR}/../../../eng/native/configureplatform.cmake) include(${PROJECT_SOURCE_DIR}/../../../eng/native/configurecompiler.cmake) if (CLR_CMAKE_HOST_UNIX) - # Add custom target that the pal tests build expects. - add_custom_target(paltests_install) + # Add custom targets that the pal build expects. + add_component(${CMAKE_INSTALL_DEFAULT_COMPONENT_NAME}) + add_component(paltests_install) include_directories("${PROJECT_SOURCE_DIR}/../../coreclr/pal/inc") include_directories("${PROJECT_SOURCE_DIR}/../../coreclr/pal/inc/rt") include_directories("${PROJECT_SOURCE_DIR}/../../coreclr/pal/src/safecrt") diff --git a/src/native/corehost/apphost/static/CMakeLists.txt b/src/native/corehost/apphost/static/CMakeLists.txt index c9222058ffdb85..ff0fa9ec3bc4ab 100644 --- a/src/native/corehost/apphost/static/CMakeLists.txt +++ b/src/native/corehost/apphost/static/CMakeLists.txt @@ -80,6 +80,10 @@ else() set_exports_linker_option(${EXPORTS_FILE}) endif() +if (CLR_SINGLE_FILE_HOST_ONLY) + set(ADDITIONAL_INSTALL_ARGUMENTS COMPONENT runtime) +endif() + include(../../exe.cmake) include(configure.cmake) diff --git a/src/native/corehost/exe.cmake b/src/native/corehost/exe.cmake index c60742144e65be..f49ed59c73a1e2 100644 --- a/src/native/corehost/exe.cmake +++ b/src/native/corehost/exe.cmake @@ -26,6 +26,6 @@ if(NOT CLR_CMAKE_TARGET_WIN32) disable_pax_mprotect(${DOTNET_PROJECT_NAME}) endif() -install_with_stripped_symbols(${DOTNET_PROJECT_NAME} TARGETS corehost) +install_with_stripped_symbols(${DOTNET_PROJECT_NAME} TARGETS corehost ${ADDITIONAL_INSTALL_ARGUMENTS}) set_common_libs("exe") From 7acef3206be24d34f861cf206c38cc0a631849ca Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Mon, 22 Mar 2021 15:16:02 -0700 Subject: [PATCH 11/18] Fix destinations. --- src/coreclr/crosscomponents.cmake | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/coreclr/crosscomponents.cmake b/src/coreclr/crosscomponents.cmake index f2d7c959ae1242..e8d51914951e33 100644 --- a/src/coreclr/crosscomponents.cmake +++ b/src/coreclr/crosscomponents.cmake @@ -4,12 +4,14 @@ if (CLR_CMAKE_HOST_OS STREQUAL CLR_CMAKE_TARGET_OS) install_clr (TARGETS clrjit jitinterface_${ARCH_HOST_NAME} + DESTINATIONS . COMPONENT crosscomponents ) if(CLR_CMAKE_HOST_LINUX OR NOT FEATURE_CROSSBITNESS) install_clr (TARGETS crossgen + DESTINATIONS . COMPONENT crosscomponents ) endif() @@ -17,6 +19,7 @@ if (CLR_CMAKE_HOST_OS STREQUAL CLR_CMAKE_TARGET_OS) if (CLR_CMAKE_TARGET_UNIX) install_clr (TARGETS clrjit_unix_${ARCH_TARGET_NAME}_${ARCH_HOST_NAME} + DESTINATIONS . COMPONENT crosscomponents ) endif(CLR_CMAKE_TARGET_UNIX) @@ -26,6 +29,7 @@ if(NOT CLR_CMAKE_HOST_LINUX AND NOT CLR_CMAKE_HOST_OSX AND NOT FEATURE_CROSSBITN install_clr (TARGETS mscordaccore mscordbi + DESTINATIONS . COMPONENT crosscomponents ) endif() From f4a66a6c97455cc126fac06b6c85c5e5546a0a07 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Tue, 23 Mar 2021 09:50:26 -0700 Subject: [PATCH 12/18] Bump minimum CMake version to the recommended version as per @jkotas' feedback. --- eng/native/set-cmake-path.ps1 | 7 ++----- 1 file changed, 2 insertions(+), 5 deletions(-) diff --git a/eng/native/set-cmake-path.ps1 b/eng/native/set-cmake-path.ps1 index 57f0e6491cff06..d83ce5ab5841d4 100644 --- a/eng/native/set-cmake-path.ps1 +++ b/eng/native/set-cmake-path.ps1 @@ -35,11 +35,8 @@ try { $version = [Version]$(& $cmakePath --version | Select-String -Pattern '\d+\.\d+\.\d+' | %{$_.Matches.Value}) - if ($version -lt [Version]"3.14.0") { - throw "This repository requires CMake 3.14 and recommends CMake 3.16. The version of CMake installed is $version. Please install CMake 3.16 or newer from https://cmake.org/download/." - } - elseif ($version -lt [Version]"3.16.4") { - [System.Console]::Error.WriteLine("CMake 3.16.4 or newer is recommended for building this repository. The newest version of CMake installed is $version. Please install CMake 3.16.4 or newer from https://cmake.org/download/.") + if ($version -lt [Version]"3.16.4") { + throw "CMake 3.16.4 or newer is required for building this repository. The newest version of CMake installed is $version. Please install CMake 3.16.4 or newer from https://cmake.org/download/." } [System.Console]::WriteLine("set CMakePath=" + $cmakePath) From 002dd85a88f0983f39c5fda51ccdcebe5b994cc6 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Fri, 26 Mar 2021 14:46:14 -0700 Subject: [PATCH 13/18] Create the target names from the component names and reduce duplication. --- eng/native/gen-buildsys.cmd | 2 +- src/coreclr/build-runtime.cmd | 22 ++-------------------- src/coreclr/build-runtime.sh | 21 +++------------------ 3 files changed, 6 insertions(+), 39 deletions(-) diff --git a/eng/native/gen-buildsys.cmd b/eng/native/gen-buildsys.cmd index 1ad99c9c328fcb..2d81dd174e0a00 100644 --- a/eng/native/gen-buildsys.cmd +++ b/eng/native/gen-buildsys.cmd @@ -80,7 +80,7 @@ if not "%__ConfigureOnly%" == "1" ( echo The CMake command line is the same as the last run. Skipping running CMake. exit /B 0 ) else ( - echo The CMake command line different from the last run. Running CMake again. + echo The CMake command line differs from the last run. Running CMake again. echo %__ExtraCmakeParams% > %__CmdLineOptionsUpToDateFile% ) ) else ( diff --git a/src/coreclr/build-runtime.cmd b/src/coreclr/build-runtime.cmd index 0b15a38ee59850..2f7892b19f33e2 100644 --- a/src/coreclr/build-runtime.cmd +++ b/src/coreclr/build-runtime.cmd @@ -152,7 +152,7 @@ if /i "%1" == "-ninja" (set __Ninja=1&set processedArgs=!processed 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) -if /i "%1" == "-component" (set __RequestedBuildComponents=%__RequestedBuildComponents%-%2&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop) +if /i "%1" == "-component" (set __RequestedBuildComponents=%__RequestedBuildComponents% %2&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop) REM TODO these are deprecated remove them eventually REM don't add more, use the - syntax instead @@ -414,25 +414,7 @@ if NOT DEFINED PYTHON ( goto ExitWithError ) -set __CMakeTarget= -for /f "delims=" %%a in ("-%__RequestedBuildComponents%-") do ( - set "string=%%a" - if not "!string:-jit-=!"=="!string!" ( - set __CMakeTarget=!__CMakeTarget! jit - ) - if not "!string:-alljits-=!"=="!string!" ( - set __CMakeTarget=!__CMakeTarget! all_jits - ) - if not "!string:-runtime-=!"=="!string!" ( - set __CMakeTarget=!__CMakeTarget! runtime - ) - if not "!string:-paltests-=!"=="!string!" ( - set __CMakeTarget=!__CMakeTarget! paltests_install - ) - if not "!string:-iltools-=!"=="!string!" ( - set __CMakeTarget=!__CMakeTarget! iltools - ) -) +set __CMakeTarget=!__RequestedBuildComponents: paltests = paltests_install ! if [!__CMakeTarget!] == [] ( set __CMakeTarget=install ) diff --git a/src/coreclr/build-runtime.sh b/src/coreclr/build-runtime.sh index 7414909a8a20c8..ae40282d42ebd9 100755 --- a/src/coreclr/build-runtime.sh +++ b/src/coreclr/build-runtime.sh @@ -123,7 +123,7 @@ handle_arguments_local() { ;; component|-component) - __RequestedBuildComponents="$__RequestedBuildComponents${__RequestedBuildComponents:+-}$2" + __RequestedBuildComponents="$__RequestedBuildComponents $2" __ShiftArgs=1 ;; *) @@ -239,23 +239,8 @@ if [[ "$__SkipConfigure" == 0 && "$__CodeCoverage" == 1 ]]; then __CMakeArgs="-DCLR_CMAKE_ENABLE_CODE_COVERAGE=1 $__CMakeArgs" fi -__CMakeTarget="" -if [[ "-$__RequestedBuildComponents-" =~ "-jit-" ]]; then - __CMakeTarget="${__CMakeTarget} jit" -fi -if [[ "-$__RequestedBuildComponents-" =~ "-alljits-" ]]; then - __CMakeTarget="${__CMakeTarget} all_jits" -fi -if [[ "-$__RequestedBuildComponents-" =~ "-runtime-" ]]; then - __CMakeTarget="${__CMakeTarget} runtime" -fi -if [[ "-$__RequestedBuildComponents-" =~ "-paltests-" ]]; then - __CMakeTarget="${__CMakeTarget} paltests_install" -fi -if [[ "-$__RequestedBuildComponents-" =~ "-iltools-" ]]; then - __CMakeTarget="${__CMakeTarget} iltools" -fi - +__CMakeTarget=" $__RequestedBuildComponents " +__CMakeTarget="${__CMakeTarget// paltests / paltests_install }" if [[ -z "$__CMakeTarget" ]]; then __CMakeTarget="install" fi From d092098b1865acf3b13dcc296dd29bcf74bda698 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Fri, 26 Mar 2021 14:48:14 -0700 Subject: [PATCH 14/18] Fix add_subdirectory ordering to match ordering in main. --- src/coreclr/CMakeLists.txt | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/coreclr/CMakeLists.txt b/src/coreclr/CMakeLists.txt index 7bcacd662da64a..b05ecbbe4fa28f 100644 --- a/src/coreclr/CMakeLists.txt +++ b/src/coreclr/CMakeLists.txt @@ -214,14 +214,16 @@ if ((CMAKE_CXX_COMPILER_ID STREQUAL "GNU") AND (CMAKE_CXX_COMPILER_VERSION VERSI endif() add_subdirectory(utilcode) -add_subdirectory(gcinfo) -add_subdirectory(jit) add_subdirectory(inc) if(CLR_CMAKE_HOST_UNIX) add_subdirectory(palrt) endif(CLR_CMAKE_HOST_UNIX) +add_subdirectory(ilasm) +add_subdirectory(ildasm) +add_subdirectory(gcinfo) +add_subdirectory(jit) add_subdirectory(vm) add_subdirectory(md) add_subdirectory(debug) @@ -231,8 +233,6 @@ add_subdirectory(dlls) add_subdirectory(ToolBox) add_subdirectory(tools) add_subdirectory(unwinder) -add_subdirectory(ildasm) -add_subdirectory(ilasm) add_subdirectory(interop) if(CLR_CMAKE_HOST_WIN32) From cb629ec503606a61499e2979fd78256a50c48a56 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Fri, 26 Mar 2021 17:26:07 -0700 Subject: [PATCH 15/18] Bring back previous processing because batch is annoying and I don't know how to get the substitutions right. --- src/coreclr/build-runtime.cmd | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/src/coreclr/build-runtime.cmd b/src/coreclr/build-runtime.cmd index 2f7892b19f33e2..0b15a38ee59850 100644 --- a/src/coreclr/build-runtime.cmd +++ b/src/coreclr/build-runtime.cmd @@ -152,7 +152,7 @@ if /i "%1" == "-ninja" (set __Ninja=1&set processedArgs=!processed 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) -if /i "%1" == "-component" (set __RequestedBuildComponents=%__RequestedBuildComponents% %2&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop) +if /i "%1" == "-component" (set __RequestedBuildComponents=%__RequestedBuildComponents%-%2&set processedArgs=!processedArgs! %1 %2&shift&shift&goto Arg_Loop) REM TODO these are deprecated remove them eventually REM don't add more, use the - syntax instead @@ -414,7 +414,25 @@ if NOT DEFINED PYTHON ( goto ExitWithError ) -set __CMakeTarget=!__RequestedBuildComponents: paltests = paltests_install ! +set __CMakeTarget= +for /f "delims=" %%a in ("-%__RequestedBuildComponents%-") do ( + set "string=%%a" + if not "!string:-jit-=!"=="!string!" ( + set __CMakeTarget=!__CMakeTarget! jit + ) + if not "!string:-alljits-=!"=="!string!" ( + set __CMakeTarget=!__CMakeTarget! all_jits + ) + if not "!string:-runtime-=!"=="!string!" ( + set __CMakeTarget=!__CMakeTarget! runtime + ) + if not "!string:-paltests-=!"=="!string!" ( + set __CMakeTarget=!__CMakeTarget! paltests_install + ) + if not "!string:-iltools-=!"=="!string!" ( + set __CMakeTarget=!__CMakeTarget! iltools + ) +) if [!__CMakeTarget!] == [] ( set __CMakeTarget=install ) From 3cfb2a770bf48046b95366280725e2f37711c339 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Fri, 26 Mar 2021 17:37:02 -0700 Subject: [PATCH 16/18] Fix bash script issue. --- src/coreclr/build-runtime.sh | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/src/coreclr/build-runtime.sh b/src/coreclr/build-runtime.sh index ae40282d42ebd9..540cbc33bb0709 100755 --- a/src/coreclr/build-runtime.sh +++ b/src/coreclr/build-runtime.sh @@ -239,8 +239,11 @@ if [[ "$__SkipConfigure" == 0 && "$__CodeCoverage" == 1 ]]; then __CMakeArgs="-DCLR_CMAKE_ENABLE_CODE_COVERAGE=1 $__CMakeArgs" fi -__CMakeTarget=" $__RequestedBuildComponents " -__CMakeTarget="${__CMakeTarget// paltests / paltests_install }" +__CMakeTarget="" +if [[ -n "$__RequestedBuildComponents" ]]; then + __CMakeTarget=" $__RequestedBuildComponents " + __CMakeTarget="${__CMakeTarget// paltests / paltests_install }" +fi if [[ -z "$__CMakeTarget" ]]; then __CMakeTarget="install" fi From 81a1f4f926aa9217cc328427367e39ca00d1f3bf Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Fri, 26 Mar 2021 22:04:47 -0700 Subject: [PATCH 17/18] Rename all_jits target to alljits --- src/coreclr/build-runtime.cmd | 2 +- src/coreclr/components.cmake | 4 ++-- src/coreclr/jit/CMakeLists.txt | 2 +- src/coreclr/tools/aot/jitinterface/CMakeLists.txt | 2 +- 4 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/coreclr/build-runtime.cmd b/src/coreclr/build-runtime.cmd index 0b15a38ee59850..631af827af47d7 100644 --- a/src/coreclr/build-runtime.cmd +++ b/src/coreclr/build-runtime.cmd @@ -421,7 +421,7 @@ for /f "delims=" %%a in ("-%__RequestedBuildComponents%-") do ( set __CMakeTarget=!__CMakeTarget! jit ) if not "!string:-alljits-=!"=="!string!" ( - set __CMakeTarget=!__CMakeTarget! all_jits + set __CMakeTarget=!__CMakeTarget! alljits ) if not "!string:-runtime-=!"=="!string!" ( set __CMakeTarget=!__CMakeTarget! runtime diff --git a/src/coreclr/components.cmake b/src/coreclr/components.cmake index 4381457c30ea49..3d630bf14a6b64 100644 --- a/src/coreclr/components.cmake +++ b/src/coreclr/components.cmake @@ -1,6 +1,6 @@ # Define all the individually buildable components of the CoreCLR build and their respective targets add_component(jit) -add_component(all_jits) +add_component(alljits) add_component(runtime) add_component(paltests paltests_install) add_component(iltools) @@ -10,7 +10,7 @@ add_component(iltools) set(CMAKE_INSTALL_DEFAULT_COMPONENT_NAME coreclr_misc) add_component(coreclr_misc) add_dependencies(jit coreclr_misc) -add_dependencies(all_jits coreclr_misc) +add_dependencies(alljits coreclr_misc) add_dependencies(runtime coreclr_misc) add_dependencies(paltests_install coreclr_misc) diff --git a/src/coreclr/jit/CMakeLists.txt b/src/coreclr/jit/CMakeLists.txt index e25d98bd35a33d..3fe27530b3d27d 100644 --- a/src/coreclr/jit/CMakeLists.txt +++ b/src/coreclr/jit/CMakeLists.txt @@ -453,7 +453,7 @@ function(add_jit jitName) ) # add the install targets - install_clr(TARGETS ${jitName} ${ARGN} COMPONENT all_jits) + install_clr(TARGETS ${jitName} ${ARGN} COMPONENT alljits) endfunction() set(JIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR}) diff --git a/src/coreclr/tools/aot/jitinterface/CMakeLists.txt b/src/coreclr/tools/aot/jitinterface/CMakeLists.txt index 372271c120d0e7..0b1cdc33fd591b 100644 --- a/src/coreclr/tools/aot/jitinterface/CMakeLists.txt +++ b/src/coreclr/tools/aot/jitinterface/CMakeLists.txt @@ -18,4 +18,4 @@ add_library_clr(jitinterface_${ARCH_HOST_NAME} ) install_clr(TARGETS jitinterface_${ARCH_HOST_NAME} DESTINATIONS . COMPONENT jit) -install_clr(TARGETS jitinterface_${ARCH_HOST_NAME} DESTINATIONS . COMPONENT all_jits) +install_clr(TARGETS jitinterface_${ARCH_HOST_NAME} DESTINATIONS . COMPONENT alljits) From bc9c13f1ca36fffd6bc0bec0cadf4c63970842f7 Mon Sep 17 00:00:00 2001 From: Jeremy Koritzinsky Date: Mon, 5 Apr 2021 09:36:42 -0700 Subject: [PATCH 18/18] Remove duplicate function definitions from bad merge. --- eng/native/functions.cmake | 8 -------- 1 file changed, 8 deletions(-) diff --git a/eng/native/functions.cmake b/eng/native/functions.cmake index 1935bba8c2e9fc..35197065da62d0 100644 --- a/eng/native/functions.cmake +++ b/eng/native/functions.cmake @@ -490,14 +490,6 @@ function(add_library_clr) endif() endfunction() -function(add_library_clr) - _add_library(${ARGV}) -endfunction() - -function(add_executable_clr) - _add_executable(${ARGV}) -endfunction() - # add_linker_flag(Flag [Config1 Config2 ...]) function(add_linker_flag Flag) if (ARGN STREQUAL "")