diff --git a/docs/workflow/requirements/linux-requirements.md b/docs/workflow/requirements/linux-requirements.md index 334e5e2ae354c3..81f67d0b839354 100644 --- a/docs/workflow/requirements/linux-requirements.md +++ b/docs/workflow/requirements/linux-requirements.md @@ -24,7 +24,7 @@ Minimum RAM required to build is 1GB. The build is known to fail on 512 MB VMs ( Install the following packages for the toolchain: -* CMake 3.20 or newer +* CMake 3.26 or newer * llvm * lld * clang @@ -48,7 +48,7 @@ python-is-python3 curl git lldb libicu-dev liblttng-ust-dev \ libssl-dev libkrb5-dev zlib1g-dev ninja-build ``` -**NOTE**: As of now, Ubuntu's `apt` only has until CMake version 3.16.3 if you're using Ubuntu 20.04 LTS (less in older Ubuntu versions), and version 3.18.4 in Debian 11 (less in older Debian versions). This is lower than the required 3.20, which in turn makes it incompatible with the repo. For this case, we can use the `snap` package manager or the _Kitware APT feed_ to get a new enough version of CMake. +**NOTE**: As of now, Ubuntu's `apt` only has until CMake version 3.22 if you're using Ubuntu 22.04 LTS (less in older Ubuntu versions), and version 3.25.1 in Debian 12 (less in older Debian versions). This is lower than the required 3.26, which in turn makes it incompatible with the repo. For this case, we can use the `snap` package manager or the _Kitware APT feed_ to get a new enough version of CMake. For snap: diff --git a/docs/workflow/requirements/macos-requirements.md b/docs/workflow/requirements/macos-requirements.md index 0eae7f1d621ac9..e01097e82d0303 100644 --- a/docs/workflow/requirements/macos-requirements.md +++ b/docs/workflow/requirements/macos-requirements.md @@ -23,7 +23,7 @@ Building _dotnet/runtime_ depends on several tools to be installed. You can down Install the following packages: -* CMake 3.20 or newer +* CMake 3.26 or newer * icu4c * openssl@1.1 or openssl@3 * pkg-config diff --git a/docs/workflow/requirements/windows-requirements.md b/docs/workflow/requirements/windows-requirements.md index 8c14b7e14b95e1..d2fc747dd86c47 100644 --- a/docs/workflow/requirements/windows-requirements.md +++ b/docs/workflow/requirements/windows-requirements.md @@ -53,7 +53,7 @@ These steps are required only in case the tools have not been installed as Visua * Install [CMake](https://cmake.org/download) for Windows. * Add its location (e.g. C:\Program Files (x86)\CMake\bin) to the PATH environment variable. The installation script has a check box to do this, but you can do it yourself after the fact following the instructions at [Adding to the Default PATH variable](#adding-to-the-default-path-variable). -The _dotnet/runtime_ repository requires using CMake 3.20 or newer. +The _dotnet/runtime_ repository requires using CMake 3.26 or newer. **NOTE**: If you plan on using the `-msbuild` flag for building the repo, you will need version 3.21 at least. This is because the VS2022 generator doesn't exist in CMake until said version. diff --git a/eng/native/configurecompiler.cmake b/eng/native/configurecompiler.cmake index 8decaa84fe9ad7..2246de793e2ae0 100644 --- a/eng/native/configurecompiler.cmake +++ b/eng/native/configurecompiler.cmake @@ -110,6 +110,10 @@ if (MSVC) set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /sourcelink:${CLR_SOURCELINK_FILE_PATH}") endif(EXISTS ${CLR_SOURCELINK_FILE_PATH}) + # enable $ on MSVC as a no-op + set(CMAKE_LINK_GROUP_USING_RESCAN "" "") + set(CMAKE_LINK_GROUP_USING_RESCAN_SUPPORTED ON) + if (CMAKE_GENERATOR MATCHES "^Visual Studio.*$") # Debug build specific flags # The Ninja generator doesn't appear to have the default `/INCREMENTAL:ON` that @@ -881,7 +885,9 @@ if (MSVC) # Set Warning Level 4: add_compile_options($<$:/w44177>) # Pragma data_seg s/b at global scope. - add_compile_options($<$:/Zi>) # enable debugging information + # enable debugging information. + set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT ProgramDatabase) + add_compile_options($<$:/ZH:SHA_256>) # use SHA256 for generating hashes of compiler processed source files. add_compile_options($<$:/source-charset:utf-8>) # Force MSVC to compile source as UTF-8. @@ -974,45 +980,19 @@ endif() # Ensure other tools are present if (CLR_CMAKE_HOST_WIN32) - if(CLR_CMAKE_HOST_ARCH_ARM) - - # Explicitly specify the assembler to be used for Arm32 compile - file(TO_CMAKE_PATH "$ENV{VCToolsInstallDir}\\bin\\HostX86\\arm\\armasm.exe" CMAKE_ASM_COMPILER) - - set(CMAKE_ASM_MASM_COMPILER ${CMAKE_ASM_COMPILER}) - message("CMAKE_ASM_MASM_COMPILER explicitly set to: ${CMAKE_ASM_MASM_COMPILER}") - - # Enable generic assembly compilation to avoid CMake generate VS proj files that explicitly - # use ml[64].exe as the assembler. - enable_language(ASM) - set(CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded "") - set(CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL "") - set(CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebug "") - set(CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL "") - set(CMAKE_ASM_COMPILE_OBJECT " -g -o ") - - elseif(CLR_CMAKE_HOST_ARCH_ARM64) - - # Explicitly specify the assembler to be used for Arm64 compile - file(TO_CMAKE_PATH "$ENV{VCToolsInstallDir}\\bin\\HostX86\\arm64\\armasm64.exe" CMAKE_ASM_COMPILER) - - set(CMAKE_ASM_MASM_COMPILER ${CMAKE_ASM_COMPILER}) - message("CMAKE_ASM_MASM_COMPILER explicitly set to: ${CMAKE_ASM_MASM_COMPILER}") - - # Enable generic assembly compilation to avoid CMake generate VS proj files that explicitly - # use ml[64].exe as the assembler. - enable_language(ASM) - set(CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded "") - set(CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL "") - set(CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebug "") - set(CMAKE_ASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL "") - set(CMAKE_ASM_COMPILE_OBJECT " -g -o ") + if(CLR_CMAKE_HOST_ARCH_ARM OR CLR_CMAKE_HOST_ARCH_ARM64) + enable_language(ASM_MARMASM) + # CMake before 3.29 passes defines down to the Microsoft ARMASM compiler, which is not supported. + # We need to remove the defines from the command line. + set(CMAKE_ASM_MARMASM_COMPILE_OBJECT " -o ") + # Add debug info options here as we can't specify separate debug info formats through the CMake abstraction + # and -g in MARMASM is technically Embedded mode (which we don't want for our C or C++ code) + add_compile_options($<$:-g>) else() enable_language(ASM_MASM) - set(CMAKE_ASM_MASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded "") - set(CMAKE_ASM_MASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL "") - set(CMAKE_ASM_MASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebug "") - set(CMAKE_ASM_MASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDebugDLL "") + # Add debug info options here as we can't specify separate debug info formats through the CMake abstraction + # and /Zi in MASM is technically Embedded mode (which we don't want for our C or C++ code) + add_compile_options($<$:/Zi>) endif() # Ensure that MC is present diff --git a/eng/native/configureplatform.cmake b/eng/native/configureplatform.cmake index 20851f8617423d..9d05487b17259c 100644 --- a/eng/native/configureplatform.cmake +++ b/eng/native/configureplatform.cmake @@ -71,17 +71,9 @@ if(CLR_CMAKE_HOST_OS STREQUAL linux) set(CLR_CMAKE_HOST_LINUX 1) # Detect Linux ID - set(LINUX_ID_FILE "/etc/os-release") - if(CMAKE_CROSSCOMPILING) - set(LINUX_ID_FILE "${CMAKE_SYSROOT}${LINUX_ID_FILE}") - endif() - - if(EXISTS ${LINUX_ID_FILE}) - execute_process( - COMMAND bash -c "source ${LINUX_ID_FILE} && echo \$ID" - OUTPUT_VARIABLE CLR_CMAKE_LINUX_ID - OUTPUT_STRIP_TRAILING_WHITESPACE) - endif() + # In cross-building scenarios, + # cmake_host_system_information looks in the sysroot for the /etc/os-release file. + cmake_host_system_information(RESULT CLR_CMAKE_LINUX_ID QUERY DISTRIB_ID) if(DEFINED CLR_CMAKE_LINUX_ID) if(CLR_CMAKE_LINUX_ID STREQUAL tizen) diff --git a/eng/native/functions.cmake b/eng/native/functions.cmake index 6629e926afacf6..50597674327159 100644 --- a/eng/native/functions.cmake +++ b/eng/native/functions.cmake @@ -221,7 +221,7 @@ function(preprocess_file inputFilename outputFilename) get_compile_definitions(PREPROCESS_DEFINITIONS) get_include_directories(PREPROCESS_INCLUDE_DIRECTORIES) get_source_file_property(SOURCE_FILE_DEFINITIONS ${inputFilename} COMPILE_DEFINITIONS) - + foreach(DEFINITION IN LISTS SOURCE_FILE_DEFINITIONS) list(APPEND PREPROCESS_DEFINITIONS -D${DEFINITION}) endforeach() @@ -276,42 +276,6 @@ function(set_exports_linker_option exports_filename) endif() endfunction() -# compile_asm(TARGET target ASM_FILES file1 [file2 ...] OUTPUT_OBJECTS [variableName]) -# CMake does not support the ARM or ARM64 assemblers on Windows when using the -# MSBuild generator. When the MSBuild generator is in use, we manually compile the assembly files -# using this function. -function(compile_asm) - set(options "") - set(oneValueArgs TARGET OUTPUT_OBJECTS) - set(multiValueArgs ASM_FILES) - cmake_parse_arguments(COMPILE_ASM "${options}" "${oneValueArgs}" "${multiValueArgs}" ${ARGV}) - - get_include_directories_asm(ASM_INCLUDE_DIRECTORIES) - - set (ASSEMBLED_OBJECTS "") - - foreach(ASM_FILE ${COMPILE_ASM_ASM_FILES}) - get_filename_component(name ${ASM_FILE} NAME_WE) - # Produce object file where CMake would store .obj files for an OBJECT library. - # ex: artifacts\obj\coreclr\windows.arm64.Debug\src\vm\wks\cee_wks.dir\Debug\AsmHelpers.obj - set (OBJ_FILE "${CMAKE_CURRENT_BINARY_DIR}/${COMPILE_ASM_TARGET}.dir/${CMAKE_CFG_INTDIR}/${name}.obj") - - # Need to compile asm file using custom command as include directories are not provided to asm compiler - add_custom_command(OUTPUT ${OBJ_FILE} - COMMAND "${CMAKE_ASM_COMPILER}" -g ${ASM_INCLUDE_DIRECTORIES} -o ${OBJ_FILE} ${ASM_FILE} - DEPENDS ${ASM_FILE} - COMMENT "Assembling ${ASM_FILE} ---> \"${CMAKE_ASM_COMPILER}\" -g ${ASM_INCLUDE_DIRECTORIES} -o ${OBJ_FILE} ${ASM_FILE}") - - # mark obj as source that does not require compile - set_source_files_properties(${OBJ_FILE} PROPERTIES EXTERNAL_OBJECT TRUE) - - # Add the generated OBJ in the dependency list so that it gets consumed during linkage - list(APPEND ASSEMBLED_OBJECTS ${OBJ_FILE}) - endforeach() - - 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) diff --git a/src/coreclr/CMakeLists.txt b/src/coreclr/CMakeLists.txt index 7ed0d509212cc4..f9c1ed295129ba 100644 --- a/src/coreclr/CMakeLists.txt +++ b/src/coreclr/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.20) +cmake_minimum_required(VERSION 3.26) # Set the project name project(CoreCLR) diff --git a/src/coreclr/debug/di/CMakeLists.txt b/src/coreclr/debug/di/CMakeLists.txt index b5f6872b8f690a..38607dcddd9fb9 100644 --- a/src/coreclr/debug/di/CMakeLists.txt +++ b/src/coreclr/debug/di/CMakeLists.txt @@ -60,9 +60,6 @@ if(CLR_CMAKE_HOST_WIN32) if ((CLR_CMAKE_TARGET_ARCH_ARM OR CLR_CMAKE_TARGET_ARCH_ARM64) AND NOT DEFINED CLR_CROSS_COMPONENTS_BUILD) convert_to_absolute_path(CORDBDI_SOURCES_ASM_FILE ${CORDBDI_SOURCES_ASM_FILE}) preprocess_files(CORDBDI_SOURCES_ASM_FILE ${CORDBDI_SOURCES_ASM_FILE}) - if (CMAKE_GENERATOR MATCHES "Visual Studio") - compile_asm(TARGET cordbdi ASM_FILES ${CORDBDI_SOURCES_ASM_FILE} OUTPUT_OBJECTS CORDBDI_SOURCES_ASM_FILE) - endif() endif() elseif(CLR_CMAKE_HOST_UNIX) diff --git a/src/coreclr/debug/ee/wks/CMakeLists.txt b/src/coreclr/debug/ee/wks/CMakeLists.txt index 7702a397489769..73e6fc9955ee12 100644 --- a/src/coreclr/debug/ee/wks/CMakeLists.txt +++ b/src/coreclr/debug/ee/wks/CMakeLists.txt @@ -9,14 +9,10 @@ if (CLR_CMAKE_TARGET_WIN32) if(CLR_CMAKE_HOST_ARCH_ARM OR CLR_CMAKE_HOST_ARCH_ARM64 OR CLR_CMAKE_HOST_ARCH_LOONGARCH64) preprocess_files(ASM_FILE ${ASM_FILE}) - if (CMAKE_GENERATOR MATCHES "Visual Studio") - compile_asm(TARGET cordbee_wks ASM_FILES ${ASM_FILE} OUTPUT_OBJECTS ASM_OBJECTS) - endif() - add_library_clr(cordbee_wks OBJECT ${CORDBEE_SOURCES_WKS} ${ASM_FILE} ${ASM_OBJECTS}) else () - set(ASM_OPTIONS /c /Zi /W3 /errorReport:prompt) + set(ASM_OPTIONS /c /W3 /errorReport:prompt) if (CLR_CMAKE_HOST_ARCH_I386) list (APPEND ASM_OPTIONS /safeseh) diff --git a/src/coreclr/dlls/mscordac/CMakeLists.txt b/src/coreclr/dlls/mscordac/CMakeLists.txt index f031e3fc4b60f7..e5ac23a58040d2 100644 --- a/src/coreclr/dlls/mscordac/CMakeLists.txt +++ b/src/coreclr/dlls/mscordac/CMakeLists.txt @@ -20,10 +20,6 @@ if(CLR_CMAKE_HOST_WIN32) # Create target to add file dependency on mscordac.def add_custom_target(mscordaccore_def DEPENDS ${CURRENT_BINARY_DIR_FOR_CONFIG}/mscordac.def) - - # No library groups for Win32 - set(START_LIBRARY_GROUP) - set(END_LIBRARY_GROUP) else(CLR_CMAKE_HOST_WIN32) set(DEF_SOURCES ${CMAKE_CURRENT_SOURCE_DIR}/mscordac_unixexports.src) set(EXPORTS_FILE ${CMAKE_CURRENT_BINARY_DIR}/mscordac.exports) @@ -84,15 +80,6 @@ else(CLR_CMAKE_HOST_WIN32) # This option is necessary to ensure that the overloaded delete operator defined inside # of the utilcode will be used instead of the standard library delete operator. set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Xlinker -Bsymbolic") - - # The following linked options can be inserted into the linker libraries list to - # ensure proper resolving of circular references between a subset of the libraries. - set(START_LIBRARY_GROUP -Wl,--start-group) - set(END_LIBRARY_GROUP -Wl,--end-group) - - # These options are used to force every object to be included even if it's unused. - set(START_WHOLE_ARCHIVE -Wl,--whole-archive) - set(END_WHOLE_ARCHIVE -Wl,--no-whole-archive) endif(CLR_CMAKE_HOST_LINUX OR CLR_CMAKE_HOST_FREEBSD OR CLR_CMAKE_HOST_NETBSD OR CLR_CMAKE_HOST_SUNOS OR CLR_CMAKE_HOST_HAIKU) set_exports_linker_option(${EXPORTS_FILE}) @@ -120,20 +107,10 @@ endif(CLR_CMAKE_HOST_UNIX) # order dependent and changing the order can result in undefined symbols in the shared # library. set(COREDAC_LIBRARIES - ${START_LIBRARY_GROUP} # Start group of libraries that have circular references - cee_dac - cordbee_dac - ${START_WHOLE_ARCHIVE} # force all exports to be available corguids - daccess - ${END_WHOLE_ARCHIVE} - dbgutil - mdcompiler_dac - mdruntime_dac - mdruntimerw_dac - utilcode_dac - unwinder_dac - ${END_LIBRARY_GROUP} # End group of libraries that have circular references + # These libraries have circular dependencies and must be grouped together + # The libraries in the WHOLE_ARCHIVE group must have all of their symbols included in the final shared object + $,dbgutil,mdcompiler_dac,mdruntime_dac,mdruntimerw_dac,utilcode_dac,unwinder_dac> ) if(CLR_CMAKE_HOST_WIN32) @@ -173,11 +150,8 @@ if(CLR_CMAKE_HOST_WIN32) else(CLR_CMAKE_HOST_WIN32) list(APPEND COREDAC_LIBRARIES mscorrc - ${START_WHOLE_ARCHIVE} # force all PAL objects to be included so all exports are available - coreclrpal - palrt - coreclrminipal - ${END_WHOLE_ARCHIVE} + # force all PAL objects to be included so all exports are available + $ ) endif(CLR_CMAKE_HOST_WIN32) diff --git a/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt b/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt index 7ba58d0297f9a9..0f31f5b178058a 100644 --- a/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt +++ b/src/coreclr/dlls/mscoree/coreclr/CMakeLists.txt @@ -39,23 +39,8 @@ else(CLR_CMAKE_HOST_WIN32) # This option is necessary to ensure that the overloaded delete operator defined inside # of the utilcode will be used instead of the standard library delete operator. add_linker_flag("-Wl,-Bsymbolic") - - # The following linked options can be inserted into the linker libraries list to - # ensure proper resolving of circular references between a subset of the libraries. - set(START_LIBRARY_GROUP -Wl,--start-group) - set(END_LIBRARY_GROUP -Wl,--end-group) - - # These options are used to force every object to be included even if it's unused. - set(START_WHOLE_ARCHIVE -Wl,--whole-archive) - set(END_WHOLE_ARCHIVE -Wl,--no-whole-archive) endif(CLR_CMAKE_TARGET_LINUX OR CLR_CMAKE_TARGET_FREEBSD OR CLR_CMAKE_TARGET_NETBSD OR CLR_CMAKE_TARGET_SUNOS OR CLR_CMAKE_HOST_HAIKU) - if(CLR_CMAKE_TARGET_OSX) - # These options are used to force every object to be included even if it's unused. - set(START_WHOLE_ARCHIVE -force_load) - set(END_WHOLE_ARCHIVE ) - endif(CLR_CMAKE_TARGET_OSX) - set_exports_linker_option(${EXPORTS_FILE}) if(CLR_CMAKE_TARGET_ANDROID AND CLR_CMAKE_HOST_ARCH_ARM) @@ -89,12 +74,10 @@ endif (CLR_CMAKE_HOST_UNIX) # library. set(CORECLR_LIBRARIES utilcode - ${START_LIBRARY_GROUP} # Start group of libraries that have circular references cordbee_wks debug-pal ${LIB_UNWINDER} v3binder - ${END_LIBRARY_GROUP} # End group of libraries that have circular references mdcompiler_wks mdruntime_wks mdruntimerw_wks @@ -136,9 +119,7 @@ if(CLR_CMAKE_TARGET_WIN32) ) else() list(APPEND CORECLR_LIBRARIES - ${START_WHOLE_ARCHIVE} # force all PAL objects to be included so all exports are available - coreclrpal - ${END_WHOLE_ARCHIVE} + $ # force all PAL objects to be included so all exports are available mscorrc palrt ) @@ -146,9 +127,7 @@ endif(CLR_CMAKE_TARGET_WIN32) if(CLR_CMAKE_TARGET_LINUX) list(APPEND CORECLR_LIBRARIES - ${START_WHOLE_ARCHIVE} tracepointprovider - ${END_WHOLE_ARCHIVE} ) elseif(CLR_CMAKE_TARGET_SUNOS) list(APPEND CORECLR_LIBRARIES diff --git a/src/coreclr/ilasm/CMakeLists.txt b/src/coreclr/ilasm/CMakeLists.txt index cca2c6da1858e6..2fe21a4a94f109 100644 --- a/src/coreclr/ilasm/CMakeLists.txt +++ b/src/coreclr/ilasm/CMakeLists.txt @@ -58,11 +58,6 @@ if(CLR_CMAKE_HOST_LINUX OR CLR_CMAKE_HOST_FREEBSD OR CLR_CMAKE_HOST_NETBSD OR CL # This option is necessary to ensure that the overloaded delete operator defined inside # of the utilcode will be used instead of the standard library delete operator. set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Xlinker -Bsymbolic") - - # The following linked options can be inserted into the linker libraries list to - # ensure proper resolving of circular references between a subset of the libraries. - set(START_LIBRARY_GROUP -Wl,--start-group) - 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 OR CLR_CMAKE_HOST_HAIKU) add_executable_clr(ilasm @@ -73,12 +68,8 @@ add_executable_clr(ilasm set(ILASM_LINK_LIBRARIES utilcodestaticnohost mscorpe - ${START_LIBRARY_GROUP} # Start group of libraries that have circular references - mdcompiler_ppdb - mdruntime_ppdb - mdruntimerw_ppdb - mdstaticapi_ppdb - ${END_LIBRARY_GROUP} # End group of libraries that have circular references + # libraries that have circular references + $ ceefgen corguids ) diff --git a/src/coreclr/ildasm/exe/CMakeLists.txt b/src/coreclr/ildasm/exe/CMakeLists.txt index fd5daaaa1525b1..211895ca04ef98 100644 --- a/src/coreclr/ildasm/exe/CMakeLists.txt +++ b/src/coreclr/ildasm/exe/CMakeLists.txt @@ -51,11 +51,6 @@ if(CLR_CMAKE_HOST_LINUX OR CLR_CMAKE_HOST_FREEBSD OR CLR_CMAKE_HOST_NETBSD OR CL # This option is necessary to ensure that the overloaded delete operator defined inside # of the utilcode will be used instead of the standard library delete operator. set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} -Xlinker -Bsymbolic") - - # The following linked options can be inserted into the linker libraries list to - # ensure proper resolving of circular references between a subset of the libraries. - set(START_LIBRARY_GROUP -Wl,--start-group) - 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 OR CLR_CMAKE_HOST_HAIKU) add_executable_clr(ildasm @@ -64,13 +59,11 @@ add_executable_clr(ildasm ) set(ILDASM_LINK_LIBRARIES - ${START_LIBRARY_GROUP} # Start group of libraries that have circular references - utilcodestaticnohost mdcompiler_wks mdruntime_wks mdruntimerw_wks - mdstaticapi - ${END_LIBRARY_GROUP} # End group of libraries that have circular references + # These libraries that have circular references + $ corguids ) diff --git a/src/coreclr/nativeaot/Runtime/Full/CMakeLists.txt b/src/coreclr/nativeaot/Runtime/Full/CMakeLists.txt index f9b390e18d117a..778d062bd5a75b 100644 --- a/src/coreclr/nativeaot/Runtime/Full/CMakeLists.txt +++ b/src/coreclr/nativeaot/Runtime/Full/CMakeLists.txt @@ -19,17 +19,13 @@ if (CLR_CMAKE_TARGET_WIN32) # Needed to include AsmOffsets.inc include_directories(BEFORE ${CMAKE_CURRENT_BINARY_DIR}) preprocess_files(RUNTIME_SOURCES_ARCH_ASM ${RUNTIME_SOURCES_ARCH_ASM}) - if (CMAKE_GENERATOR MATCHES "Visual Studio") - # Replaces .asm files in RUNTIME_SOURCES_ARCH_ASM with the corresponding .obj files - compile_asm(TARGET Runtime.WorkstationGC ASM_FILES ${RUNTIME_SOURCES_ARCH_ASM} OUTPUT_OBJECTS RUNTIME_ARCH_ASM_OBJECTS) - endif() endif() endif (CLR_CMAKE_TARGET_WIN32) -add_library(Runtime.WorkstationGC STATIC ${COMMON_RUNTIME_SOURCES} ${FULL_RUNTIME_SOURCES} ${RUNTIME_SOURCES_ARCH_ASM} ${RUNTIME_ARCH_ASM_OBJECTS}) +add_library(Runtime.WorkstationGC STATIC ${COMMON_RUNTIME_SOURCES} ${FULL_RUNTIME_SOURCES} ${RUNTIME_ARCH_ASM_OBJECTS}) add_dependencies(Runtime.WorkstationGC aot_eventing_headers) -add_library(Runtime.ServerGC STATIC ${COMMON_RUNTIME_SOURCES} ${FULL_RUNTIME_SOURCES} ${RUNTIME_SOURCES_ARCH_ASM} ${SERVER_GC_SOURCES} ${RUNTIME_ARCH_ASM_OBJECTS}) +add_library(Runtime.ServerGC STATIC ${COMMON_RUNTIME_SOURCES} ${FULL_RUNTIME_SOURCES} ${SERVER_GC_SOURCES} ${RUNTIME_ARCH_ASM_OBJECTS}) add_dependencies(Runtime.ServerGC aot_eventing_headers) add_library(standalonegc-disabled STATIC ${STANDALONEGC_DISABLED_SOURCES}) @@ -57,7 +53,7 @@ if (CLR_CMAKE_TARGET_WIN32) set_target_properties(standalonegc-enabled.GuardCF PROPERTIES CLR_CONTROL_FLOW_GUARD ON) add_dependencies(standalonegc-enabled.GuardCF aot_eventing_headers) add_dependencies(standalonegc-enabled.GuardCF aot_etw_headers) - add_library(Runtime.ServerGC.GuardCF STATIC ${COMMON_RUNTIME_SOURCES} ${FULL_RUNTIME_SOURCES} ${RUNTIME_SOURCES_ARCH_ASM} ${SERVER_GC_SOURCES} ${RUNTIME_ARCH_ASM_OBJECTS}) + add_library(Runtime.ServerGC.GuardCF STATIC ${COMMON_RUNTIME_SOURCES} ${FULL_RUNTIME_SOURCES} ${SERVER_GC_SOURCES} ${RUNTIME_ARCH_ASM_OBJECTS}) target_compile_definitions(Runtime.ServerGC.GuardCF PRIVATE -DFEATURE_SVR_GC) set_target_properties(Runtime.ServerGC.GuardCF PROPERTIES CLR_CONTROL_FLOW_GUARD ON) @@ -101,14 +97,17 @@ set_source_files_properties("${CMAKE_CURRENT_BINARY_DIR}/AsmOffsets.inc" PROPERT # Runtime.WorkstationGC and Runtime.ServerGC share AsmOffsets.inc and assembler helpers (for Windows ARM/ARM64). # Avoid a race condition by adding this target as a dependency for both libraries. add_custom_target( - RuntimeAsmHelpers - DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/AsmOffsets.inc" "${RUNTIME_ARCH_ASM_OBJECTS}" + RuntimeAsmOffsets + DEPENDS "${CMAKE_CURRENT_BINARY_DIR}/AsmOffsets.inc" ) -add_dependencies(Runtime.WorkstationGC RuntimeAsmHelpers) -add_dependencies(Runtime.ServerGC RuntimeAsmHelpers) +add_library(Runtime.AsmHelpers OBJECT ${RUNTIME_SOURCES_ARCH_ASM}) +add_dependencies(Runtime.AsmHelpers RuntimeAsmOffsets) + +target_link_libraries(Runtime.WorkstationGC PRIVATE Runtime.AsmHelpers) +target_link_libraries(Runtime.ServerGC PRIVATE Runtime.AsmHelpers) if (CLR_CMAKE_TARGET_WIN32) - add_dependencies(Runtime.ServerGC.GuardCF RuntimeAsmHelpers) +target_link_libraries(Runtime.ServerGC.GuardCF PRIVATE Runtime.AsmHelpers) endif (CLR_CMAKE_TARGET_WIN32) install_static_library(Runtime.WorkstationGC aotsdk nativeaot) @@ -127,4 +126,4 @@ if (CLR_CMAKE_TARGET_ARCH_AMD64) if (CLR_CMAKE_TARGET_WIN32) install_static_library(Runtime.VxsortEnabled.GuardCF aotsdk nativeaot) endif (CLR_CMAKE_TARGET_WIN32) -endif (CLR_CMAKE_TARGET_ARCH_AMD64) \ No newline at end of file +endif (CLR_CMAKE_TARGET_ARCH_AMD64) diff --git a/src/coreclr/vm/wks/CMakeLists.txt b/src/coreclr/vm/wks/CMakeLists.txt index e519458d736e2e..acc1479d1130e7 100644 --- a/src/coreclr/vm/wks/CMakeLists.txt +++ b/src/coreclr/vm/wks/CMakeLists.txt @@ -1,9 +1,6 @@ if (CLR_CMAKE_TARGET_WIN32) if(CLR_CMAKE_HOST_ARCH_ARM OR CLR_CMAKE_HOST_ARCH_ARM64) preprocess_files(VM_SOURCES_WKS_ARCH_ASM ${VM_SOURCES_WKS_ARCH_ASM}) - if (CMAKE_GENERATOR MATCHES "Visual Studio") - compile_asm(TARGET cee_wks_core ASM_FILES ${VM_SOURCES_WKS_ARCH_ASM} OUTPUT_OBJECTS VM_WKS_ARCH_ASM_OBJECTS) - endif() endif() endif (CLR_CMAKE_TARGET_WIN32) diff --git a/src/libraries/tests.proj b/src/libraries/tests.proj index b6b47e74094938..0531b193fabe76 100644 --- a/src/libraries/tests.proj +++ b/src/libraries/tests.proj @@ -796,12 +796,12 @@ - + - + diff --git a/src/mono/CMakeLists.txt b/src/mono/CMakeLists.txt index ba41fa4d9a489f..8891ce3cd3a020 100644 --- a/src/mono/CMakeLists.txt +++ b/src/mono/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.20) +cmake_minimum_required(VERSION 3.26) project(mono) @@ -284,13 +284,13 @@ elseif(CLR_CMAKE_HOST_OS STREQUAL "windows") add_compile_options($<$:/Oi>) # enable intrinsics add_compile_options($<$:/GF>) # enable string pooling add_compile_options($<$:/GL>) # whole program optimization - add_compile_options($<$:/Zi>) # enable debugging information + set(CMAKE_MSVC_DEBUG_INFORMATION_FORMAT ProgramDatabase) # enable debugging information add_link_options(/LTCG) # link-time code generation add_link_options(/DEBUG) # enable debugging information add_link_options(/DEBUGTYPE:CV,FIXUP) # enable fixup debug information add_link_options(/OPT:REF) # optimize: remove unreferenced functions & data add_link_options(/OPT:ICF) # optimize: enable COMDAT folding - # the combination of /Zi compiler flag and /DEBUG /OPT:REF /OPT:ICF + # the combination of ProgramDatabase debug info format and /DEBUG /OPT:REF /OPT:ICF # linker flags is needed to create .pdb output on release builds endif() elseif(CLR_CMAKE_HOST_OS STREQUAL "sunos") diff --git a/src/mono/browser/runtime/CMakeLists.txt b/src/mono/browser/runtime/CMakeLists.txt index 8b7939330f8c3a..3f45b51f773670 100644 --- a/src/mono/browser/runtime/CMakeLists.txt +++ b/src/mono/browser/runtime/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.20) +cmake_minimum_required(VERSION 3.26) project(mono-wasm-runtime C) diff --git a/src/mono/dlls/mscordbi/CMakeLists.txt b/src/mono/dlls/mscordbi/CMakeLists.txt index e39aeac5ac6d25..5e601bb8e38fc2 100644 --- a/src/mono/dlls/mscordbi/CMakeLists.txt +++ b/src/mono/dlls/mscordbi/CMakeLists.txt @@ -137,8 +137,6 @@ add_library(mscordbi SHARED "${mscorbi_sources};${PROJECT_SOURCE_DIR}/../../mono set_source_files_properties(${PROJECT_SOURCE_DIR}/../../mono/component/debugger-protocol.c PROPERTIES LANGUAGE CXX) -set(START_WHOLE_ARCHIVE -Wl,--whole-archive) -set(END_WHOLE_ARCHIVE -Wl,--no-whole-archive) # IMPORTANT! Please do not rearrange the order of the libraries. The linker on Linux is # order dependent and changing the order can result in undefined symbols in the shared # library. @@ -152,10 +150,7 @@ set(COREDBI_LIBRARIES ) if(CLR_CMAKE_HOST_UNIX) list(APPEND COREDBI_LIBRARIES - ${START_WHOLE_ARCHIVE} - palrt - coreclrpal - ${END_WHOLE_ARCHIVE} + $ nativeresourcestring ) endif() diff --git a/src/mono/mono/utils/CMakeLists.txt b/src/mono/mono/utils/CMakeLists.txt index e5bd089b8203c7..a50300ba4e57b8 100644 --- a/src/mono/mono/utils/CMakeLists.txt +++ b/src/mono/mono/utils/CMakeLists.txt @@ -9,7 +9,7 @@ set(utils_win32_sources if(HOST_WIN32 AND HOST_AMD64) enable_language(ASM_MASM) - add_compile_options($<$:/Zi>) # enable debugging information + add_compile_options($<$:/Zi>) # enable debugging information for ASM files add_compile_options($<$:/nologo>) # Don't display the output header when building asm files set(CMAKE_ASM_MASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreaded "") set(CMAKE_ASM_MASM_COMPILE_OPTIONS_MSVC_RUNTIME_LIBRARY_MultiThreadedDLL "") diff --git a/src/mono/wasi/runtime/CMakeLists.txt b/src/mono/wasi/runtime/CMakeLists.txt index 1d2a220494779a..837e537df2ee0c 100644 --- a/src/mono/wasi/runtime/CMakeLists.txt +++ b/src/mono/wasi/runtime/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.20) +cmake_minimum_required(VERSION 3.26) project(mono-wasi-runtime C) diff --git a/src/native/corehost/CMakeLists.txt b/src/native/corehost/CMakeLists.txt index a7b2c82de668db..01d15f0eecef14 100644 --- a/src/native/corehost/CMakeLists.txt +++ b/src/native/corehost/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.20) +cmake_minimum_required(VERSION 3.26) project(corehost) include(../../../eng/native/configurepaths.cmake) diff --git a/src/native/corehost/apphost/static/CMakeLists.txt b/src/native/corehost/apphost/static/CMakeLists.txt index e431b87e33d0c6..cd845dc1738467 100644 --- a/src/native/corehost/apphost/static/CMakeLists.txt +++ b/src/native/corehost/apphost/static/CMakeLists.txt @@ -143,9 +143,6 @@ if(CLR_CMAKE_TARGET_WIN32) RuntimeObject.lib delayimp.lib ) - - set(RUNTIMEINFO_LIB runtimeinfo) - else() if(CLR_CMAKE_HOST_OSX OR (CLR_CMAKE_HOST_LINUX AND NOT CLR_CMAKE_HOST_UNIX_X86 AND NOT CLR_CMAKE_HOST_ANDROID)) LIST(APPEND NATIVE_LIBS createdump_static) @@ -187,9 +184,6 @@ else() include(${CLR_SRC_NATIVE_DIR}/libs/System.Security.Cryptography.Native/extra_libs.cmake) append_extra_cryptography_libs(NATIVE_LIBS) endif() - - set(RUNTIMEINFO_LIB runtimeinfo) - endif() if(CLR_CMAKE_TARGET_APPLE) @@ -246,22 +240,10 @@ if(CLR_CMAKE_USE_SYSTEM_LIBUNWIND AND NOT CLR_CMAKE_TARGET_APPLE) ) endif() -if(CLR_CMAKE_TARGET_LINUX OR CLR_CMAKE_TARGET_FREEBSD OR CLR_CMAKE_TARGET_NETBSD OR CLR_CMAKE_TARGET_SUNOS) - # These options are used to force every object to be included even if it's unused. - set(START_WHOLE_ARCHIVE -Wl,--whole-archive) - set(END_WHOLE_ARCHIVE -Wl,--no-whole-archive) -endif(CLR_CMAKE_TARGET_LINUX OR CLR_CMAKE_TARGET_FREEBSD OR CLR_CMAKE_TARGET_NETBSD OR CLR_CMAKE_TARGET_SUNOS) - if(CLR_CMAKE_TARGET_LINUX AND CLR_CMAKE_TARGET_ARCH_RISCV64) add_linker_flag(-Wl,-z,notext) endif() -if(CLR_CMAKE_TARGET_APPLE) - # These options are used to force every object to be included even if it's unused. - set(START_WHOLE_ARCHIVE -force_load) - set(END_WHOLE_ARCHIVE ) -endif(CLR_CMAKE_TARGET_APPLE) - set_property(TARGET singlefilehost PROPERTY ENABLE_EXPORTS 1) target_link_libraries( @@ -269,9 +251,7 @@ target_link_libraries( PRIVATE ${NATIVE_LIBS} - ${START_WHOLE_ARCHIVE} - ${RUNTIMEINFO_LIB} - ${END_WHOLE_ARCHIVE} + $ ) target_link_libraries(singlefilehost PRIVATE hostmisc) diff --git a/src/native/corehost/ijwhost/CMakeLists.txt b/src/native/corehost/ijwhost/CMakeLists.txt index 5e5218e578f3f1..369df60d255845 100644 --- a/src/native/corehost/ijwhost/CMakeLists.txt +++ b/src/native/corehost/ijwhost/CMakeLists.txt @@ -27,9 +27,6 @@ add_compile_definitions(FEATURE_LIBHOST) if (CLR_CMAKE_TARGET_WIN32 AND CLR_CMAKE_TARGET_ARCH_ARM64) preprocess_files(ASM_HELPERS_SOURCES ${ASM_HELPERS_SOURCES}) - if (CMAKE_GENERATOR MATCHES "Visual Studio") - compile_asm(TARGET ijwhost ASM_FILES ${ASM_HELPERS_SOURCES} OUTPUT_OBJECTS ASM_HELPERS_SOURCES) - endif() endif () if (CLR_CMAKE_TARGET_WIN32 AND CLR_CMAKE_TARGET_ARCH_I386) diff --git a/src/native/libs/CMakeLists.txt b/src/native/libs/CMakeLists.txt index f22c93336d742b..84e40da499425e 100644 --- a/src/native/libs/CMakeLists.txt +++ b/src/native/libs/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.20) +cmake_minimum_required(VERSION 3.26) include(CheckCCompilerFlag) diff --git a/src/native/libs/System.Globalization.Native/CMakeLists.txt b/src/native/libs/System.Globalization.Native/CMakeLists.txt index 07080ea9056bb5..d231ef7e4af4e3 100644 --- a/src/native/libs/System.Globalization.Native/CMakeLists.txt +++ b/src/native/libs/System.Globalization.Native/CMakeLists.txt @@ -1,5 +1,5 @@ # Required for StaticICULinking -cmake_minimum_required(VERSION 3.10..3.20) +cmake_minimum_required(VERSION 3.10..3.26) project(System.Globalization.Native C) @@ -127,7 +127,7 @@ if (CLR_CMAKE_TARGET_APPLE) endif() # time zone names are filtered out of icu data for the browser and associated functionality is disabled -if (NOT CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CMAKE_TARGET_WASI AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS) +if (NOT CLR_CMAKE_TARGET_BROWSER AND NOT CLR_CMAKE_TARGET_WASI AND NOT CLR_CMAKE_TARGET_MACCATALYST AND NOT CLR_CMAKE_TARGET_IOS AND NOT CLR_CMAKE_TARGET_TVOS) set(NATIVEGLOBALIZATION_SOURCES ${NATIVEGLOBALIZATION_SOURCES} pal_timeZoneInfo.c) endif() diff --git a/src/native/libs/System.Security.Cryptography.Native/CMakeLists.txt b/src/native/libs/System.Security.Cryptography.Native/CMakeLists.txt index c2808d3fd7646d..edc97aa6976b9e 100644 --- a/src/native/libs/System.Security.Cryptography.Native/CMakeLists.txt +++ b/src/native/libs/System.Security.Cryptography.Native/CMakeLists.txt @@ -1,5 +1,5 @@ # Required for StaticOpenSslLinking -cmake_minimum_required(VERSION 3.10..3.20) +cmake_minimum_required(VERSION 3.10..3.26) project(System.Security.Cryptography.Native C) diff --git a/src/tests/CMakeLists.txt b/src/tests/CMakeLists.txt index 6c7d4cb9fd512d..b1b14cb9ce08ce 100644 --- a/src/tests/CMakeLists.txt +++ b/src/tests/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.20) +cmake_minimum_required(VERSION 3.26) project(Tests) diff --git a/src/tests/Interop/MonoAPI/Native/mono-embedding-api-test/CMakeLists.txt b/src/tests/Interop/MonoAPI/Native/mono-embedding-api-test/CMakeLists.txt index 8c7b718beae86f..769dd43016be97 100644 --- a/src/tests/Interop/MonoAPI/Native/mono-embedding-api-test/CMakeLists.txt +++ b/src/tests/Interop/MonoAPI/Native/mono-embedding-api-test/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 3.20) project (MonoEmbeddingApiTest) include_directories(${INC_PLATFORM_DIR}) diff --git a/src/tests/Interop/ObjectiveC/AutoReleaseTest/CMakeLists.txt b/src/tests/Interop/ObjectiveC/AutoReleaseTest/CMakeLists.txt index 2e5e11993ef623..8cb6102445895d 100644 --- a/src/tests/Interop/ObjectiveC/AutoReleaseTest/CMakeLists.txt +++ b/src/tests/Interop/ObjectiveC/AutoReleaseTest/CMakeLists.txt @@ -1,5 +1,6 @@ -cmake_minimum_required(VERSION 3.20) include ("${CLR_INTEROP_TEST_ROOT}/Interop.cmake") +enable_language(OBJCXX) + set(CMAKE_OBJC_STANDARD 99) set(CMAKE_OBJC_STANDARD_REQUIRED TRUE) diff --git a/src/tests/Interop/ObjectiveC/ObjectiveCMarshalAPI/CMakeLists.txt b/src/tests/Interop/ObjectiveC/ObjectiveCMarshalAPI/CMakeLists.txt index bed745f3c1621c..c95a7df471db87 100644 --- a/src/tests/Interop/ObjectiveC/ObjectiveCMarshalAPI/CMakeLists.txt +++ b/src/tests/Interop/ObjectiveC/ObjectiveCMarshalAPI/CMakeLists.txt @@ -1,4 +1,3 @@ -cmake_minimum_required(VERSION 3.20) set(CMAKE_OBJC_STANDARD 11) set(CMAKE_OBJC_STANDARD_REQUIRED TRUE) diff --git a/src/tests/profiler/native/CMakeLists.txt b/src/tests/profiler/native/CMakeLists.txt index 0e5765fc0c114a..54910c242980da 100644 --- a/src/tests/profiler/native/CMakeLists.txt +++ b/src/tests/profiler/native/CMakeLists.txt @@ -1,4 +1,4 @@ -cmake_minimum_required(VERSION 3.20) +cmake_minimum_required(VERSION 3.26) project(Profiler)