[go: nahoru, domu]

Skip to content

Commit

Permalink
Disable CMake workaround when using 3.22+.
Browse files Browse the repository at this point in the history
Test: added a FATAL_ERROR log and checked with a TOT CMake
Bug: android/ndk#1581
Change-Id: Ic57323b1a4ac83ab02d29768932e67105c1fc2ed
  • Loading branch information
DanAlbert committed Sep 16, 2021
1 parent 02dfb02 commit d8fcfb2
Showing 1 changed file with 19 additions and 17 deletions.
36 changes: 19 additions & 17 deletions build/cmake/hooks/pre/Determine-Compiler.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -20,21 +20,23 @@ if(CMAKE_SYSTEM_VERSION EQUAL 1)
return()
endif()

# If we don't explicitly set the target CMake will ID the compiler using the
# default target, causing MINGW to be defined when a Windows host is used.
# https://github.com/android/ndk/issues/1581
# https://gitlab.kitware.com/cmake/cmake/-/issues/22647
if(CMAKE_ANDROID_ARCH_ABI STREQUAL armeabi-v7a)
set(ANDROID_LLVM_TRIPLE armv7-none-linux-androideabi)
elseif(CMAKE_ANDROID_ARCH_ABI STREQUAL arm64-v8a)
set(ANDROID_LLVM_TRIPLE aarch64-none-linux-android)
elseif(CMAKE_ANDROID_ARCH_ABI STREQUAL x86)
set(ANDROID_LLVM_TRIPLE i686-none-linux-android)
elseif(CMAKE_ANDROID_ARCH_ABI STREQUAL x86_64)
set(ANDROID_LLVM_TRIPLE x86_64-none-linux-android)
else()
message(FATAL_ERROR "Invalid Android ABI: ${ANDROID_ABI}.")
if(${CMAKE_VERSION} VERSION_LESS "3.22.0")
# If we don't explicitly set the target CMake will ID the compiler using the
# default target, causing MINGW to be defined when a Windows host is used.
# https://github.com/android/ndk/issues/1581
# https://gitlab.kitware.com/cmake/cmake/-/issues/22647
if(CMAKE_ANDROID_ARCH_ABI STREQUAL armeabi-v7a)
set(ANDROID_LLVM_TRIPLE armv7-none-linux-androideabi)
elseif(CMAKE_ANDROID_ARCH_ABI STREQUAL arm64-v8a)
set(ANDROID_LLVM_TRIPLE aarch64-none-linux-android)
elseif(CMAKE_ANDROID_ARCH_ABI STREQUAL x86)
set(ANDROID_LLVM_TRIPLE i686-none-linux-android)
elseif(CMAKE_ANDROID_ARCH_ABI STREQUAL x86_64)
set(ANDROID_LLVM_TRIPLE x86_64-none-linux-android)
else()
message(FATAL_ERROR "Invalid Android ABI: ${ANDROID_ABI}.")
endif()
set(CMAKE_ASM_COMPILER_TARGET "${ANDROID_LLVM_TRIPLE}${CMAKE_SYSTEM_VERSION}")
set(CMAKE_C_COMPILER_TARGET "${ANDROID_LLVM_TRIPLE}${CMAKE_SYSTEM_VERSION}")
set(CMAKE_CXX_COMPILER_TARGET "${ANDROID_LLVM_TRIPLE}${CMAKE_SYSTEM_VERSION}")
endif()
set(CMAKE_ASM_COMPILER_TARGET "${ANDROID_LLVM_TRIPLE}${CMAKE_SYSTEM_VERSION}")
set(CMAKE_C_COMPILER_TARGET "${ANDROID_LLVM_TRIPLE}${CMAKE_SYSTEM_VERSION}")
set(CMAKE_CXX_COMPILER_TARGET "${ANDROID_LLVM_TRIPLE}${CMAKE_SYSTEM_VERSION}")

0 comments on commit d8fcfb2

Please sign in to comment.