Bug#1055636: ogre: Add loongarch64 support

Simon McVittie smcv at debian.org
Thu Nov 9 14:24:05 GMT 2023


Control: reassign -1 src:ogre-1.12

The newer branch ogre-1.12 seems to have the same issue. ogre-1.9 was
not included in bookworm and is not going to be included in trixie,
so I'm reassigning this to ogre-1.12 rather than cloning it. Please
consider this to be "won't fix" for ogre-1.9.

On Thu, 09 Nov 2023 at 11:54:29 +0000, JiaLing Zhang wrote:
>      /* Find the arch type */
> -#if defined(__x86_64__) || defined(_M_X64) || defined(__powerpc64__) || defined(__alpha__) || defined(__ia64__) || defined(__s390__) || defined(__s390x__) || defined(__arm64__) || defined(__aarch64__) || defined(__mips64) || defined(__mips64_) || (defined(__riscv) && (__riscv_xlen == 64))
> +#if defined(__x86_64__) || defined(_M_X64) || defined(__powerpc64__) || defined(__alpha__) || defined(__ia64__) || defined(__s390__) || defined(__s390x__) || defined(__arm64__) || defined(__aarch64__) || defined(__mips64) || defined(__mips64_) || (defined(__riscv) && (__riscv_xlen == 64)) || defined(__loongarch64)
>  #   define OGRE_ARCH_TYPE OGRE_ARCHITECTURE_64
>  #else
>  #   define OGRE_ARCH_TYPE OGRE_ARCHITECTURE_32

If this is as a Debian-specific patch, gcc already gives us this
information:

#if __SIZEOF_POINTER__ == 8
#define OGRE_ARCH_TYPE OGRE_ARCHITECTURE_64
#elif __SIZEOF_POINTER__ == 4
#define OGRE_ARCH_TYPE OGRE_ARCHITECTURE_32
#else
#error Architecture word size not detected or not supported
#endif

(That assumes gcc or clang, and will not work with non-gcc-compatible
compilers like MSVC, but Debian doesn't support such compilers.)

Upstream, I think this would be better done by detecting sizeof(void *)
at build time using CMAKE_SIZEOF_VOID_P, and substituting it into
CMake/Templates/OgreBuildSettings.h.in, perhaps something like this:

#define OGRE_CONFIG_SIZEOF_POINTER @CMAKE_SIZEOF_VOID_P@

and then making use of that in OgrePlatform.h:

#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
#error Architecture word size not detected or not supported
#endif

That way, there would be no need to keep updating this list with every new
CPU architecture that is invented.

    smcv



More information about the Pkg-games-devel mailing list