CMake: Simplify platform detection a bit

This commit is contained in:
Connor McLaughlin 2021-05-26 13:25:13 +10:00
parent deb7f0741a
commit 3ab7dcff82

View file

@ -239,13 +239,12 @@ endif()
# Detect processor type. # Detect processor type.
if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "amd64") if(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86_64" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "amd64" OR
set(CPU_ARCH "x64") ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64")
elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "AMD64")
# MSVC x86/x64
if(CMAKE_SIZEOF_VOID_P EQUAL 8) if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(CPU_ARCH "x64") set(CPU_ARCH "x64")
else() else()
# Cross-compiling 32-bit build. 32-bit hosts are not supported.
set(CPU_ARCH "x86") set(CPU_ARCH "x86")
endif() endif()
elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i386" OR elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "i386" OR
@ -253,7 +252,8 @@ elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "x86" OR ${CMAKE_SYSTEM_PROCESSOR} STR
set(CPU_ARCH "x86") set(CPU_ARCH "x86")
elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm64") elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "aarch64" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm64")
set(CPU_ARCH "aarch64") set(CPU_ARCH "aarch64")
elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "armv7-a" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "armv7l") elseif(${CMAKE_SYSTEM_PROCESSOR} STREQUAL "arm" OR ${CMAKE_SYSTEM_PROCESSOR} STREQUAL "armv7-a" OR
${CMAKE_SYSTEM_PROCESSOR} STREQUAL "armv7l")
set(CPU_ARCH "aarch32") set(CPU_ARCH "aarch32")
if(ANDROID) if(ANDROID)
# Force ARM mode, since apparently ANDROID_ARM_MODE isn't working.. # Force ARM mode, since apparently ANDROID_ARM_MODE isn't working..