</PropertyGroup>
<PropertyGroup>
- <DefaultCoreClrSubsets>clr.runtime+clr.jit+clr.alljits+linuxdac+clr.corelib+clr.tools+clr.nativecorelib+clr.iltools+clr.packages</DefaultCoreClrSubsets>
+ <DefaultCoreClrSubsets>clr.native+linuxdac+clr.corelib+clr.tools+clr.nativecorelib+clr.packages</DefaultCoreClrSubsets>
<DefaultMonoSubsets Condition="'$(MonoEnableLLVM)' == 'true' and '$(MonoLLVMDir)' == ''">mono.llvm+</DefaultMonoSubsets>
<DefaultMonoSubsets Condition="'$(MonoAOTEnableLLVM)' == 'true' and '$(MonoAOTLLVMDir)' == ''">mono.llvm+</DefaultMonoSubsets>
<SubsetName Include="Clr.DacTools" Description="Managed tools that support building a runtime that supports debugging (such as DacTableGen)." />
<SubsetName Include="Clr.ILTools" Description="The CoreCLR IL tools." />
<SubsetName Include="Clr.Runtime" Description="The CoreCLR .NET runtime." />
- <SubsetName Include="Clr.PalTests" Description="The CoreCLR PAL tests." />
- <SubsetName Include="Clr.PalTestList" Description="Generate the list of the CoreCLR PAL tests. When using the command line, use Clr.PalTests instead." />
+ <SubsetName Include="Clr.Native" Description="All CoreCLR native non-test components, including the runtime, jits, and other native tools." />
+ <SubsetName Include="Clr.PalTests" OnDemand="true" Description="The CoreCLR PAL tests." />
+ <SubsetName Include="Clr.PalTestList" OnDemand="true" Description="Generate the list of the CoreCLR PAL tests. When using the command line, use Clr.PalTests instead." />
<SubsetName Include="Clr.Jit" Description="The JIT for the CoreCLR .NET runtime." />
<SubsetName Include="Clr.AllJits" Description="All of the cross-targeting JIT compilers for the CoreCLR .NET runtime." />
<SubsetName Include="Clr.CoreLib" Description="The managed System.Private.CoreLib library for CoreCLR." />
<ProjectToBuild Include="$(CoreClrProjectRoot)System.Private.CoreLib\System.Private.CoreLib.csproj" Category="clr" />
</ItemGroup>
- <ItemGroup Condition="'$(TargetOS)' == 'windows' and ($(_subset.Contains('+clr.dactools+')) or $(_subset.Contains('+clr.runtime+')))">
+ <ItemGroup Condition="'$(TargetOS)' == 'windows' and ($(_subset.Contains('+clr.dactools+')) or $(_subset.Contains('+clr.runtime+')) or $(_subset.Contains('+clr.native+')))">
<ProjectToBuild Include="$(CoreClrProjectRoot)ToolBox\SOS\DacTableGen\DacTableGen.csproj;
$(CoreClrProjectRoot)ToolBox\SOS\DIALib\DIALib.ilproj"
Category="clr"/>
</ItemGroup>
<PropertyGroup Condition="$(_subset.Contains('+clr.runtime+'))">
- <ClrRuntimeBuildSubsets>$(ClrRuntimeBuildSubsets);ClrRuntimeSubset=true;ClrJitSubset=true</ClrRuntimeBuildSubsets>
+ <ClrRuntimeBuildSubsets>$(ClrRuntimeBuildSubsets);ClrRuntimeSubset=true</ClrRuntimeBuildSubsets>
+ </PropertyGroup>
+
+ <PropertyGroup Condition="$(_subset.Contains('+clr.native+'))">
+ <ClrRuntimeBuildSubsets>$(ClrRuntimeBuildSubsets);ClrFullNativeBuild=true</ClrRuntimeBuildSubsets>
</PropertyGroup>
<PropertyGroup Condition="$(_subset.Contains('+clr.jit+'))">
</PropertyGroup>
<PropertyGroup Condition="$(_subset.Contains('+clr.alljits+'))">
- <ClrRuntimeBuildSubsets>$(ClrRuntimeBuildSubsets);ClrAllJitsSubset=true;ClrJitSubset=true</ClrRuntimeBuildSubsets>
+ <ClrRuntimeBuildSubsets>$(ClrRuntimeBuildSubsets);ClrAllJitsSubset=true</ClrRuntimeBuildSubsets>
</PropertyGroup>
<PropertyGroup Condition="$(_subset.Contains('+clr.iltools+'))">
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
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}"
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}" "-DBUILD_TYPE=$<CONFIG>" -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)
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 $<TARGET_FILE:${targetName}>.dwarf)
+ else ()
+ set(strip_destination_file $<TARGET_FILE:${targetName}>.dbg)
+ endif ()
+
+ set(${outputSymbolFilename} ${strip_destination_file} PARENT_SCOPE)
+ else(CLR_CMAKE_HOST_UNIX)
+ # We can't use the $<TARGET_PDB_FILE> generator expression here since
+ # the generator expression isn't supported on resource DLLs.
+ set(${outputSymbolFilename} $<TARGET_FILE_DIR:${targetName}>/$<TARGET_FILE_PREFIX:${targetName}>$<TARGET_FILE_BASE_NAME:${targetName}>.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 $<TARGET_FILE:${targetName}>)
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)
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}
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 $<TARGET_PDB_FILE> generator expression here since
- # the generator expression isn't supported on resource DLLs.
- set(${outputFilename} ${CMAKE_CURRENT_BINARY_DIR}/$<CONFIG>/${targetName}.pdb PARENT_SCOPE)
- else()
- # We can't use the $<TARGET_PDB_FILE> 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} ${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"))
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_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 ...] [DESTINATIONS destination [destination2 ...]] [COMPONENT componentName])
function(install_clr)
- set(multiValueArgs TARGETS ADDITIONAL_DESTINATIONS)
- cmake_parse_arguments(INSTALL_CLR "" "" "${multiValueArgs}" ${ARGV})
+ set(multiValueArgs TARGETS DESTINATIONS)
+ 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 )")
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_DESTINATIONS}" STREQUAL "")
+ list(APPEND destinations ${INSTALL_CLR_DESTINATIONS})
+ endif()
- if (NOT "${INSTALL_CLR_ADDITIONAL_DESTINATIONS}" STREQUAL "")
- list(APPEND destinations ${INSTALL_CLR_ADDITIONAL_DESTINATIONS})
+ 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. Add a call to `add_component(${INSTALL_CLR_COMPONENT})` to define the component in the build.")
+ endif()
+ add_dependencies(${INSTALL_CLR_COMPONENT} ${targetName})
+ endif()
+ 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()
- 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 $<TARGET_FILE:${targetName}> 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 $<TARGET_FILE:${targetName}> DESTINATION ${destination} COMPONENT ${INSTALL_CLR_COMPONENT})
+ if (NOT "${symbolFile}" STREQUAL "")
+ 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}/$<CONFIG>/${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}/$<CONFIG>/${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()
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)
- endif()
-endfunction()
-
-function(_install)
- if(NOT DEFINED CLR_CROSS_COMPONENTS_BUILD)
- install(${ARGV})
+ if("${ARGV1}" STREQUAL "SHARED" AND NOT CLR_CMAKE_KEEP_NATIVE_SYMBOLS)
+ strip_symbols(${ARGV0} symbolFile)
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 "")
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)
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 differs 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%
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"
$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)
value: ''
- ${{ if ne(parameters.testGroup, 'innerloop') }}:
- name: clrBuildPALTestsBuildArg
- value: '-paltests '
+ value: '-component runtime -component alljits -component paltests '
- name: pgoInstrumentArg
value: ''
# 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)
#-------------------
#-------------------
include(pgosupport.cmake)
+#---------------------------------------------------
+# Define sub-component targets for the build
+#---------------------------------------------------
+include(components.cmake)
+
#---------------------------
# Build the single file host
#---------------------------
-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)
endif()
-
#-------------------------
# Enable C++ EH with SEH
#-------------------------
#-------------------------------
# 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)
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
endif()
add_subdirectory(pal)
- if(CLR_CMAKE_BUILD_SUBSET_RUNTIME)
- add_subdirectory(hosts)
- endif(CLR_CMAKE_BUILD_SUBSET_RUNTIME)
+ add_subdirectory(hosts)
else(CLR_CMAKE_HOST_UNIX)
if(CLR_CMAKE_TARGET_UNIX)
add_subdirectory(pal/src/libunwind)
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()
include_directories("pal/prebuilt/inc")
include_directories("../../artifacts/obj/coreclr")
-if(CLR_CMAKE_BUILD_SUBSET_JIT)
- add_subdirectory(tools/aot/jitinterface)
-endif(CLR_CMAKE_BUILD_SUBSET_JIT)
+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
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_HOST_UNIX)
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")
add_subdirectory(palrt)
endif(CLR_CMAKE_HOST_UNIX)
-if(CLR_CMAKE_BUILD_SUBSET_ILTOOLS)
- add_subdirectory(ildasm)
- add_subdirectory(ilasm)
-endif(CLR_CMAKE_BUILD_SUBSET_ILTOOLS)
-
-if(CLR_CMAKE_BUILD_SUBSET_JIT)
- add_subdirectory(gcinfo)
- add_subdirectory(jit)
- add_subdirectory(vm)
-else(CLR_CMAKE_BUILD_SUBSET_JIT)
- # The eventing headers are required to build the IL tools and paltests
- add_subdirectory(vm/eventing)
-endif(CLR_CMAKE_BUILD_SUBSET_JIT)
-
-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(interop)
-
- if(CLR_CMAKE_HOST_WIN32)
- add_subdirectory(hosts)
- endif(CLR_CMAKE_HOST_WIN32)
-elseif(CLR_CMAKE_BUILD_SUBSET_ILTOOLS)
- # These parts of the runtime are required to build the IL tools
- add_subdirectory(md)
- add_subdirectory(dlls/mscorrc)
- add_subdirectory(dlls/mscorpe)
-elseif(CLR_CMAKE_BUILD_SUBSET_JIT)
- 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(ilasm)
+add_subdirectory(ildasm)
+add_subdirectory(gcinfo)
+add_subdirectory(jit)
+add_subdirectory(vm)
+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(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)
-_install(FILES SOS_README.md DESTINATION .)
+install(FILES SOS_README.md DESTINATION .)
../superpmi-shared/spmidumphelper.cpp
)
-_add_executable(mcs
+add_executable_clr(mcs
${MCS_SOURCES}
)
target_precompile_headers(mcs PRIVATE "$<$<COMPILE_LANGUAGE:CXX>:standardpch.h>")
${STATIC_MT_CPP_LIB}
)
- _install (FILES $<TARGET_PDB_FILE:mcs> DESTINATION PDB)
endif(CLR_CMAKE_HOST_UNIX)
-_install (TARGETS mcs DESTINATION .)
+install_clr(TARGETS mcs DESTINATIONS .)
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}
)
${STATIC_MT_CRT_LIB}
${STATIC_MT_CPP_LIB}
)
-
- _install (FILES $<TARGET_PDB_FILE:superpmi-shim-collector> DESTINATION PDB)
endif(CLR_CMAKE_HOST_UNIX)
-_install (PROGRAMS $<TARGET_FILE:superpmi-shim-collector> DESTINATION .)
+install_clr(TARGETS superpmi-shim-collector DESTINATIONS .)
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}
)
${STATIC_MT_CRT_LIB}
${STATIC_MT_CPP_LIB}
)
-
- _install (FILES $<TARGET_PDB_FILE:superpmi-shim-counter> DESTINATION PDB)
endif(CLR_CMAKE_HOST_UNIX)
-_install (PROGRAMS $<TARGET_FILE:superpmi-shim-counter> DESTINATION .)
+install_clr(TARGETS superpmi-shim-counter DESTINATIONS .)
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}
)
${STATIC_MT_CRT_LIB}
${STATIC_MT_CPP_LIB}
)
-
- _install (FILES $<TARGET_PDB_FILE:superpmi-shim-simple> DESTINATION PDB)
endif(CLR_CMAKE_HOST_UNIX)
-_install (PROGRAMS $<TARGET_FILE:superpmi-shim-simple> DESTINATION .)
+install_clr(TARGETS superpmi-shim-simple DESTINATIONS .)
../superpmi-shared/spmidumphelper.cpp
)
-_add_executable(superpmi
+add_executable_clr(superpmi
${SUPERPMI_SOURCES}
)
${STATIC_MT_CRT_LIB}
${STATIC_MT_CPP_LIB}
)
-
- _install (FILES $<TARGET_PDB_FILE:superpmi> DESTINATION PDB)
endif(CLR_CMAKE_HOST_UNIX)
-_install (TARGETS superpmi DESTINATION .)
+install_clr(TARGETS superpmi DESTINATIONS .)
;;
*)
- handle_arguments_local "$1"
+ handle_arguments_local "$1" "$2"
;;
esac
}
set __SkipCrossArchNative=0
set __SkipGenerateVersion=0
set __RestoreOptData=1
-set __BuildJit=1
-set __BuildPALTests=0
-set __BuildAllJits=1
-set __BuildRuntime=1
-set __BuildILTools=1
set __CrossArch=
set __CrossArch2=
set __CrossOS=0
set __PgoOptDataPath=
set __CMakeArgs=
set __Ninja=1
+set __RequestedBuildComponents=
@REM CMD has a nasty habit of eating "=" on the argument list, so passing:
@REM -priority=1
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" == "-skipiltools" (set __BuildILTools=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
goto ExitWithError
)
-set __CMakeClrBuildSubsetArgs="-DCLR_CMAKE_BUILD_SUBSET_JIT=%__BuildJit%" "-DCLR_CMAKE_BUILD_SUBSET_ALLJITS=%__BuildAllJits%" "-DCLR_CMAKE_BUILD_SUBSET_RUNTIME=%__BuildRuntime%" "-DCLR_CMAKE_BUILD_SUBSET_ILTOOLS=%__BuildILTools%"
+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! alljits
+ )
+ 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 ===
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 (
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!
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 (
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!
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!
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!
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()
{
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
__StaticAnalyzer=1
;;
- skipjit|-skipjit)
- __BuildJit=0
- ;;
-
- skipalljits|-skipalljits)
- __BuildAllJits=0
- ;;
-
- skipruntime|-skipruntime)
- __BuildRuntime=0
- ;;
-
- skipiltools|-skipiltools)
- __BuildILTools=0
- ;;
-
- paltests|-paltests)
- __BuildPALTests=1
+ component|-component)
+ __RequestedBuildComponents="$__RequestedBuildComponents $2"
+ __ShiftArgs=1
;;
*)
__UnprocessedBuildArgs="$__UnprocessedBuildArgs $1"
__VerboseBuild=0
__ValidateCrossArg=1
__CMakeArgs=""
-__BuildJit=1
-__BuildPALTests=0
+__RequestedBuildComponents=""
__BuildAllJits=1
__BuildRuntime=1
__BuildILTools=1
# 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 -DCLR_CMAKE_BUILD_SUBSET_ILTOOLS=$__BuildILTools"
-__CMakeArgs="-DCLR_CMAKE_BUILD_TESTS=$__BuildPALTests $__CMakeArgs"
if [[ "$__SkipConfigure" == 0 && "$__CodeCoverage" == 1 ]]; then
__CMakeArgs="-DCLR_CMAKE_ENABLE_CODE_COVERAGE=1 $__CMakeArgs"
fi
+__CMakeTarget=""
+if [[ -n "$__RequestedBuildComponents" ]]; then
+ __CMakeTarget=" $__RequestedBuildComponents "
+ __CMakeTarget="${__CMakeTarget// paltests / paltests_install }"
+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
--- /dev/null
+# Define all the individually buildable components of the CoreCLR build and their respective targets
+add_component(jit)
+add_component(alljits)
+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.
+# 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(alljits coreclr_misc)
+add_dependencies(runtime coreclr_misc)
+add_dependencies(paltests_install coreclr_misc)
+
+# The runtime build requires the clrjit and iltools builds
+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)
-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}
+ DESTINATIONS .
+ COMPONENT crosscomponents
)
if(CLR_CMAKE_HOST_LINUX OR NOT FEATURE_CROSSBITNESS)
- list (APPEND CLR_CROSS_COMPONENTS_LIST
+ install_clr (TARGETS
crossgen
+ DESTINATIONS .
+ 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}
+ DESTINATIONS .
+ 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
+ DESTINATIONS .
+ COMPONENT crosscomponents
)
endif()
+
+if (CLR_CMAKE_TARGET_WIN32 AND NOT CLR_CMAKE_CROSS_ARCH)
+ add_dependencies(crosscomponents InjectResource GenClrDebugResource)
+endif()
createdump.rc
)
- _add_executable(createdump
+ add_executable_clr(createdump
${CREATEDUMP_SOURCES}
)
)
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}
endif(CLR_CMAKE_HOST_WIN32)
-install_clr(TARGETS createdump ADDITIONAL_DESTINATIONS sharedFramework)
+install_clr(TARGETS createdump DESTINATIONS . sharedFramework COMPONENT runtime)
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 $<TARGET_OBJECTS:debug-pal_obj>)
endif()
# publish runtimeinfo lib
-_install(TARGETS runtimeinfo DESTINATION lib)
+install_clr(TARGETS runtimeinfo DESTINATIONS lib COMPONENT runtime)
)
# add the install targets
-install_clr(TARGETS clretwrc ADDITIONAL_DESTINATIONS sharedFramework)
+install_clr(TARGETS clretwrc DESTINATIONS . sharedFramework COMPONENT runtime)
add_dependencies(clretwrc eventing_headers)
target_link_libraries(dbgshim ${DBGSHIM_LIBRARIES})
# add the install targets
-install_clr(TARGETS dbgshim ADDITIONAL_DESTINATIONS sharedFramework)
+install_clr(TARGETS dbgshim DESTINATIONS . sharedFramework COMPONENT runtime)
# 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} $<TARGET_OBJECTS:mscordacobj>)
target_link_libraries(mscordaccore PRIVATE ${COREDAC_LIBRARIES})
# add the install targets
-install_clr(TARGETS mscordaccore ADDITIONAL_DESTINATIONS sharedFramework)
+install_clr(TARGETS mscordaccore DESTINATIONS . sharedFramework COMPONENT runtime)
if(CLR_CMAKE_HOST_WIN32)
set(LONG_NAME_HOST_ARCH ${CLR_CMAKE_HOST_ARCH})
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 $<TARGET_FILE:mscordaccore> RENAME mscordaccore_${LONG_NAME_HOST_ARCH}_${LONG_NAME_TARGET_ARCH}_${FILE_VERSION}.dll DESTINATION sharedFramework)
+ install(FILES $<TARGET_FILE:mscordaccore> RENAME mscordaccore_${LONG_NAME_HOST_ARCH}_${LONG_NAME_TARGET_ARCH}_${FILE_VERSION}.dll DESTINATION sharedFramework COMPONENT runtime)
endif()
endif(CLR_CMAKE_HOST_WIN32)
# add the install targets
-install_clr(TARGETS mscordbi ADDITIONAL_DESTINATIONS sharedFramework)
+install_clr(TARGETS mscordbi DESTINATIONS . sharedFramework COMPONENT runtime)
if(NOT DEFINED CLR_CROSS_COMPONENTS_BUILD)
add_custom_target(inject_debug_resources_coreclr ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/inject_debug_resources_coreclr.timestamp)
+ add_dependencies(runtime inject_debug_resources_coreclr)
endif()
add_custom_command(
if(NOT DEFINED CLR_CROSS_COMPONENTS_BUILD)
add_custom_target(inject_debug_resources_singlefilehost ALL DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_CFG_INTDIR}/inject_debug_resources_singlefilehost.timestamp)
+ add_dependencies(runtime inject_debug_resources_singlefilehost)
endif()
endif(CLR_CMAKE_TARGET_WIN32)
# add the install targets
-install_clr(TARGETS coreclr ADDITIONAL_DESTINATIONS sharedFramework)
+install_clr(TARGETS coreclr DESTINATIONS . sharedFramework COMPONENT runtime)
# Enable profile guided optimization
add_pgo(coreclr)
include.rc
)
- install_clr(TARGETS mscorrc ADDITIONAL_DESTINATIONS sharedFramework)
+ install_clr(TARGETS mscorrc DESTINATIONS . sharedFramework COMPONENT runtime)
else()
build_resources(${CMAKE_CURRENT_SOURCE_DIR}/include.rc mscorrc TARGET_CPP_FILE)
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 DESTINATIONS . COMPONENT runtime)
if(CLR_CMAKE_HOST_UNIX)
# dprintf causes many warnings (https://github.com/dotnet/runtime/issues/8737)
../gcenv.unix.cpp)
endif()
-_add_executable(gcsample
+add_executable_clr(gcsample
${SOURCES}
)
set_target_properties(gcinfo_crossgen PROPERTIES CROSSGEN_COMPONENT TRUE)
-_install (FILES gcinfoencoder.cpp
+install (FILES gcinfoencoder.cpp
DESTINATION gcinfo)
function(create_gcinfo_lib)
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)
include(configure.cmake)
endif(CLR_CMAKE_HOST_WIN32)
-_add_executable(corerun
+add_executable_clr(corerun
corerun.cpp
native.rc
)
endif()
endif(CLR_CMAKE_HOST_WIN32)
-install_clr(TARGETS corerun)
+install_clr(TARGETS corerun DESTINATIONS . COMPONENT runtime)
${STATIC_MT_VCRT_LIB}
)
-install_clr(TARGETS CoreShim)
+install_clr(TARGETS CoreShim DESTINATIONS . COMPONENT runtime)
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}
)
)
endif(CLR_CMAKE_HOST_UNIX)
-install_clr(TARGETS ilasm)
+install_clr(TARGETS ilasm DESTINATIONS . COMPONENT iltools)
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}
)
)
endif(CLR_CMAKE_HOST_UNIX)
-install_clr(TARGETS ildasm)
+install_clr(TARGETS ildasm DESTINATIONS . COMPONENT iltools)
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 $<TARGET_OBJECTS:corguids_obj>)
# Binplace the inc files for packaging later.
-_install (FILES cfi.h
+install (FILES cfi.h
cor.h
cordebuginfo.h
coredistools.h
function(create_standalone_jit)
set(oneValueArgs TARGET OS ARCH)
- set(multiValueArgs ADDITIONAL_DESTINATIONS)
- set(options)
- cmake_parse_arguments(TARGETDETAILS "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
+ set(multiValueArgs DESTINATIONS)
+ cmake_parse_arguments(TARGETDETAILS "" "${oneValueArgs}" "${multiValueArgs}" ${ARGN})
if(TARGETDETAILS_OS STREQUAL "unix_osx")
if (NOT (TARGETDETAILS_ARCH STREQUAL "arm64"))
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})
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)
)
# add the install targets
- install_clr(TARGETS ${jitName} ${ARGN})
+ install_clr(TARGETS ${jitName} ${ARGN} COMPONENT alljits)
endfunction()
set(JIT_SOURCE_DIR ${CMAKE_CURRENT_SOURCE_DIR})
set(TARGET_OS_NAME win)
endif()
-create_standalone_jit(TARGET clrjit OS ${TARGET_OS_NAME} ARCH ${ARCH_TARGET_NAME} ADDITIONAL_DESTINATIONS sharedFramework)
+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_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})
+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 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 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 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} 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)
- endif(CLR_CMAKE_TARGET_UNIX)
-endif (CLR_CMAKE_BUILD_SUBSET_ALLJITS AND NOT CLR_CROSS_COMPONENTS_BUILD)
-
+ endif (ARCH_TARGET_NAME STREQUAL arm)
+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 ()
resourcestring.cpp
)
-_install (TARGETS nativeresourcestring DESTINATION lib)
+install_clr (TARGETS nativeresourcestring DESTINATIONS lib)
add_definitions(-DUSE_STL)
add_subdirectory(src)
-
-if(CLR_CMAKE_BUILD_TESTS)
- add_subdirectory(tests)
-endif(CLR_CMAKE_BUILD_TESTS)
-
+add_subdirectory(tests)
project(COREPAL)
-_install (FILES corerror.h corprof.h DESTINATION inc)
+install (FILES corerror.h corprof.h DESTINATION inc)
endif(FEATURE_EVENT_TRACE)
# Install the static PAL library for VS
-_install (TARGETS coreclrpal DESTINATION lib)
+install_clr (TARGETS coreclrpal DESTINATIONS lib)
eventproviderhelpers.cpp
)
-add_library(coreclrtraceptprovider
+add_library_clr(coreclrtraceptprovider
SHARED
${TRACEPOINT_PROVIDER_SOURCES}
- ${VERSION_FILE_PATH}
)
add_dependencies(eventprovider generated_eventing_headers)
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 paltests)
+install_clr(TARGETS coreclrtraceptprovider DESTINATIONS . sharedFramework COMPONENT runtime)
+install(TARGETS coreclrtraceptprovider DESTINATION paltests COMPONENT paltests EXCLUDE_FROM_ALL)
+add_dependencies(paltests_install coreclrtraceptprovider)
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
threading/WaitForSingleObject/WFSOSemaphoreTest/WFSOSemaphoreTest.cpp
threading/WaitForSingleObject/WFSOThreadTest/WFSOThreadTest.cpp
threading/YieldProcessor/test1/test1.cpp
-
)
add_dependencies(paltests coreclrpal)
${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)
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 "")
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)
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})
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})
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
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)
)
# Install the static PAL library for VS
-_install (TARGETS palrt DESTINATION lib)
+install_clr(TARGETS palrt DESTINATIONS lib)
<_CoreClrBuildArg Condition="$([MSBuild]::IsOsPlatform(Windows)) and '$(CrossDac)' != ''" Include="-$(CrossDac)dac" />
<_CoreClrBuildArg Condition="'$(Ninja)' == 'true' and !$([MSBuild]::IsOsPlatform(Windows))" Include="-ninja" />
<_CoreClrBuildArg Condition="'$(Ninja)' == 'false' and $([MSBuild]::IsOsPlatform(Windows))" Include="-msbuild" />
- <_CoreClrBuildArg Condition="'$(ClrRuntimeSubset)' != 'true'" Include="-skipruntime" />
- <_CoreClrBuildArg Condition="'$(ClrJitSubset)' != 'true'" Include="-skipjit" />
- <_CoreClrBuildArg Condition="'$(ClrILToolsSubset)' != 'true'" Include="-skipiltools" />
- <_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)" />
</ItemGroup>
+ <ItemGroup Condition="'$(ClrFullNativeBuild)' != 'true'">
+ <_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" />
+ <_CoreClrBuildArg Condition="'$(ClrILToolsSubset)' == 'true'" Include="-component iltools" />
+ </ItemGroup>
+
<PropertyGroup>
<_CoreClrBuildScript Condition="$([MSBuild]::IsOsPlatform(Windows))">build-runtime.cmd</_CoreClrBuildScript>
<_CoreClrBuildScript Condition="!$([MSBuild]::IsOsPlatform(Windows))">build-runtime.sh</_CoreClrBuildScript>
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()
${STATIC_MT_VCRT_LIB}
)
-install(TARGETS GenClrDebugResource EXPORT dactabletools DESTINATION dactabletools)
+install(TARGETS GenClrDebugResource EXPORT dactabletools DESTINATION dactabletools COMPONENT crosscomponents)
${STATIC_MT_VCRT_LIB}
)
-install(TARGETS InjectResource EXPORT dactabletools DESTINATION dactabletools)
+install(TARGETS InjectResource EXPORT dactabletools DESTINATION dactabletools COMPONENT crosscomponents)
${JITINTERFACE_RESOURCES}
)
-install_clr(TARGETS jitinterface_${ARCH_HOST_NAME})
+install_clr(TARGETS jitinterface_${ARCH_HOST_NAME} DESTINATIONS . COMPONENT jit)
+install_clr(TARGETS jitinterface_${ARCH_HOST_NAME} DESTINATIONS . COMPONENT alljits)
add_subdirectory(../../vm/crossgen ../../vm/crossgen)
# add the install targets
-install_clr(TARGETS crossgen ADDITIONAL_DESTINATIONS sharedFramework)
+install_clr(TARGETS crossgen DESTINATIONS . sharedFramework COMPONENT runtime)
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)
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)
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)
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)
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)
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)
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)
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)
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)
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}")
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 ()
# Debug build specific flags
list(INSERT __SharedLinkArgs 0 $<$<OR:$<CONFIG:DEBUG>,$<CONFIG:CHECKED>>:/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 ()
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
install (FILES $<TARGET_PDB_FILE:System.IO.Compression.Native> 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)
set __BuildTarget="build"
set __TargetOS=windows
set CMAKE_BUILD_TYPE=Debug
-set "__LinkArgs= "
set "__LinkLibraries= "
set __Ninja=1
fi
elif [[ "$__TargetOS" == tvOSSimulator ]]; 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
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"
include(${PROJECT_SOURCE_DIR}/../../../eng/native/configurecompiler.cmake)
if (CLR_CMAKE_HOST_UNIX)
+ # 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")
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)
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"
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")
# 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"
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)"