diff options
author | Brad King <brad.king@kitware.com> | 2021-01-22 13:38:15 (GMT) |
---|---|---|
committer | Kitware Robot <kwrobot@kitware.com> | 2021-01-22 13:38:21 (GMT) |
commit | 5a1b257fe745bdf27079f5582138f724d4702a69 (patch) | |
tree | cce09fa40d33ab02e35b85bf811a27436ba8acdb /Modules | |
parent | 664038ab4f8dda7b997f5b930658c4ea25f56010 (diff) | |
parent | 4ea3a8862503985222e3e85eeea752a719c03cc2 (diff) | |
download | CMake-5a1b257fe745bdf27079f5582138f724d4702a69.zip CMake-5a1b257fe745bdf27079f5582138f724d4702a69.tar.gz CMake-5a1b257fe745bdf27079f5582138f724d4702a69.tar.bz2 |
Merge topic 'msvc-arm64ec-platform-support'
4ea3a88625 MSVC: Add support for targeting ARM64EC
Acked-by: Kitware Robot <kwrobot@kitware.com>
Merge-request: !5708
Diffstat (limited to 'Modules')
-rw-r--r-- | Modules/CMakePlatformId.h.in | 3 | ||||
-rw-r--r-- | Modules/Platform/Windows-MSVC.cmake | 18 |
2 files changed, 18 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) |