mirror of
https://github.com/shadps4-emu/ext-SDL.git
synced 2025-02-02 08:53:06 +00:00
cmake+video: always use altivec.h header for detection + introduce SDL_ENABLE_ALTIVEC
This commit is contained in:
parent
684709a5b6
commit
d27db3defa
@ -856,23 +856,17 @@ if(SDL_ASSEMBLY)
|
||||
set(CMAKE_REQUIRED_FLAGS "${CMAKE_REQUIRED_FLAGS} -maltivec")
|
||||
check_c_source_compiles("
|
||||
#include <altivec.h>
|
||||
vector unsigned int vzero() {
|
||||
return vec_splat_u32(0);
|
||||
}
|
||||
int main(int argc, char **argv) { return 0; }" HAVE_ALTIVEC_H_HDR)
|
||||
check_c_source_compiles("
|
||||
vector unsigned int vzero() {
|
||||
return vec_splat_u32(0);
|
||||
}
|
||||
int main(int argc, char **argv) { return 0; }" CPU_SUPPORTS_ALTIVEC)
|
||||
cmake_pop_check_state()
|
||||
if(CPU_SUPPORTS_ALTIVEC OR HAVE_ALTIVEC_H_HDR)
|
||||
set(HAVE_ALTIVEC TRUE) # if only HAVE_ALTIVEC_H_HDR is set
|
||||
target_compile_options(sdl-build-options INTERFACE "-maltivec")
|
||||
if(CPU_SUPPORTS_ALTIVEC)
|
||||
set(HAVE_ALTIVEC TRUE)
|
||||
set(SDL_ALTIVEC_BLITTERS 1)
|
||||
if(HAVE_ALTIVEC_H_HDR)
|
||||
set(HAVE_ALTIVEC_H 1)
|
||||
endif()
|
||||
target_compile_options(sdl-build-options INTERFACE "-maltivec")
|
||||
set_property(SOURCE "${SDL3_SOURCE_DIR}/src/video/SDL_blit_N.c" APPEND PROPERTY COMPILE_DEFINITIONS "SDL_ENABLE_ALTIVEC")
|
||||
set_property(SOURCE "${SDL3_SOURCE_DIR}/src/video/SDL_blit_N.c" APPEND PROPERTY SKIP_PRECOMPILE_HEADERS 1)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
|
@ -36,10 +36,10 @@ 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})
|
||||
elseif(ARCH STREQUAL "powerpc32")
|
||||
_internal_check_cpu_architecture("(defined(__PPC__) || defined(__powerpc__)) && !defined(__powerpc64__)" powerpc32 ${VARIABLE})
|
||||
else()
|
||||
message(WARNING "Unknown CPU architectures (${ARCH}).")
|
||||
set("${VARIABLE}" FALSE)
|
||||
|
@ -78,7 +78,7 @@ function(SDL_DetectCPUArchitecture)
|
||||
endforeach()
|
||||
endif()
|
||||
|
||||
set(sdl_known_archs x64 x86 arm64 arm32 emscripten powerpc32 powerpc64 loongarch64)
|
||||
set(sdl_known_archs x64 x86 arm64 arm32 emscripten powerpc64 powerpc32 loongarch64)
|
||||
if(NOT sdl_cpu_names)
|
||||
set(found FALSE)
|
||||
foreach(sdl_known_arch ${sdl_known_archs})
|
||||
|
@ -69,8 +69,8 @@ _m_prefetch(void *__P)
|
||||
# include <arm_neon.h>
|
||||
#endif
|
||||
#else
|
||||
/* altivec.h redefining bool causes a number of problems, see bugs 3993 and 4392, so you need to explicitly define SDL_ENABLE_ALTIVEC_H to have it included. */
|
||||
#if defined(HAVE_ALTIVEC_H) && defined(__ALTIVEC__) && !defined(__APPLE_ALTIVEC__) && defined(SDL_ENABLE_ALTIVEC_H)
|
||||
/* altivec.h redefining bool causes a number of problems, see bugs 3993 and 4392, so you need to explicitly define SDL_ENABLE_ALTIVEC to have it included. */
|
||||
#if defined(__ALTIVEC__) && defined(SDL_ENABLE_ALTIVEC)
|
||||
#include <altivec.h>
|
||||
#endif
|
||||
#if !defined(SDL_DISABLE_NEON)
|
||||
|
@ -215,7 +215,6 @@
|
||||
#cmakedefine HAVE_FLOAT_H 1
|
||||
#endif /* HAVE_LIBC */
|
||||
|
||||
#cmakedefine HAVE_ALTIVEC_H 1
|
||||
#cmakedefine HAVE_DBUS_DBUS_H 1
|
||||
#cmakedefine HAVE_FCITX 1
|
||||
#cmakedefine HAVE_IBUS_IBUS_H 1
|
||||
|
@ -186,6 +186,10 @@
|
||||
#include <SDL3/SDL.h>
|
||||
#include <SDL3/SDL_intrin.h>
|
||||
|
||||
#if defined(__ALTIVEC__) && defined(SDL_ENABLE_ALTIVEC)
|
||||
#define HAVE_ALTIVEC_INTRINSICS 1
|
||||
#endif
|
||||
|
||||
#if defined(__ARM_NEON) && !defined(SDL_DISABLE_NEON)
|
||||
#define HAVE_NEON_INTRINSICS 1
|
||||
#endif
|
||||
|
@ -46,9 +46,6 @@ enum blit_features
|
||||
};
|
||||
|
||||
#if SDL_ALTIVEC_BLITTERS
|
||||
#ifdef HAVE_ALTIVEC_H
|
||||
#include <altivec.h>
|
||||
#endif
|
||||
#ifdef __MACOS__
|
||||
#include <sys/sysctl.h>
|
||||
static size_t
|
||||
|
Loading…
x
Reference in New Issue
Block a user