From 54639131bf1e5dce87c10dba45062cfec804e343 Mon Sep 17 00:00:00 2001 From: John Preston Date: Wed, 17 Jul 2024 12:23:17 +0200 Subject: [PATCH] Add constants for Windows on ARM. --- base/platform/base_platform_info.h | 1 + base/platform/linux/base_info_linux.h | 1 + base/platform/mac/base_info_mac.h | 1 + base/platform/win/base_info_win.cpp | 4 +++- base/platform/win/base_info_win.h | 8 ++++++++ 5 files changed, 14 insertions(+), 1 deletion(-) diff --git a/base/platform/base_platform_info.h b/base/platform/base_platform_info.h index 6fd81cb6..ad3f5848 100644 --- a/base/platform/base_platform_info.h +++ b/base/platform/base_platform_info.h @@ -44,6 +44,7 @@ enum class OutdateReason { [[nodiscard]] constexpr bool IsWindows(); [[nodiscard]] constexpr bool IsWindows32Bit(); [[nodiscard]] constexpr bool IsWindows64Bit(); +[[nodiscard]] constexpr bool IsWindowsARM64(); [[nodiscard]] constexpr bool IsWindowsStoreBuild(); [[nodiscard]] bool IsWindows7OrGreater(); [[nodiscard]] bool IsWindows8OrGreater(); diff --git a/base/platform/linux/base_info_linux.h b/base/platform/linux/base_info_linux.h index 397ad84d..e2228ec3 100644 --- a/base/platform/linux/base_info_linux.h +++ b/base/platform/linux/base_info_linux.h @@ -21,6 +21,7 @@ inline constexpr bool IsLinux() { inline constexpr bool IsWindows() { return false; } inline constexpr bool IsWindows32Bit() { return false; } inline constexpr bool IsWindows64Bit() { return false; } +inline constexpr bool IsWindowsARM64() { return false; } inline constexpr bool IsWindowsStoreBuild() { return false; } inline bool IsWindows7OrGreater() { return false; } inline bool IsWindows8OrGreater() { return false; } diff --git a/base/platform/mac/base_info_mac.h b/base/platform/mac/base_info_mac.h index 8fe46d39..f05e2b34 100644 --- a/base/platform/mac/base_info_mac.h +++ b/base/platform/mac/base_info_mac.h @@ -29,6 +29,7 @@ inline constexpr bool IsMacStoreBuild() { inline constexpr bool IsWindows() { return false; } inline constexpr bool IsWindows32Bit() { return false; } inline constexpr bool IsWindows64Bit() { return false; } +inline constexpr bool IsWindowsARM64() { return false; } inline constexpr bool IsWindowsStoreBuild() { return false; } inline bool IsWindows7OrGreater() { return false; } inline bool IsWindows8OrGreater() { return false; } diff --git a/base/platform/win/base_info_win.cpp b/base/platform/win/base_info_win.cpp index f96b6553..741d738d 100644 --- a/base/platform/win/base_info_win.cpp +++ b/base/platform/win/base_info_win.cpp @@ -275,7 +275,9 @@ int AutoUpdateVersion() { } QString AutoUpdateKey() { - if (IsWindows64Bit()) { + if (IsWindowsARM64()) { + return "winarm"; + } else if (IsWindows64Bit()) { return "win64"; } else { return "win"; diff --git a/base/platform/win/base_info_win.h b/base/platform/win/base_info_win.h index b7c5dbad..767aa404 100644 --- a/base/platform/win/base_info_win.h +++ b/base/platform/win/base_info_win.h @@ -34,6 +34,14 @@ inline constexpr bool IsWindows64Bit() { #endif // Q_PROCESSOR_X86_64 } +inline constexpr bool IsWindowsARM64() { +#ifdef Q_PROCESSOR_ARM_64 + return true; +#else // Q_PROCESSOR_ARM_64 + return false; +#endif // Q_PROCESSOR_ARM_64 +} + inline constexpr bool IsWindowsStoreBuild() { #ifdef OS_WIN_STORE return true;