diff options
author | Jeremy Koritzinsky <jekoritz@microsoft.com> | 2021-04-06 01:05:34 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2021-04-06 01:05:34 +0300 |
commit | 8d6cd81d8e3b0bfd602a321b582cf3d272842128 (patch) | |
tree | 38059897e8a2846a965a5ce717819924d050aee9 /src/coreclr/CMakeLists.txt | |
parent | 49653839ef21f0cd886ee24caaf404ccaa1ac27e (diff) |
Reorganize CoreCLR native build to reduce CMake reconfigures when the build system is untouched (#49906)
Diffstat (limited to 'src/coreclr/CMakeLists.txt')
-rw-r--r-- | src/coreclr/CMakeLists.txt | 109 |
1 files changed, 48 insertions, 61 deletions
diff --git a/src/coreclr/CMakeLists.txt b/src/coreclr/CMakeLists.txt index 8dc3564a781..8f82d83fa4b 100644 --- a/src/coreclr/CMakeLists.txt +++ b/src/coreclr/CMakeLists.txt @@ -38,7 +38,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) #------------------- @@ -46,13 +50,19 @@ 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 #------------------------- @@ -64,7 +74,7 @@ endif() #------------------------------- # 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) @@ -72,7 +82,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 @@ -93,9 +103,7 @@ if(CLR_CMAKE_HOST_UNIX) 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) @@ -107,7 +115,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() @@ -118,9 +126,8 @@ 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 @@ -138,9 +145,7 @@ 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_HOST_UNIX) @@ -170,11 +175,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") @@ -225,44 +228,28 @@ if(CLR_CMAKE_HOST_UNIX) 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) |