From 3db3424b4e8820e12cbad144dac990515745d2b6 Mon Sep 17 00:00:00 2001 From: Anonymous Maarten Date: Sun, 26 Feb 2023 00:22:23 +0100 Subject: [PATCH] cmake: Detect powerpc architecture --- CMakeLists.txt | 2 +- cmake/CheckCPUArchitecture.cmake | 6 +++++- cmake/sdlplatform.cmake | 2 +- 3 files changed, 7 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index 60bd7f645..42ad41af5 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -372,7 +372,7 @@ dep_option(SDL_SSE "Use SSE assembly routines" ON "SDL_ASSEMBLY; dep_option(SDL_SSE2 "Use SSE2 assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF) dep_option(SDL_SSE3 "Use SSE3 assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF) dep_option(SDL_MMX "Use MMX assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF) -dep_option(SDL_ALTIVEC "Use Altivec assembly routines" ON "SDL_ASSEMBLY" OFF) +dep_option(SDL_ALTIVEC "Use Altivec assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_POWERPC32 OR SDL_CPU_POWERPC64" OFF) dep_option(SDL_ARMSIMD "Use SIMD assembly blitters on ARM" OFF "SDL_ASSEMBLY;SDL_CPU_ARM32" OFF) dep_option(SDL_ARMNEON "Use NEON assembly blitters on ARM" OFF "SDL_ASSEMBLY;SDL_CPU_ARM32" OFF) dep_option(SDL_LSX "Use LSX assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_LOONGARCH64" OFF) diff --git a/cmake/CheckCPUArchitecture.cmake b/cmake/CheckCPUArchitecture.cmake index 013287424..fb560af10 100644 --- a/cmake/CheckCPUArchitecture.cmake +++ b/cmake/CheckCPUArchitecture.cmake @@ -36,9 +36,13 @@ function(check_cpu_architecture ARCH VARIABLE) _internal_check_cpu_architecture("defined(__loongarch64)" loongarch64 ${VARIABLE}) elseif(ARCH STREQUAL "emscripten") _internal_check_cpu_architecture("defined(__EMSCRIPTEN__)" emscripten ${VARIABLE}) + elseif(ARCH STREQUAL "powerpc32") + _internal_check_cpu_architecture("defined(__PPC__) || defined(__powerpc__)" powerpc32 ${VARIABLE}) + elseif(ARCH STREQUAL "powerpc64") + _internal_check_cpu_architecture("defined(__PPC64__) || defined(__powerpc64__)" powerpc64 ${VARIABLE}) else() message(WARNING "Unknown CPU architectures (${ARCH}).") - set(${VARIABLE} FALSE) + set("${VARIABLE}" FALSE) endif() set("${VARIABLE}" "${${VARIABLE}}" PARENT_SCOPE) endfunction() diff --git a/cmake/sdlplatform.cmake b/cmake/sdlplatform.cmake index 46720edff..b2488e021 100644 --- a/cmake/sdlplatform.cmake +++ b/cmake/sdlplatform.cmake @@ -78,7 +78,7 @@ function(SDL_DetectCPUArchitecture) endforeach() endif() - set(sdl_known_archs x86 x64 arm32 arm64 loongarch64 emscripten) + set(sdl_known_archs x64 x86 arm64 arm32 emscripten powerpc32 powerpc64 loongarch64) if(NOT sdl_cpu_names) set(found FALSE) foreach(sdl_known_arch ${sdl_known_archs})