Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cmake: simplify if expressions, accept CPU values more consistently #938

Merged
merged 2 commits into from
Nov 8, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
38 changes: 19 additions & 19 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -333,50 +333,50 @@ if(APPLE AND (NOT CMAKE_OSX_ARCHITECTURES STREQUAL ""))
set(CMAKE_SYSTEM_PROCESSOR "${CMAKE_OSX_ARCHITECTURES}")
endif()

if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(aarch64|arm64|ARM64)")
if(CMAKE_SYSTEM_PROCESSOR MATCHES "(aarch64|arm64|ARM64)")
set(HOST_AARCH64 true)
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm")
set(HOST_ARM true)
elseif("${CMAKE_SYSTEM_NAME}" STREQUAL "SunOS" AND "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i386")
elseif(CMAKE_SYSTEM_NAME STREQUAL "SunOS" AND CMAKE_SYSTEM_PROCESSOR MATCHES "i386")
set(HOST_X86_64 true)
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(x86_64|amd64|AMD64)")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64|amd64|AMD64)")
set(HOST_X86_64 true)
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(i[3-6]86|[xX]86)")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "(i[3-6]86|[xX]86)")
set(ENABLE_ASM false)
set(HOST_I386 true)
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "mips64")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "mips64")
set(HOST_MIPS64 true)
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "mips")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "mips")
set(HOST_MIPS true)
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "powerpc")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "powerpc")
set(HOST_POWERPC true)
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "ppc64")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "ppc64")
set(HOST_PPC64 true)
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "riscv64")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "riscv64")
set(HOST_RISCV64 true)
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "sparc64")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "sparc64")
set(HOST_SPARC64 true)
else()
set(ENABLE_ASM false)
endif()

if(ENABLE_ASM)
if("${CMAKE_C_COMPILER_ABI}" STREQUAL "ELF")
if("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "(x86_64|amd64)")
if(CMAKE_C_COMPILER_ABI STREQUAL "ELF")
if(CMAKE_SYSTEM_PROCESSOR MATCHES "(x86_64|amd64)")
set(HOST_ASM_ELF_X86_64 true)
elseif("${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm" AND
NOT "${CMAKE_SYSTEM_PROCESSOR}" MATCHES "arm64")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "arm" AND
NOT CMAKE_SYSTEM_PROCESSOR MATCHES "arm64")
set(HOST_ASM_ELF_ARMV4 true)
elseif(CMAKE_SYSTEM_NAME STREQUAL "SunOS" AND "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "i386")
elseif(CMAKE_SYSTEM_NAME STREQUAL "SunOS" AND CMAKE_SYSTEM_PROCESSOR MATCHES "i386")
set(HOST_ASM_ELF_X86_64 true)
endif()
add_definitions(-DHAVE_GNU_STACK)
elseif(APPLE AND "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
elseif(APPLE AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
set(HOST_ASM_MACOSX_X86_64 true)
elseif(MSVC AND ("${CMAKE_GENERATOR}" MATCHES "Win64" OR "${CMAKE_GENERATOR_PLATFORM}" STREQUAL "x64"))
elseif(MSVC AND (CMAKE_GENERATOR MATCHES "Win64" OR CMAKE_GENERATOR_PLATFORM STREQUAL "x64"))
set(HOST_ASM_MASM_X86_64 true)
ENABLE_LANGUAGE(ASM_MASM)
elseif(MINGW AND "${CMAKE_SYSTEM_PROCESSOR}" STREQUAL "x86_64")
elseif(MINGW AND CMAKE_SYSTEM_PROCESSOR MATCHES "x86_64")
set(HOST_ASM_MINGW64_X86_64 true)
endif()
endif()
Expand Down