mdbx-cmake: rework forming of MDBX_SYSTEM_ARCH identity.

This commit is contained in:
Леонид Юрьев (Leonid Yuriev) 2022-04-22 17:26:25 +03:00
parent 5eeb260c08
commit 039ebe1f14

View File

@ -182,42 +182,63 @@ if(NOT DEFINED CMAKE_TARGET_BITNESS)
endif() endif()
endif() endif()
if(CMAKE_COMPILER_IS_ELBRUSC OR CMAKE_COMPILER_IS_ELBRUSCXX OR CMAKE_SYSTEM_PROCESSOR MATCHES "e2k.*|E2K.*|elbrus.*|ELBRUS.*") if(NOT CMAKE_SYSTEM_ARCH)
set(E2K TRUE) if(CMAKE_${CMAKE_PRIMARY_LANG}_COMPILER_ARCHITECTURE_ID)
set(CMAKE_SYSTEM_ARCH "Elbrus") set(CMAKE_SYSTEM_ARCH "${CMAKE_${CMAKE_PRIMARY_LANG}_COMPILER_ARCHITECTURE_ID}")
elseif((MSVC64 OR MINGW64) AND CMAKE_TARGET_BITNESS EQUAL 64) elseif(CMAKE_ANDROID_ARCH_ABI)
set(X86_64 TRUE) set(CMAKE_SYSTEM_ARCH "${CMAKE_ANDROID_ARCH_ABI}")
set(CMAKE_SYSTEM_ARCH "x86_64") elseif(CMAKE_COMPILER_IS_ELBRUSC OR CMAKE_COMPILER_IS_ELBRUSCXX
elseif(MINGW OR (MSVC AND NOT CMAKE_CROSSCOMPILING)) OR CMAKE_${CMAKE_PRIMARY_LANG}_COMPILER_ID STREQUAL "LCC"
set(X86_32 TRUE) OR CMAKE_SYSTEM_PROCESSOR MATCHES "e2k.*|E2K.*|elbrus.*|ELBRUS.*")
set(CMAKE_SYSTEM_ARCH "x86") set(E2K TRUE)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|x86_64.*|AMD64.*" AND CMAKE_TARGET_BITNESS EQUAL 64) set(CMAKE_SYSTEM_ARCH "Elbrus")
set(X86_64 TRUE) elseif(MSVC64 OR MINGW64 OR MINGW OR (MSVC AND NOT CMAKE_CROSSCOMPILING))
set(CMAKE_SYSTEM_ARCH "x86_64") if(CMAKE_TARGET_BITNESS EQUAL 64)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "i686.*|i386.*|x86.*") set(X86_64 TRUE)
set(X86_32 TRUE) set(CMAKE_SYSTEM_ARCH "x86_64")
set(CMAKE_SYSTEM_ARCH "x86") else()
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch64.*|AARCH64.*|ARM64.*)" AND CMAKE_TARGET_BITNESS EQUAL 64) set(X86_32 TRUE)
set(AARCH64 TRUE) set(CMAKE_SYSTEM_ARCH "x86")
set(CMAKE_SYSTEM_ARCH "ARM64") endif()
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(arm.*|ARM.*)") elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "amd64.*|[xXiI]86_64.*|AMD64.*|[iI][3-6]86.*|[xXiI]86.*")
set(ARM32 TRUE) if(CMAKE_TARGET_BITNESS EQUAL 64)
set(CMAKE_SYSTEM_ARCH "ARM") set(X86_64 TRUE)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64le.*" AND CMAKE_TARGET_BITNESS EQUAL 64) set(CMAKE_SYSTEM_ARCH "x86_64")
set(PPC64LE TRUE) else()
set(CMAKE_SYSTEM_ARCH "PPC64LE") set(X86_32 TRUE)
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc)64.*" AND CMAKE_TARGET_BITNESS EQUAL 64) set(CMAKE_SYSTEM_ARCH "x86")
set(PPC64 TRUE) endif()
set(CMAKE_SYSTEM_ARCH "PPC64") elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(aarch.*|AARCH.*|arm.*|ARM.*)")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc).*") if(CMAKE_TARGET_BITNESS EQUAL 64)
set(PPC32 TRUE) set(AARCH64 TRUE)
set(CMAKE_SYSTEM_ARCH "PPC") set(CMAKE_SYSTEM_ARCH "ARM64")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(mips|MIPS)64.*" AND CMAKE_TARGET_BITNESS EQUAL 64) else()
set(MIPS64 TRUE) set(ARM32 TRUE)
set(CMAKE_SYSTEM_ARCH "MIPS64") set(CMAKE_SYSTEM_ARCH "ARM")
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(mips|MIPS).*") endif()
set(MIPS32 TRUE) elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(powerpc|ppc).*")
set(CMAKE_SYSTEM_ARCH "MIPS") if(CMAKE_TARGET_BITNESS EQUAL 64)
set(PPC64 TRUE)
set(CMAKE_SYSTEM_ARCH "PPC64")
else()
set(PPC32 TRUE)
set(CMAKE_SYSTEM_ARCH "PPC")
endif()
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^(mips|MIPS).*")
if(CMAKE_TARGET_BITNESS EQUAL 64)
set(MIPS64 TRUE)
set(CMAKE_SYSTEM_ARCH "MIPS64")
else()
set(MIPS32 TRUE)
set(CMAKE_SYSTEM_ARCH "MIPS")
endif()
endif()
endif()
if(CMAKE_C_COMPILER_LOADED AND NOT CMAKE_C_COMPILER_ARCHITECTURE_ID)
set(CMAKE_C_COMPILER_ARCHITECTURE_ID "${CMAKE_SYSTEM_ARCH}")
endif()
if(CMAKE_CXX_COMPILER_LOADED AND NOT CMAKE_CXX_COMPILER_ARCHITECTURE_ID)
set(CMAKE_CXX_COMPILER_ARCHITECTURE_ID "${CMAKE_SYSTEM_ARCH}")
endif() endif()
if(MSVC) if(MSVC)