diff options
author | Moyo Okeremi 😊 <mookerem@microsoft.com> | 2020-12-30 22:44:20 (GMT) |
---|---|---|
committer | Moyo Okeremi 😊 <mookerem@microsoft.com> | 2021-01-21 00:43:35 (GMT) |
commit | 4ea3a8862503985222e3e85eeea752a719c03cc2 (patch) | |
tree | 9e7e8df9f195760aa29917da889801d412fac79d | |
parent | b30243d9fd5832741ef4470289086e74a78599e1 (diff) | |
download | CMake-4ea3a8862503985222e3e85eeea752a719c03cc2.zip CMake-4ea3a8862503985222e3e85eeea752a719c03cc2.tar.gz CMake-4ea3a8862503985222e3e85eeea752a719c03cc2.tar.bz2 |
MSVC: Add support for targeting ARM64EC
-rw-r--r-- | Modules/CMakePlatformId.h.in | 3 | ||||
-rw-r--r-- | Modules/Platform/Windows-MSVC.cmake | 18 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudioVersionedGenerator.cxx | 1 | ||||
-rw-r--r-- | Templates/MSBuild/FlagTables/v142_Link.json | 7 | ||||
-rw-r--r-- | Templates/MSBuild/FlagTables/v14_LIB.json | 7 |
5 files changed, 33 insertions, 3 deletions
diff --git a/Modules/CMakePlatformId.h.in b/Modules/CMakePlatformId.h.in index 0b81c88..c0cab71 100644 --- a/Modules/CMakePlatformId.h.in +++ b/Modules/CMakePlatformId.h.in @@ -116,6 +116,9 @@ # if defined(_M_IA64) # define ARCHITECTURE_ID "IA64" +# elif defined(_M_ARM64EC) +# define ARCHITECTURE_ID "ARM64EC" + # elif defined(_M_X64) || defined(_M_AMD64) # define ARCHITECTURE_ID "x64" diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index 08afd61..e384af4 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -154,7 +154,9 @@ set(CMAKE_BUILD_TYPE_INIT Debug) # Compute an architecture family from the architecture id. foreach(lang C CXX) set(_MSVC_${lang}_ARCHITECTURE_FAMILY "${MSVC_${lang}_ARCHITECTURE_ID}") - if(_MSVC_${lang}_ARCHITECTURE_FAMILY MATCHES "^ARM64") + if(_MSVC_${lang}_ARCHITECTURE_FAMILY MATCHES "^ARM64EC") + set(_MSVC_${lang}_ARCHITECTURE_FAMILY "ARM64EC") + elseif(_MSVC_${lang}_ARCHITECTURE_FAMILY MATCHES "^ARM64") set(_MSVC_${lang}_ARCHITECTURE_FAMILY "ARM64") elseif(_MSVC_${lang}_ARCHITECTURE_FAMILY MATCHES "^ARM") set(_MSVC_${lang}_ARCHITECTURE_FAMILY "ARM") @@ -224,7 +226,9 @@ elseif(WINDOWS_PHONE OR WINDOWS_STORE) endif() else() set(_PLATFORM_DEFINES "/DWIN32") - + if((_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM64EC") OR (_MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "ARM64EC")) + set(_PLATFORM_DEFINES "${_PLATFORM_DEFINES} /D_AMD64_ /DAMD64 /D_ARM64EC_ /DARM64EC /D_ARM64EC_WORKAROUND_") + endif() if(_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM" OR _MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "ARM") set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib") elseif(MSVC_VERSION GREATER 1310) @@ -261,6 +265,8 @@ if(MSVC_C_ARCHITECTURE_ID) set(_MACHINE_ARCH_FLAG "/machine:THUMB") elseif(_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM64") set(_MACHINE_ARCH_FLAG "/machine:ARM64") + elseif(_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM64EC") + set(_MACHINE_ARCH_FLAG "/machine:ARM64EC") elseif(_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM") set(_MACHINE_ARCH_FLAG "/machine:ARM") else() @@ -271,6 +277,8 @@ elseif(MSVC_CXX_ARCHITECTURE_ID) set(_MACHINE_ARCH_FLAG "/machine:THUMB") elseif(_MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "ARM64") set(_MACHINE_ARCH_FLAG "/machine:ARM64") + elseif(_MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "ARM64EC") + set(_MACHINE_ARCH_FLAG "/machine:ARM64EC") elseif(_MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "ARM") set(_MACHINE_ARCH_FLAG "/machine:ARM") else() @@ -305,7 +313,11 @@ foreach(t EXE SHARED MODULE) string(APPEND CMAKE_${t}_LINKER_FLAGS_RELEASE_INIT " /INCREMENTAL:NO") endforeach() -string(APPEND CMAKE_STATIC_LINKER_FLAGS_INIT " ${_MACHINE_ARCH_FLAG}") +if((_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM64EC") OR (_MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "ARM64EC")) + string(APPEND CMAKE_STATIC_LINKER_FLAGS_INIT " /machine:ARM64X") +else() + string(APPEND CMAKE_STATIC_LINKER_FLAGS_INIT " ${_MACHINE_ARCH_FLAG}") +endif() unset(_MACHINE_ARCH_FLAG) cmake_policy(GET CMP0091 __WINDOWS_MSVC_CMP0091) diff --git a/Source/cmGlobalVisualStudioVersionedGenerator.cxx b/Source/cmGlobalVisualStudioVersionedGenerator.cxx index 95357e7..a713dc4 100644 --- a/Source/cmGlobalVisualStudioVersionedGenerator.cxx +++ b/Source/cmGlobalVisualStudioVersionedGenerator.cxx @@ -200,6 +200,7 @@ public: platforms.emplace_back("Win32"); platforms.emplace_back("ARM"); platforms.emplace_back("ARM64"); + platforms.emplace_back("ARM64EC"); return platforms; } diff --git a/Templates/MSBuild/FlagTables/v142_Link.json b/Templates/MSBuild/FlagTables/v142_Link.json index 66ee76f..110dcc2 100644 --- a/Templates/MSBuild/FlagTables/v142_Link.json +++ b/Templates/MSBuild/FlagTables/v142_Link.json @@ -352,6 +352,13 @@ }, { "name": "TargetMachine", + "switch": "MACHINE:ARM64EC", + "comment": "MachineARM64EC", + "value": "MachineARM64EC", + "flags": [] + }, + { + "name": "TargetMachine", "switch": "MACHINE:EBC", "comment": "MachineEBC", "value": "MachineEBC", diff --git a/Templates/MSBuild/FlagTables/v14_LIB.json b/Templates/MSBuild/FlagTables/v14_LIB.json index 5990ed1..a0e85b2 100644 --- a/Templates/MSBuild/FlagTables/v14_LIB.json +++ b/Templates/MSBuild/FlagTables/v14_LIB.json @@ -43,6 +43,13 @@ }, { "name": "TargetMachine", + "switch": "MACHINE:ARM64X", + "comment": "MachineARM64X", + "value": "MachineARM64X", + "flags": [] + }, + { + "name": "TargetMachine", "switch": "MACHINE:EBC", "comment": "MachineEBC", "value": "MachineEBC", |