Add some more ARM64EC checks and print the target CPU architecture in the summary.

ARM64EC is always checked before ARM64 (in case both are defined for
some reason) and AMD64 (because MSVC defines _M_AMD64 on ARM64EC builds).

CPUInstructionSetFlags.cmake: Set both CPU_arm64 and CPU_arm64ec.
TODO: Does the Win32 manifest processor architecture change for ARM64EC?

DirInstallPaths.cmake: Set TARGET_CPU_ARCH. This is now used by the
summary at the end of the root CMakeLists.txt.

i18n.c, DelayLoadHelper.c: Add ARM64EC.

CMakeLists.txt: Print ${TARGET_CPU_ARCH}.
This commit is contained in:
David Korth 2023-07-16 13:47:45 -04:00
parent 823d401551
commit 9c9dd100c4
5 changed files with 38 additions and 15 deletions

View File

@ -284,11 +284,13 @@ IF(BUILD_TESTING)
ENDIF(BUILD_TESTING)
INCLUDE(DirInstallPaths)
MESSAGE(STATUS "
*** ROM Properties Page Shell Extension v${RP_DISPLAY_VERSION} ***
Build Summary:
- Target CPU architecture: ${TARGET_CPU_ARCH}
- Building these UI frontends: ${UI_FRONTENDS}
- Building command-line frontend: ${CLI_BUILD_MSG}
- libromdata is built as: ${LIBROMDATA_LIB_TYPE}

View File

@ -20,7 +20,13 @@ IF(MSVC AND _MSVC_C_ARCHITECTURE_FAMILY)
SET(CPU_arm 1)
SET(CMAKE_SYSTEM_PROCESSOR "ARM")
SET(WIN32_MANIFEST_PROCESSOR_ARCHITECTURE "arm")
ELSEIF(_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM64" OR _MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM64EC")
ELSEIF(_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM64EC")
SET(CPU_arm64 1)
SET(CPU_arm64ec 1)
SET(CMAKE_SYSTEM_PROCESSOR "ARM64")
# TODO: Does this change for ARM64EC?
SET(WIN32_MANIFEST_PROCESSOR_ARCHITECTURE "arm64")
ELSEIF(_MSVC_C_ARCHITECTURE_FAMILY STREQUAL "ARM64")
SET(CPU_arm64 1)
SET(CMAKE_SYSTEM_PROCESSOR "ARM64")
SET(WIN32_MANIFEST_PROCESSOR_ARCHITECTURE "arm64")

View File

@ -7,6 +7,8 @@
# be in the root of the Windows ZIP file. On other platforms,
# it's the same as DIR_INSTALL_DOC.
# TARGET_CPU_ARCH is set to indicate the target CPU architecture.
IF(NOT PACKAGE_NAME)
MESSAGE(FATAL_ERROR "PACKAGE_NAME is not set.")
ENDIF(NOT PACKAGE_NAME)
@ -21,6 +23,8 @@ ELSEIF(CPU_ia64)
SET(arch "ia64")
ELSEIF(CPU_arm)
SET(arch "arm")
ELSEIF(CPU_arm64ec)
SET(arch "arm64ec")
ELSEIF(CPU_arm64)
SET(arch "arm64")
ELSEIF(CPU_ppc)
@ -36,6 +40,7 @@ ELSEIF(CPU_riscv64)
ELSE()
MESSAGE(FATAL_ERROR "Unsupported CPU architecture, please fix!")
ENDIF()
SET(TARGET_CPU_ARCH "${arch}")
INCLUDE(GNUInstallDirs)
IF(UNIX AND NOT APPLE)
@ -111,3 +116,4 @@ ELSEIF(WIN32)
ELSE()
MESSAGE(WARNING "Installation paths have not been set up for this system.")
ENDIF()
UNSET(arch)

View File

@ -27,19 +27,20 @@
static bool i18n_is_init = false;
#ifdef _WIN32
// Architecture name.
// Architecture-specific subdirectory.
#if defined(_M_IX86) || defined(__i386__)
// Architecture name for the arch-specific subdirectory.
#if defined(_M_ARM) || defined(__arm__) || \
defined(_M_ARMT) || defined(__thumb__)
# define ARCH_NAME _T("arm")
#elif defined(_M_ARM64EC)
# define ARCH_NAME _T("arm64ec")
#elif defined(_M_ARM64) || defined(__aarch64__)
# define ARCH_NAME _T("arm64")
#elif defined(_M_IX86) || defined(__i386__)
# define ARCH_NAME _T("i386")
#elif defined(_M_X64) || defined(_M_AMD64) || defined(__amd64__) || defined(__x86_64__)
# define ARCH_NAME _T("amd64")
#elif defined(_M_IA64) || defined(__ia64__)
# define ARCH_NAME _T("ia64")
#elif defined(_M_ARM) || defined(__arm__) || \
defined(_M_ARMT) || defined(__thumb__)
# define ARCH_NAME _T("arm")
#elif defined(_M_ARM64) || defined(__aarch64__)
# define ARCH_NAME _T("arm64")
#elif defined(__riscv) && (__riscv_xlen == 32)
// TODO: MSVC riscv32 preprocessor macro, if one ever gets defined.
# define ARCH_NAME _T("riscv32")

View File

@ -23,17 +23,25 @@ EXTERN_C IMAGE_DOS_HEADER __ImageBase;
#define HINST_THISCOMPONENT ((HINSTANCE)&__ImageBase)
// Architecture-specific subdirectory.
#if defined(_M_IX86) || defined(__i386__)
#if defined(_M_ARM) || defined(__arm__) || \
defined(_M_ARMT) || defined(__thumb__)
static const TCHAR rp_subdir[] = _T("arm\\");
#elif defined(_M_ARM64EC)
static const TCHAR rp_subdir[] = _T("arm64ec\\");
#elif defined(_M_ARM64) || defined(__aarch64__)
static const TCHAR rp_subdir[] = _T("arm64\\");
#elif defined(_M_IX86) || defined(__i386__)
static const TCHAR rp_subdir[] = _T("i386\\");
#elif defined(_M_X64) || defined(_M_AMD64) || defined(__amd64__) || defined(__x86_64__)
static const TCHAR rp_subdir[] = _T("amd64\\");
#elif defined(_M_IA64) || defined(__ia64__)
static const TCHAR rp_subdir[] = _T("ia64\\");
#elif defined(_M_ARM) || defined(__arm__) || \
defined(_M_ARMT) || defined(__thumb__)
static const TCHAR rp_subdir[] = _T("arm\\");
#elif defined(_M_ARM64) || defined(__aarch64__)
static const TCHAR rp_subdir[] = _T("arm64\\");
#elif defined(__riscv) && (__riscv_xlen == 32)
// TODO: MSVC riscv32 preprocessor macro, if one ever gets defined.
static const TCHAR rp_subdir[] = _T("riscv32\\");
#elif defined(__riscv) && (__riscv_xlen == 64)
// TODO: MSVC riscv64 preprocessor macro, if one ever gets defined.
static const TCHAR rp_subdir[] = _T("riscv64\\");
#else
# error Unsupported CPU architecture.
#endif