From cd616447dabd27db409f9899f696cbbb08d44ba3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=D0=9B=D0=B5=D0=BE=D0=BD=D0=B8=D0=B4=20=D0=AE=D1=80=D1=8C?= =?UTF-8?q?=D0=B5=D0=B2=20=28Leonid=20Yuriev=29?= Date: Sat, 15 Oct 2022 20:49:39 +0300 Subject: [PATCH] mdbx-cmake: set X86_32/X86_64/ARM/MIPS for Windows and Android. --- cmake/compiler.cmake | 31 ++++++++++++++++++++++++++++++- 1 file changed, 30 insertions(+), 1 deletion(-) diff --git a/cmake/compiler.cmake b/cmake/compiler.cmake index 842c8016..ef308fc2 100644 --- a/cmake/compiler.cmake +++ b/cmake/compiler.cmake @@ -203,9 +203,38 @@ endif() if(NOT CMAKE_SYSTEM_ARCH) if(CMAKE_${CMAKE_PRIMARY_LANG}_COMPILER_ARCHITECTURE_ID) - set(CMAKE_SYSTEM_ARCH "${CMAKE_${CMAKE_PRIMARY_LANG}_COMPILER_ARCHITECTURE_ID}") + string(TOLOWER "${CMAKE_${CMAKE_PRIMARY_LANG}_COMPILER_ARCHITECTURE_ID}" CMAKE_SYSTEM_ARCH) + if(CMAKE_SYSTEM_ARCH STREQUAL "x86") + set(X86_32 TRUE) + elseif(CMAKE_SYSTEM_ARCH STREQUAL "x86_64" OR CMAKE_SYSTEM_ARCH STREQUAL "x64") + set(X86_64 TRUE) + set(CMAKE_SYSTEM_ARCH "x86_64") + elseif(CMAKE_SYSTEM_ARCH MATCHES "^(aarch.*|arm.*)") + if(CMAKE_TARGET_BITNESS EQUAL 64) + set(AARCH64 TRUE) + else() + set(ARM32 TRUE) + endif() + endif() elseif(CMAKE_ANDROID_ARCH_ABI) set(CMAKE_SYSTEM_ARCH "${CMAKE_ANDROID_ARCH_ABI}") + if(CMAKE_SYSTEM_ARCH STREQUAL "x86") + set(X86_32 TRUE) + elseif(CMAKE_SYSTEM_ARCH STREQUAL "x86_64") + set(X86_64 TRUE) + elseif(CMAKE_SYSTEM_ARCH MATCHES "^(aarch.*|AARCH.*|arm.*|ARM.*)") + if(CMAKE_TARGET_BITNESS EQUAL 64) + set(AARCH64 TRUE) + else() + set(ARM32 TRUE) + endif() + elseif(CMAKE_SYSTEM_ARCH MATCHES "^(mips|MIPS).*") + if(CMAKE_TARGET_BITNESS EQUAL 64) + set(MIPS64 TRUE) + else() + set(MIPS32 TRUE) + endif() + endif() elseif(CMAKE_COMPILER_IS_ELBRUSC OR CMAKE_COMPILER_IS_ELBRUSCXX OR CMAKE_${CMAKE_PRIMARY_LANG}_COMPILER_ID STREQUAL "LCC" OR CMAKE_SYSTEM_PROCESSOR MATCHES "e2k.*|E2K.*|elbrus.*|ELBRUS.*")