Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.

Clean up our CMake scripts using features introduced between 3.0 and 3.14 #26980

Merged
merged 37 commits into from
Oct 7, 2019

Conversation

jkoritzinsky
Copy link
Member

@jkoritzinsky jkoritzinsky commented Oct 2, 2019

Now that we're using a consistent modern version of CMake on all platforms, we can significantly clean up our native build scripts.

There's a few things I decided to go fix:

  • Remove the CLR_CMAKE_COMPILER variable and use generator expressions instead.
  • Remove the directory-based dac.cmake, crossgen.cmake, md_dac.cmake, md_wks.cmake, and md_dbi.cmake files and drive their inclusion/exclusion of various defines via custom target properties and generator expressions.
  • Collapse any leaf CMakeLists.txt files that were only leaf nodes because of the above directory-based component definition system.
  • Convert PCH generation to be target-specific instead of directory-specific.
  • Convert linker options to be added via add_link_options when possible.
  • Refactor manual asm preprocessing and compilation (for Windows ARM and ARM64) to a single utility function.
  • Refactor manual preprocessing to a single xplat function.
  • Use more of CMake's built-in features for setting up our cross-compilation toolchain.

Fixes CMake's incremental build, but makes MSBuild complain about it's incremental build possibly not working.
…y files into a cmake function preprocess_compile_asm.
…ation (where most of the work was done in the parent).
…s for multiple-valued generator expressions.
@jkoritzinsky jkoritzinsky added this to the 5.0 milestone Oct 2, 2019
@jkoritzinsky jkoritzinsky marked this pull request as ready for review October 4, 2019 00:03
clrdefinitions.cmake Show resolved Hide resolved
clrdefinitions.cmake Show resolved Hide resolved
configurecompiler.cmake Outdated Show resolved Hide resolved
configurecompiler.cmake Outdated Show resolved Hide resolved
configurecompiler.cmake Outdated Show resolved Hide resolved
@@ -35,15 +35,6 @@ if(DEFINED ENV{TOOLCHAIN})
set(TOOLCHAIN $ENV{TOOLCHAIN})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I am surprised we still use (and have) this file instead of using the shared eng/common/cross/toolchain.cmake. It would be great to start using the shared one (and update it - it is out of date w.r.t. the cross/toolchain.cmake)

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't update the version in eng/common/cross until we update all repos that would use it to run on images with CMake 3.14+. I'd prefer to update our cross/toolchain.cmake file, then update the images used by the various other repos with native toolsets. Then I'd update the version in eng/common. Once that propagates through, I'd remove the local one.

cross/toolchain.cmake Show resolved Hide resolved
cross/toolchain.cmake Show resolved Hide resolved
functions.cmake Outdated Show resolved Hide resolved
src/vm/wks/CMakeLists.txt Show resolved Hide resolved
@jkoritzinsky
Copy link
Member Author

@janvorli can you take another review pass when you have a chance?

Copy link
Member

@janvorli janvorli left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, thank you!

@jkoritzinsky jkoritzinsky merged commit 59c7b7e into dotnet:master Oct 7, 2019
@jkoritzinsky jkoritzinsky deleted the cmake-3.14-cleanup branch October 7, 2019 19:11
sdmaclea added a commit to sdmaclea/coreclr that referenced this pull request Apr 14, 2020
 + Auto renames for (dotnet/coreclr/dotnet#26080)
 + Rename _WIN64 define to BIT64 (dotnet#26080)
 + Remove stray sos reference (dotnet/runtime/dotnet#1875)
 + Fix MSVC warn as errors... (dotnet/runtime/dotnet#1876)
 + Remove unused/unnecessary defines (dotnet/runtime/dotnet#1878)
 + Rename CLR_CMAKE_PLATFORM* CLR_CMAKE_HOST* (dotnet/runtime/#1974)
 + Rename PAL_CMAKE_* CLR_CMAKE_* (dotnet/runtime/dotnet#1984)
 + Add alpinedac & linuxdac build options (dotnet/runtime/dotnet#2056)
 + Refactor CMake system to allow cross OS DAC compile (dotnet/runtime/#2054)
 + Add FEATURE_REMOTE_PROC_MEM (dotnet/runtime/dotnet#2244)
 + Fix compilation of dbgtransportsession (dotnet/runtime/dotnet#2247)
 + Auto renames from (dotnet/runtime/#2256)
 + Rename cross compilation related defines (dotnet/runtime/#2256)
 + Fix logic to disable mscordbi build (dotnet/runtime/#31745)
 + Fix unused variable warning (dotnet/runtime/#31747)
 + Remove GetRecycleMemoryInfo from DAC builds (dotnet/runtime/#31748)
 + Fix check.* cross compilation linker errors (dotnet/runtime/#31751)
 + Reduce PAL DAC exports (dotnet/runtime/#31749)
 + Add EMPTY_BASES_DECL (dotnet/runtime/dotnet#26980)
 + Disable linux unwinder on Windows (dotnet/runtime/#31777)
 + Add cross OS support for MAKEDLLNAME (dotnet/runtime/#31746)
 + Fix host compiler when cross OS DAC compiling (dotnet/runtime/#31775)
 + Fix arm64singlestepper #ifdef (dotnet/runtime/#31776)
 + Configure host features based on host OS (dotnet/runtime/#31778)
 + Configure Host OS APIs based on HOST macros (dotnet/runtime/#31774)
 + Use common CLR_CMAKE_* variables in more places (dotnet/runtime/#31659)
 + Add T_CRITICAL_SECTION for cross OS DAC compile (dotnet/runtime/#31908)
 + Fix arm cross OS DAC compilation (dotnet/runtime/#31903)
 + Add CrossOS DAC build back (dotnet/runtime/#33064)
 + Fix typo (dotnet/runtime/#33192)
 + Fix type layout whan Cross OS compiling (dotnet/runtime/#33487)
 + Partial revert auto renames from (dotnet/runtime/dotnet#2056)
 + Partial revert (dotnet/runtime/dotnet#26080)
sdmaclea added a commit to sdmaclea/coreclr that referenced this pull request Jun 25, 2020
 + Auto renames for (dotnet/coreclr/dotnet#26080)
 + Rename _WIN64 define to BIT64 (dotnet#26080)
 + Remove stray sos reference (dotnet/runtime/dotnet#1875)
 + Fix MSVC warn as errors... (dotnet/runtime/dotnet#1876)
 + Remove unused/unnecessary defines (dotnet/runtime/dotnet#1878)
 + Rename CLR_CMAKE_PLATFORM* CLR_CMAKE_HOST* (dotnet/runtime/#1974)
 + Rename PAL_CMAKE_* CLR_CMAKE_* (dotnet/runtime/dotnet#1984)
 + Add alpinedac & linuxdac build options (dotnet/runtime/dotnet#2056)
 + Refactor CMake system to allow cross OS DAC compile (dotnet/runtime/#2054)
 + Add FEATURE_REMOTE_PROC_MEM (dotnet/runtime/dotnet#2244)
 + Fix compilation of dbgtransportsession (dotnet/runtime/dotnet#2247)
 + Auto renames from (dotnet/runtime/#2256)
 + Rename cross compilation related defines (dotnet/runtime/#2256)
 + Fix logic to disable mscordbi build (dotnet/runtime/#31745)
 + Fix unused variable warning (dotnet/runtime/#31747)
 + Remove GetRecycleMemoryInfo from DAC builds (dotnet/runtime/#31748)
 + Fix check.* cross compilation linker errors (dotnet/runtime/#31751)
 + Reduce PAL DAC exports (dotnet/runtime/#31749)
 + Add EMPTY_BASES_DECL (dotnet/runtime/dotnet#26980)
 + Disable linux unwinder on Windows (dotnet/runtime/#31777)
 + Add cross OS support for MAKEDLLNAME (dotnet/runtime/#31746)
 + Fix host compiler when cross OS DAC compiling (dotnet/runtime/#31775)
 + Fix arm64singlestepper #ifdef (dotnet/runtime/#31776)
 + Configure host features based on host OS (dotnet/runtime/#31778)
 + Configure Host OS APIs based on HOST macros (dotnet/runtime/#31774)
 + Use common CLR_CMAKE_* variables in more places (dotnet/runtime/#31659)
 + Add T_CRITICAL_SECTION for cross OS DAC compile (dotnet/runtime/#31908)
 + Fix arm cross OS DAC compilation (dotnet/runtime/#31903)
 + Add CrossOS DAC build back (dotnet/runtime/#33064)
 + Fix typo (dotnet/runtime/#33192)
 + Fix type layout whan Cross OS compiling (dotnet/runtime/#33487)
 + Partial revert auto renames from (dotnet/runtime/dotnet#2056)
 + Partial revert (dotnet/runtime/dotnet#26080)
sdmaclea added a commit to sdmaclea/coreclr that referenced this pull request Jun 25, 2020
 + Auto renames for (dotnet/coreclr/dotnet#26080)
 + Rename _WIN64 define to BIT64 (dotnet#26080)
 + Remove stray sos reference (dotnet/runtime/dotnet#1875)
 + Fix MSVC warn as errors... (dotnet/runtime/dotnet#1876)
 + Remove unused/unnecessary defines (dotnet/runtime/dotnet#1878)
 + Rename CLR_CMAKE_PLATFORM* CLR_CMAKE_HOST* (dotnet/runtime/#1974)
 + Rename PAL_CMAKE_* CLR_CMAKE_* (dotnet/runtime/dotnet#1984)
 + Add alpinedac & linuxdac build options (dotnet/runtime/dotnet#2056)
 + Refactor CMake system to allow cross OS DAC compile (dotnet/runtime/#2054)
 + Add FEATURE_REMOTE_PROC_MEM (dotnet/runtime/dotnet#2244)
 + Fix compilation of dbgtransportsession (dotnet/runtime/dotnet#2247)
 + Auto renames from (dotnet/runtime/#2256)
 + Rename cross compilation related defines (dotnet/runtime/#2256)
 + Fix logic to disable mscordbi build (dotnet/runtime/#31745)
 + Fix unused variable warning (dotnet/runtime/#31747)
 + Remove GetRecycleMemoryInfo from DAC builds (dotnet/runtime/#31748)
 + Fix check.* cross compilation linker errors (dotnet/runtime/#31751)
 + Reduce PAL DAC exports (dotnet/runtime/#31749)
 + Add EMPTY_BASES_DECL (dotnet/runtime/dotnet#26980)
 + Disable linux unwinder on Windows (dotnet/runtime/#31777)
 + Add cross OS support for MAKEDLLNAME (dotnet/runtime/#31746)
 + Fix host compiler when cross OS DAC compiling (dotnet/runtime/#31775)
 + Fix arm64singlestepper #ifdef (dotnet/runtime/#31776)
 + Configure host features based on host OS (dotnet/runtime/#31778)
 + Configure Host OS APIs based on HOST macros (dotnet/runtime/#31774)
 + Use common CLR_CMAKE_* variables in more places (dotnet/runtime/#31659)
 + Add T_CRITICAL_SECTION for cross OS DAC compile (dotnet/runtime/#31908)
 + Fix arm cross OS DAC compilation (dotnet/runtime/#31903)
 + Add CrossOS DAC build back (dotnet/runtime/#33064)
 + Fix typo (dotnet/runtime/#33192)
 + Fix type layout whan Cross OS compiling (dotnet/runtime/#33487)
 + Partial revert auto renames from (dotnet/runtime/dotnet#2056)
 + Partial revert (dotnet/runtime/dotnet#26080)
 + Enable cross OS DBI build(dotnet/runtime/#35021)
sdmaclea added a commit to sdmaclea/coreclr that referenced this pull request Jul 1, 2020
 + Auto renames for (dotnet/coreclr/dotnet#26080)
 + Rename _WIN64 define to BIT64 (dotnet#26080)
 + Remove stray sos reference (dotnet/runtime/dotnet#1875)
 + Fix MSVC warn as errors... (dotnet/runtime/dotnet#1876)
 + Remove unused/unnecessary defines (dotnet/runtime/dotnet#1878)
 + Rename CLR_CMAKE_PLATFORM* CLR_CMAKE_HOST* (dotnet/runtime/#1974)
 + Rename PAL_CMAKE_* CLR_CMAKE_* (dotnet/runtime/dotnet#1984)
 + Add alpinedac & linuxdac build options (dotnet/runtime/dotnet#2056)
 + Refactor CMake system to allow cross OS DAC compile (dotnet/runtime/#2054)
 + Add FEATURE_REMOTE_PROC_MEM (dotnet/runtime/dotnet#2244)
 + Fix compilation of dbgtransportsession (dotnet/runtime/dotnet#2247)
 + Auto renames from (dotnet/runtime/#2256)
 + Rename cross compilation related defines (dotnet/runtime/#2256)
 + Fix logic to disable mscordbi build (dotnet/runtime/#31745)
 + Fix unused variable warning (dotnet/runtime/#31747)
 + Remove GetRecycleMemoryInfo from DAC builds (dotnet/runtime/#31748)
 + Fix check.* cross compilation linker errors (dotnet/runtime/#31751)
 + Reduce PAL DAC exports (dotnet/runtime/#31749)
 + Add EMPTY_BASES_DECL (dotnet/runtime/dotnet#26980)
 + Disable linux unwinder on Windows (dotnet/runtime/#31777)
 + Add cross OS support for MAKEDLLNAME (dotnet/runtime/#31746)
 + Fix host compiler when cross OS DAC compiling (dotnet/runtime/#31775)
 + Fix arm64singlestepper #ifdef (dotnet/runtime/#31776)
 + Configure host features based on host OS (dotnet/runtime/#31778)
 + Configure Host OS APIs based on HOST macros (dotnet/runtime/#31774)
 + Use common CLR_CMAKE_* variables in more places (dotnet/runtime/#31659)
 + Add T_CRITICAL_SECTION for cross OS DAC compile (dotnet/runtime/#31908)
 + Fix arm cross OS DAC compilation (dotnet/runtime/#31903)
 + Add CrossOS DAC build back (dotnet/runtime/#33064)
 + Fix typo (dotnet/runtime/#33192)
 + Fix type layout whan Cross OS compiling (dotnet/runtime/#33487)
 + Partial revert auto renames from (dotnet/runtime/dotnet#2056)
 + Partial revert (dotnet/runtime/dotnet#26080)
 + Enable cross OS DBI build(dotnet/runtime/#35021)
 + Disable EMPTY_BASE_DECL except for cross OS DAC
 + Fix DBI type layout issues
   + Add utilcode_dbi
   + Consistently define DBI features
   + Define T_CRITICAL_SECTION during non-DAC builds
 + Port cross DAC unwind support to 3.1
   + Libunwind 1.5rc2 again (dotnet/runtime#36988)
 + Add libunwind to cross DAC (dotnet/runtime#37521)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants