diff options
author | Minmin Gong <gongminmin@msn.com> | 2017-09-02 04:06:38 (GMT) |
---|---|---|
committer | Brad King <brad.king@kitware.com> | 2017-09-12 13:54:29 (GMT) |
commit | bc7c94fe13eeda2b59f5af606a03fdad5a9c29a5 (patch) | |
tree | 86395272041689ead3e1bc6f2a062cece8861cc5 | |
parent | 3f8c6cab4bb4a9f68708c11a38e4487dad363e38 (diff) | |
download | CMake-bc7c94fe13eeda2b59f5af606a03fdad5a9c29a5.zip CMake-bc7c94fe13eeda2b59f5af606a03fdad5a9c29a5.tar.gz CMake-bc7c94fe13eeda2b59f5af606a03fdad5a9c29a5.tar.bz2 |
MSVC: Add support for ARM64 architecture
Visual Studio 15.4 adds support for this architecture.
Fixes: #17213
-rw-r--r-- | Help/release/dev/msvc-arm64.rst | 5 | ||||
-rw-r--r-- | Modules/CMakeDetermineCompilerId.cmake | 4 | ||||
-rw-r--r-- | Modules/CMakeGenericSystem.cmake | 2 | ||||
-rw-r--r-- | Modules/CMakePlatformId.h.in | 3 | ||||
-rw-r--r-- | Modules/Platform/Windows-MSVC.cmake | 12 | ||||
-rw-r--r-- | Source/cmGlobalVisualStudio10Generator.cxx | 7 | ||||
-rw-r--r-- | Source/cmLocalVisualStudio7Generator.cxx | 1 | ||||
-rw-r--r-- | Source/cmVS141LinkFlagTable.h | 1 | ||||
-rw-r--r-- | Source/cmVS14LibFlagTable.h | 1 | ||||
-rw-r--r-- | Source/cmVisualStudio10TargetGenerator.cxx | 4 |
10 files changed, 35 insertions, 5 deletions
diff --git a/Help/release/dev/msvc-arm64.rst b/Help/release/dev/msvc-arm64.rst new file mode 100644 index 0000000..c8fadd4 --- /dev/null +++ b/Help/release/dev/msvc-arm64.rst @@ -0,0 +1,5 @@ +msvc-arm64 +---------- + +* Support for the MSVC ARM64 architecture was added. + Visual Studio 2017 Update 4 and above offer an ARM64 toolchain. diff --git a/Modules/CMakeDetermineCompilerId.cmake b/Modules/CMakeDetermineCompilerId.cmake index f11059f..0a93e5f 100644 --- a/Modules/CMakeDetermineCompilerId.cmake +++ b/Modules/CMakeDetermineCompilerId.cmake @@ -220,7 +220,9 @@ Id flags: ${testflags} ${CMAKE_${lang}_COMPILER_ID_FLAGS_ALWAYS} if(CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION) set(id_WindowsTargetPlatformVersion "<WindowsTargetPlatformVersion>${CMAKE_VS_WINDOWS_TARGET_PLATFORM_VERSION}</WindowsTargetPlatformVersion>") endif() - if(id_platform STREQUAL ARM) + if(id_platform STREQUAL ARM64) + set(id_WindowsSDKDesktopARMSupport "<WindowsSDKDesktopARM64Support>true</WindowsSDKDesktopARM64Support>") + elseif(id_platform STREQUAL ARM) set(id_WindowsSDKDesktopARMSupport "<WindowsSDKDesktopARMSupport>true</WindowsSDKDesktopARMSupport>") else() set(id_WindowsSDKDesktopARMSupport "") diff --git a/Modules/CMakeGenericSystem.cmake b/Modules/CMakeGenericSystem.cmake index cd05237..9c38f6e 100644 --- a/Modules/CMakeGenericSystem.cmake +++ b/Modules/CMakeGenericSystem.cmake @@ -76,6 +76,8 @@ function(GetDefaultWindowsPrefixBase var) # if("${CMAKE_GENERATOR}" MATCHES "(Win64|IA64)") set(arch_hint "x64") + elseif("${CMAKE_GENERATOR_PLATFORM}" MATCHES "ARM64") + set(arch_hint "ARM64") elseif("${CMAKE_GENERATOR}" MATCHES "ARM") set(arch_hint "ARM") elseif("${CMAKE_SIZEOF_VOID_P}" STREQUAL "8") diff --git a/Modules/CMakePlatformId.h.in b/Modules/CMakePlatformId.h.in index c7065b2..a6a9c0a 100644 --- a/Modules/CMakePlatformId.h.in +++ b/Modules/CMakePlatformId.h.in @@ -114,6 +114,9 @@ # elif defined(_M_IX86) # define ARCHITECTURE_ID "X86" +# elif defined(_M_ARM64) +# define ARCHITECTURE_ID "ARM64" + # elif defined(_M_ARM) # if _M_ARM == 4 # define ARCHITECTURE_ID "ARMV4I" diff --git a/Modules/Platform/Windows-MSVC.cmake b/Modules/Platform/Windows-MSVC.cmake index cfe6e1c..f3f0fe2 100644 --- a/Modules/Platform/Windows-MSVC.cmake +++ b/Modules/Platform/Windows-MSVC.cmake @@ -122,7 +122,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 "^ARM") + if(_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") elseif(_MSVC_${lang}_ARCHITECTURE_FAMILY MATCHES "^SH") set(_MSVC_${lang}_ARCHITECTURE_FAMILY "SHx") @@ -175,7 +177,7 @@ elseif(WINDOWS_PHONE OR WINDOWS_STORE) set(CMAKE_C_STANDARD_LIBRARIES_INIT "WindowsApp.lib") elseif(WINDOWS_PHONE) set(CMAKE_C_STANDARD_LIBRARIES_INIT "WindowsPhoneCore.lib RuntimeObject.lib PhoneAppModelHost.lib") - elseif(_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM" OR _MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "ARM") + elseif(_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM" OR _MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "ARM" OR _MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM64" OR _MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "ARM64") set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib") else() set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib gdi32.lib winspool.lib comdlg32.lib advapi32.lib shell32.lib ole32.lib oleaut32.lib uuid.lib odbc32.lib odbccp32.lib") @@ -183,7 +185,7 @@ elseif(WINDOWS_PHONE OR WINDOWS_STORE) else() set(_PLATFORM_DEFINES "/DWIN32") - if(_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM" OR _MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "ARM") + if(_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM" OR _MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "ARM" OR _MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM64" OR _MSVC_CXX_ARCHITECTURE_FAMILY STREQUAL "ARM64") set(CMAKE_C_STANDARD_LIBRARIES_INIT "kernel32.lib user32.lib") elseif(MSVC_VERSION GREATER 1310) if(CMAKE_VS_PLATFORM_TOOLSET MATCHES "(v[0-9]+_clang_.*|LLVM-vs[0-9]+.*)") @@ -215,6 +217,8 @@ set (CMAKE_LINK_DEF_FILE_FLAG "/DEF:") if(MSVC_C_ARCHITECTURE_ID) if(MSVC_C_ARCHITECTURE_ID MATCHES "^ARMV.I") 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 "ARM") set(_MACHINE_ARCH_FLAG "/machine:ARM") else() @@ -223,6 +227,8 @@ if(MSVC_C_ARCHITECTURE_ID) elseif(MSVC_CXX_ARCHITECTURE_ID) if(MSVC_CXX_ARCHITECTURE_ID MATCHES "^ARMV.I") 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 "ARM") set(_MACHINE_ARCH_FLAG "/machine:ARM") else() diff --git a/Source/cmGlobalVisualStudio10Generator.cxx b/Source/cmGlobalVisualStudio10Generator.cxx index 1c0953a..5db81ce 100644 --- a/Source/cmGlobalVisualStudio10Generator.cxx +++ b/Source/cmGlobalVisualStudio10Generator.cxx @@ -695,7 +695,12 @@ bool cmGlobalVisualStudio10Generator::FindVCTargetsPath(cmMakefile* mf) xw.Content(this->WindowsTargetPlatformVersion); xw.EndElement(); // WindowsTargetPlatformVersion } - if (this->GetPlatformName() == "ARM") { + if (this->GetPlatformName() == "ARM64") { + xw.StartElement("WindowsSDKDesktopARM64Support"); + xw.Content("true"); + xw.EndElement(); // WindowsSDK64DesktopARMSupport + } + else if (this->GetPlatformName() == "ARM") { xw.StartElement("WindowsSDKDesktopARMSupport"); xw.Content("true"); xw.EndElement(); // WindowsSDKDesktopARMSupport diff --git a/Source/cmLocalVisualStudio7Generator.cxx b/Source/cmLocalVisualStudio7Generator.cxx index 857ce46..fc42d6e 100644 --- a/Source/cmLocalVisualStudio7Generator.cxx +++ b/Source/cmLocalVisualStudio7Generator.cxx @@ -526,6 +526,7 @@ cmVS7FlagTable cmLocalVisualStudio7GeneratorLinkFlagTable[] = { { "TargetMachine", "MACHINE:SH5", "Machine SH5", "15", 0 }, { "TargetMachine", "MACHINE:THUMB", "Machine THUMB", "16", 0 }, { "TargetMachine", "MACHINE:X64", "Machine x64", "17", 0 }, + { "TargetMachine", "MACHINE:ARM64", "Machine ARM64", "18", 0 }, { "TurnOffAssemblyGeneration", "NOASSEMBLY", "No assembly even if CLR information is present in objects.", "true", 0 }, { "ModuleDefinitionFile", "DEF:", "add an export def file", "", diff --git a/Source/cmVS141LinkFlagTable.h b/Source/cmVS141LinkFlagTable.h index 8f0f1f4..a440ee7 100644 --- a/Source/cmVS141LinkFlagTable.h +++ b/Source/cmVS141LinkFlagTable.h @@ -87,6 +87,7 @@ static cmVS7FlagTable cmVS141LinkFlagTable[] = { { "TargetMachine", "", "Not Set", "NotSet", 0 }, { "TargetMachine", "MACHINE:ARM", "MachineARM", "MachineARM", 0 }, + { "TargetMachine", "MACHINE:ARM64", "MachineARM64", "MachineARM64", 0 }, { "TargetMachine", "MACHINE:EBC", "MachineEBC", "MachineEBC", 0 }, { "TargetMachine", "MACHINE:IA64", "MachineIA64", "MachineIA64", 0 }, { "TargetMachine", "MACHINE:MIPS", "MachineMIPS", "MachineMIPS", 0 }, diff --git a/Source/cmVS14LibFlagTable.h b/Source/cmVS14LibFlagTable.h index 7fa7138..be4652c 100644 --- a/Source/cmVS14LibFlagTable.h +++ b/Source/cmVS14LibFlagTable.h @@ -11,6 +11,7 @@ static cmVS7FlagTable cmVS14LibFlagTable[] = { 0 }, { "TargetMachine", "MACHINE:ARM", "MachineARM", "MachineARM", 0 }, + { "TargetMachine", "MACHINE:ARM64", "MachineARM64", "MachineARM64", 0 }, { "TargetMachine", "MACHINE:EBC", "MachineEBC", "MachineEBC", 0 }, { "TargetMachine", "MACHINE:IA64", "MachineIA64", "MachineIA64", 0 }, { "TargetMachine", "MACHINE:MIPS", "MachineMIPS", "MachineMIPS", 0 }, diff --git a/Source/cmVisualStudio10TargetGenerator.cxx b/Source/cmVisualStudio10TargetGenerator.cxx index bd3e82d..bbf834e 100644 --- a/Source/cmVisualStudio10TargetGenerator.cxx +++ b/Source/cmVisualStudio10TargetGenerator.cxx @@ -3893,6 +3893,10 @@ void cmVisualStudio10TargetGenerator::WriteApplicationTypeSettings() this->WriteString("<AppContainerApplication>true" "</AppContainerApplication>\n", 2); + } else if (this->Platform == "ARM64") { + this->WriteString("<WindowsSDKDesktopARM64Support>true" + "</WindowsSDKDesktopARM64Support>\n", + 2); } else if (this->Platform == "ARM") { this->WriteString("<WindowsSDKDesktopARMSupport>true" "</WindowsSDKDesktopARMSupport>\n", |