mirror of
https://github.com/shadps4-emu/ext-SDL.git
synced 2024-11-24 02:29:43 +00:00
cmake: detect rdtsc in CMake
This commit is contained in:
parent
e2f51bf38e
commit
97c3077678
@ -370,6 +370,7 @@ set_option(SDL_ASSEMBLY "Enable assembly routines" ${SDL_ASSEMBLY_DEF
|
||||
dep_option(SDL_AVX "Use AVX assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
|
||||
dep_option(SDL_AVX2 "Use AVX2 assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
|
||||
dep_option(SDL_AVX512 "Use AVX512 assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
|
||||
dep_option(SDL_RDTSC "Use RDTSC assembly routine(s)" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
|
||||
dep_option(SDL_SSE "Use SSE assembly routines" ON "SDL_ASSEMBLY;SDL_CPU_X86 OR SDL_CPU_X64" OFF)
|
||||
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)
|
||||
@ -714,6 +715,20 @@ endif()
|
||||
if(SDL_ASSEMBLY)
|
||||
set(HAVE_ASSEMBLY TRUE)
|
||||
|
||||
if(SDL_RDTSC)
|
||||
check_c_source_compiles("
|
||||
#if defined(_MSC_VER)
|
||||
# include <intrin.h>
|
||||
#else
|
||||
# include <x86intrin.h>
|
||||
#endif
|
||||
int main(int argc, char *argv[]) {
|
||||
return (int)__rdtsc();
|
||||
}" COMPILER_SUPPORTS_RDTSC)
|
||||
if(COMPILER_SUPPORTS_RDTSC)
|
||||
set(HAVE_RDTSC TRUE)
|
||||
endif()
|
||||
endif()
|
||||
if(SDL_MMX)
|
||||
cmake_push_check_state()
|
||||
if(USE_GCC OR USE_CLANG)
|
||||
@ -1028,6 +1043,10 @@ if(SDL_ASSEMBLY)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(NOT HAVE_RDTSC)
|
||||
set(SDL_DISABLE_RDTSC 1)
|
||||
endif()
|
||||
|
||||
if(NOT HAVE_MMX)
|
||||
set(SDL_DISABLE_MMX 1)
|
||||
endif()
|
||||
|
@ -585,6 +585,7 @@ typedef unsigned int uintptr_t;
|
||||
#endif /* !_STDINT_H_ && !HAVE_STDINT_H */
|
||||
|
||||
/* Configure use of intrinsics */
|
||||
#cmakedefine SDL_DISABLE_RDTSC 1
|
||||
#cmakedefine SDL_DISABLE_SSE 1
|
||||
#cmakedefine SDL_DISABLE_SSE2 1
|
||||
#cmakedefine SDL_DISABLE_SSE3 1
|
||||
|
Loading…
Reference in New Issue
Block a user