Skip to content

Commit

Permalink
Support set ARCH for ios/android
Browse files Browse the repository at this point in the history
  • Loading branch information
owent committed Apr 15, 2021
1 parent 4126e6c commit 323c4bb
Showing 1 changed file with 14 additions and 10 deletions.
24 changes: 14 additions & 10 deletions src/libcopp/fcontext/detect/fcontext.detect.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -7,23 +7,27 @@ if(NOT LIBCOPP_FCONTEXT_OS_PLATFORM)
if(NOT CMAKE_SYSTEM_PROCESSOR)
set(CMAKE_SYSTEM_PROCESSOR ${CMAKE_HOST_SYSTEM_PROCESSOR})
endif()
string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} LIBCOPP_FCONTEXT_OS_PLATFORM)
if(LIBCOPP_FCONTEXT_OS_PLATFORM STREQUAL "unknown"
OR LIBCOPP_FCONTEXT_OS_PLATFORM STREQUAL "i386"
OR LIBCOPP_FCONTEXT_OS_PLATFORM STREQUAL "i686"
OR LIBCOPP_FCONTEXT_OS_PLATFORM STREQUAL "x86_64"
OR LIBCOPP_FCONTEXT_OS_PLATFORM STREQUAL "amd64")
if(ANDROID)
if(CMAKE_ANDROID_ARCH_ABI)
string(TOLOWER ${CMAKE_ANDROID_ARCH_ABI} LIBCOPP_FCONTEXT_OS_PLATFORM)
elseif(ANDROID_ABI)
string(TOLOWER ${ANDROID_ABI} LIBCOPP_FCONTEXT_OS_PLATFORM)
endif()
elseif(CMAKE_OSX_ARCHITECTURES)
string(TOLOWER ${CMAKE_OSX_ARCHITECTURES} LIBCOPP_FCONTEXT_OS_PLATFORM)
endif()
if(NOT LIBCOPP_FCONTEXT_OS_PLATFORM)
string(TOLOWER ${CMAKE_SYSTEM_PROCESSOR} LIBCOPP_FCONTEXT_OS_PLATFORM)
endif()
if(LIBCOPP_FCONTEXT_OS_PLATFORM MATCHES "unknown|i386|i686|x86_64|amd64")
if(CMAKE_SIZEOF_VOID_P MATCHES 8)
set(CMAKE_SYSTEM_PROCESSOR "x86_64")
set(LIBCOPP_FCONTEXT_OS_PLATFORM "x86_64")
else()
set(CMAKE_SYSTEM_PROCESSOR "i386")
set(LIBCOPP_FCONTEXT_OS_PLATFORM "i386")
endif()
elseif(
LIBCOPP_FCONTEXT_OS_PLATFORM MATCHES "^armv5"
OR LIBCOPP_FCONTEXT_OS_PLATFORM MATCHES "^armv7"
OR LIBCOPP_FCONTEXT_OS_PLATFORM MATCHES "^armeabi")
elseif(LIBCOPP_FCONTEXT_OS_PLATFORM MATCHES "^arm(v5|v7|v7s|eabi)")
set(LIBCOPP_FCONTEXT_OS_PLATFORM "arm")
elseif(LIBCOPP_FCONTEXT_OS_PLATFORM MATCHES "^arm64" OR LIBCOPP_FCONTEXT_OS_PLATFORM MATCHES "^aarch64")
set(LIBCOPP_FCONTEXT_OS_PLATFORM "arm64")
Expand Down

0 comments on commit 323c4bb

Please sign in to comment.