1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60
|
From: Simon McVittie <smcv@debian.org>
Date: Sun, 24 Mar 2024 12:41:31 +0100
Subject: Generalize architecture support
---
CMake/Templates/OgreBuildSettings.h.in | 2 ++
OgreMain/include/OgrePlatform.h | 20 ++++++++++----------
2 files changed, 12 insertions(+), 10 deletions(-)
diff --git a/CMake/Templates/OgreBuildSettings.h.in b/CMake/Templates/OgreBuildSettings.h.in
index 95eb1b7..2a7a3b7 100644
--- a/CMake/Templates/OgreBuildSettings.h.in
+++ b/CMake/Templates/OgreBuildSettings.h.in
@@ -109,4 +109,6 @@ WARNING: Disabling this will make the samples unusable.
#cmakedefine01 OGRE_NO_LOCALE_STRCONVERT
+#define OGRE_CONFIG_SIZEOF_POINTER @CMAKE_SIZEOF_VOID_P@
+
#endif
diff --git a/OgreMain/include/OgrePlatform.h b/OgreMain/include/OgrePlatform.h
index 9c94db4..1ba288d 100644
--- a/OgreMain/include/OgrePlatform.h
+++ b/OgreMain/include/OgrePlatform.h
@@ -75,14 +75,12 @@ namespace Ogre {
#endif
/* Find the arch type */
-#if defined(__x86_64__) || defined(_M_X64) || defined(_M_X64) || defined(_M_AMD64) \
- || defined(__ppc64__) \
- || defined(__arm64__) || defined(__aarch64__) || defined(_M_ARM64) \
- || defined(__mips64) || defined(__mips64_) \
- || defined(__alpha__) || defined(__ia64__) || defined(__s390__) || defined(__s390x__)
-# define OGRE_ARCH_TYPE OGRE_ARCHITECTURE_64
+#if OGRE_CONFIG_SIZEOF_POINTER == 8
+#define OGRE_ARCH_TYPE OGRE_ARCHITECTURE_64
+#elif OGRE_CONFIG_SIZEOF_POINTER == 4
+#define OGRE_ARCH_TYPE OGRE_ARCHITECTURE_32
#else
-# define OGRE_ARCH_TYPE OGRE_ARCHITECTURE_32
+#error Architecture word size not detected or not supported
#endif
/* Determine CPU endian.
@@ -193,10 +191,12 @@ namespace Ogre {
#endif
/* Find the arch type */
-#if defined(__x86_64__) || defined(_M_X64) || defined(_M_AMD64) || defined(_M_ARM64) || defined(__powerpc64__) || defined(__alpha__) || defined(__ia64__) || defined(__s390__) || defined(__s390x__) || defined(__arm64__) || defined(__aarch64__) || defined(__mips64) || defined(__mips64_) || (defined(__riscv) && (__riscv_xlen == 64))
-# define OGRE_ARCH_TYPE OGRE_ARCHITECTURE_64
+#if OGRE_CONFIG_SIZEOF_POINTER == 8
+#define OGRE_ARCH_TYPE OGRE_ARCHITECTURE_64
+#elif OGRE_CONFIG_SIZEOF_POINTER == 4
+#define OGRE_ARCH_TYPE OGRE_ARCHITECTURE_32
#else
-# define OGRE_ARCH_TYPE OGRE_ARCHITECTURE_32
+#error Architecture word size not detected or not supported
#endif
/* Find how to declare aligned variable. */
|