diff options
author | Rahul Kumar <rahku@microsoft.com> | 2016-04-18 15:58:44 -0700 |
---|---|---|
committer | Rahul Kumar <rahku@microsoft.com> | 2016-04-18 15:58:44 -0700 |
commit | 83e52facfec1ae6002ed9d0a474c300ab3dbe2fe (patch) | |
tree | 96a8ef8b67571ac2047c9a64d917d037be5dfdd7 /CMakeLists.txt | |
parent | edb01ddc5a8c6e000f5a0c2e756684c09103ebea (diff) | |
parent | a0a3ee9f46ad22fa9a2cbcfa1b0afb54d382cf1f (diff) | |
download | coreclr-83e52facfec1ae6002ed9d0a474c300ab3dbe2fe.tar.gz coreclr-83e52facfec1ae6002ed9d0a474c300ab3dbe2fe.tar.bz2 coreclr-83e52facfec1ae6002ed9d0a474c300ab3dbe2fe.zip |
Merge pull request #4394 from gkhanna79/VCRTArm64Fix
Fix Arm64 break
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r-- | CMakeLists.txt | 53 |
1 files changed, 28 insertions, 25 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index 295ee149fd..6ba61649a8 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -534,18 +534,9 @@ if (WIN32) add_compile_options($<$<OR:$<CONFIG:Release>,$<CONFIG:Relwithdebinfo>>:/GL>) add_compile_options($<$<OR:$<OR:$<CONFIG:Release>,$<CONFIG:Relwithdebinfo>>,$<CONFIG:Checked>>:/O1>) - # Statically linked CRT (libcmt[d].lib, libvcruntime[d].lib and libucrt[d].lib) by default. This is done to avoid - # linking in VCRUNTIME140.DLL for a simplified xcopy experience by reducing the dependency on VC REDIST. - # - # For Release builds, we shall dynamically link into uCRT [ucrtbase.dll] (which is pushed down as a Windows Update on downlevel OS) but - # wont do the same for debug/checked builds since ucrtbased.dll is not redistributable and Debug/Checked builds are not - # production-time scenarios. - add_compile_options($<$<OR:$<CONFIG:Release>,$<CONFIG:Relwithdebinfo>>:/MT>) - add_compile_options($<$<OR:$<CONFIG:Debug>,$<CONFIG:Checked>>:/MTd>) - if (CLR_CMAKE_PLATFORM_ARCH_AMD64) - # The generator expression in the following command means that the /homeparams option is added only for debug builds - add_compile_options($<$<CONFIG:Debug>:/homeparams>) # Force parameters passed in registers to be written to the stack + # The generator expression in the following command means that the /homeparams option is added only for debug builds + add_compile_options($<$<CONFIG:Debug>:/homeparams>) # Force parameters passed in registers to be written to the stack endif (CLR_CMAKE_PLATFORM_ARCH_AMD64) if(NOT CLR_CMAKE_PLATFORM_ARCH_ARM64) @@ -553,6 +544,15 @@ if (WIN32) add_compile_options(/guard:cf) set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /guard:cf") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /guard:cf") + + # Statically linked CRT (libcmt[d].lib, libvcruntime[d].lib and libucrt[d].lib) by default. This is done to avoid + # linking in VCRUNTIME140.DLL for a simplified xcopy experience by reducing the dependency on VC REDIST. + # + # For Release builds, we shall dynamically link into uCRT [ucrtbase.dll] (which is pushed down as a Windows Update on downlevel OS) but + # wont do the same for debug/checked builds since ucrtbased.dll is not redistributable and Debug/Checked builds are not + # production-time scenarios. + add_compile_options($<$<OR:$<CONFIG:Release>,$<CONFIG:Relwithdebinfo>>:/MT>) + add_compile_options($<$<OR:$<CONFIG:Debug>,$<CONFIG:Checked>>:/MTd>) endif (NOT CLR_CMAKE_PLATFORM_ARCH_ARM64) # Incremental linking with CFG is broken until next VS release. @@ -592,24 +592,23 @@ if (WIN32) set(CMAKE_STATIC_LINKER_FLAGS_RELEASE "${CMAKE_STATIC_LINKER_FLAGS_RELEASE} /LTCG") set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /LTCG /OPT:REF /OPT:ICF ${NO_INCREMENTAL_LINKER_FLAGS}") - # Force uCRT to be dynamically linked for Release build - set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib") - set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib") - # ReleaseWithDebugInfo build specific flags set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO} /LTCG /OPT:REF /OPT:ICF ${NO_INCREMENTAL_LINKER_FLAGS}") set(CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_STATIC_LINKER_FLAGS_RELWITHDEBINFO} /LTCG") set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /LTCG /OPT:REF /OPT:ICF ${NO_INCREMENTAL_LINKER_FLAGS}") - # Force uCRT to be dynamically linked for Release build - set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO} /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib") - set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib") - # Temporary until cmake has VS generators for arm64 if(CLR_CMAKE_PLATFORM_ARCH_ARM64) set(CMAKE_SHARED_LINKER_FLAGS "${CMAKE_SHARED_LINKER_FLAGS} /machine:arm64") set(CMAKE_STATIC_LINKER_FLAGS "${CMAKE_STATIC_LINKER_FLAGS} /machine:arm64") set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} /machine:arm64") +else() + # Force uCRT to be dynamically linked for Release builds + set(CMAKE_SHARED_LINKER_FLAGS_RELEASE "${CMAKE_SHARED_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib") + set(CMAKE_EXE_LINKER_FLAGS_RELEASE "${CMAKE_EXE_LINKER_FLAGS_RELEASE} /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib") + set(CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_SHARED_LINKER_FLAGS_RELWITHDEBINFO} /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib") + set(CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO "${CMAKE_EXE_LINKER_FLAGS_RELWITHDEBINFO} /NODEFAULTLIB:libucrt.lib /DEFAULTLIB:ucrt.lib") + endif(CLR_CMAKE_PLATFORM_ARCH_ARM64) endif (WIN32) @@ -740,17 +739,21 @@ endif (CLR_CMAKE_PLATFORM_UNIX) if (WIN32) + # ARM64_TODO: Enable this for Windows Arm64 + if (NOT CLR_CMAKE_PLATFORM_ARCH_ARM64) # Define the CRT lib references that link into Desktop imports set(STATIC_MT_CRT_LIB "libcmt$<$<OR:$<CONFIG:Debug>,$<CONFIG:Checked>>:d>.lib") set(STATIC_MT_VCRT_LIB "libvcruntime$<$<OR:$<CONFIG:Debug>,$<CONFIG:Checked>>:d>.lib") set(STATIC_MT_CPP_LIB "libcpmt$<$<OR:$<CONFIG:Debug>,$<CONFIG:Checked>>:d>.lib") - # ARM64_TODO: Enable this for Windows Arm64 - if (NOT CLR_CMAKE_PLATFORM_ARCH_ARM64) - # Define the uCRT lib reference - set(STATIC_UCRT_LIB "libucrt$<$<OR:$<CONFIG:Debug>,$<CONFIG:Checked>>:d>.lib") - set(DYNAMIC_UCRT_LIB "ucrt$<$<OR:$<CONFIG:Debug>,$<CONFIG:Checked>>:d>.lib") - endif() + # Define the uCRT lib reference + set(STATIC_UCRT_LIB "libucrt$<$<OR:$<CONFIG:Debug>,$<CONFIG:Checked>>:d>.lib") + set(DYNAMIC_UCRT_LIB "ucrt$<$<OR:$<CONFIG:Debug>,$<CONFIG:Checked>>:d>.lib") + else() + # On Arm64, we will still use the legacy libraries for linking. + set(STATIC_MT_CRT_LIB "msvcrt.lib") + set(STATIC_MT_CPP_LIB "libcpmt$<$<OR:$<CONFIG:Debug>,$<CONFIG:Checked>>:d>.lib") + endif() endif(WIN32) |