mirror of
https://github.com/libsdl-org/SDL.git
synced 2025-12-17 12:44:35 +08:00
cmake: detect cpu architecture in SDL_DetectCPUArchitecture
Stop looking for arch, when one is found
This commit is contained in:
committed by
Anonymous Maarten
parent
9cf34908a1
commit
19d162281c
@@ -53,3 +53,24 @@ macro(SDL_DetectCMakePlatform)
|
||||
set(${SDL_CMAKE_PLATFORM} TRUE)
|
||||
endif()
|
||||
endmacro()
|
||||
|
||||
function(SDL_DetectCPUArchitecture)
|
||||
set(archs x86 x64 arm32 arm64 loongarch64)
|
||||
set(found FALSE)
|
||||
foreach(arch ${archs})
|
||||
string(TOUPPER "${arch}" arch_upper)
|
||||
set(var_name "SDL_CPU_${arch_upper}")
|
||||
if(found)
|
||||
set(${var_name} 0 PARENT_SCOPE)
|
||||
else()
|
||||
check_cpu_architecture(${arch} ${var_name})
|
||||
set(found ${${var_name}})
|
||||
set(${var_name} ${${var_name}} PARENT_SCOPE)
|
||||
set(SDL_CPU_NAME ${arch})
|
||||
endif()
|
||||
endforeach()
|
||||
if(NOT found)
|
||||
message(AUTHOR_WARNING "Unknown architecture (failed archs=${archs})")
|
||||
set(SDL_CPU_NAME "(unknown)")
|
||||
endif()
|
||||
endfunction()
|
||||
|
||||
Reference in New Issue
Block a user