From c21d2dee3b40cb461db57fbbb64fb6cce74fd9c1 Mon Sep 17 00:00:00 2001 From: Herman Chen Date: Tue, 26 May 2020 20:37:23 +0800 Subject: [PATCH] [cmake]: Fix TOOLCHAIN_NAME error on aarch64 Change-Id: I2a56b86a716bfe2d2220e98d78126825e26ef19b Signed-off-by: Herman Chen --- build/android/android.toolchain.cmake | 6 +++--- build/android/env_setup.sh | 25 ++++++++++++------------- 2 files changed, 15 insertions(+), 16 deletions(-) diff --git a/build/android/android.toolchain.cmake b/build/android/android.toolchain.cmake index 9e24ee73..e4da1b30 100644 --- a/build/android/android.toolchain.cmake +++ b/build/android/android.toolchain.cmake @@ -1127,8 +1127,8 @@ if( APPLE ) endif() # Force set compilers because standard identification works badly for us -include( CMakeForceCompiler ) -CMAKE_FORCE_C_COMPILER( "${CMAKE_C_COMPILER}" GNU ) +#include( CMakeForceCompiler ) +#CMAKE_FORCE_C_COMPILER( "${CMAKE_C_COMPILER}" GNU ) if( ANDROID_COMPILER_IS_CLANG ) set( CMAKE_C_COMPILER_ID Clang ) endif() @@ -1140,7 +1140,7 @@ else() endif() set( CMAKE_C_HAS_ISYSROOT 1 ) set( CMAKE_C_COMPILER_ABI ELF ) -CMAKE_FORCE_CXX_COMPILER( "${CMAKE_CXX_COMPILER}" GNU ) +#CMAKE_FORCE_CXX_COMPILER( "${CMAKE_CXX_COMPILER}" GNU ) if( ANDROID_COMPILER_IS_CLANG ) set( CMAKE_CXX_COMPILER_ID Clang) endif() diff --git a/build/android/env_setup.sh b/build/android/env_setup.sh index 781a4272..cf7d8ad9 100755 --- a/build/android/env_setup.sh +++ b/build/android/env_setup.sh @@ -141,17 +141,26 @@ else if [ $NDK_VERSION -ge 16 ]; then TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake - TOOLCHAIN_NAME="arm-linux-androideabi-4.9" NATIVE_API_LEVEL="android-27" elif [ $NDK_VERSION -gt 12 ]; then TOOLCHAIN_FILE=${ANDROID_NDK}/build/cmake/android.toolchain.cmake - TOOLCHAIN_NAME="arm-linux-androideabi-4.9" NATIVE_API_LEVEL="android-21" elif [ $NDK_VERSION -le 12 ]; then TOOLCHAIN_FILE=../android.toolchain.cmake - TOOLCHAIN_NAME="arm-linux-androideabi-4.9" NATIVE_API_LEVEL="android-21" fi + + ################################################# + # Set platform tools + ################################################# + if [ "${ANDROID_ABI}" = "armeabi-v7a" ]; then + TOOLCHAIN_NAME="arm-linux-androideabi-4.9" + ANDROID_ABI="armeabi-v7a with NEON" + PLATFORM=$ANDROID_NDK/platforms/${NATIVE_API_LEVEL}/arch-arm + elif [ "${ANDROID_ABI}" = "arm64-v8a" ]; then + TOOLCHAIN_NAME="aarch64-linux-android-4.9" + PLATFORM=$ANDROID_NDK/platforms/${NATIVE_API_LEVEL}/arch-arm64 + fi fi if [ "${FOUND_NDK}" = "0" ]; then @@ -163,13 +172,3 @@ else echo "toolchain name: $TOOLCHAIN_NAME" echo "api level: $NATIVE_API_LEVEL" fi - -################################################# -# Set platform tools -################################################# -if [ "${ANDROID_ABI}" = "armeabi-v7a" ]; then - ANDROID_ABI="armeabi-v7a with NEON" - PLATFORM=$ANDROID_NDK/platforms/${NATIVE_API_LEVEL}/arch-arm -elif [ "${ANDROID_ABI}" = "arm64-v8a" ]; then - PLATFORM=$ANDROID_NDK/platforms/${NATIVE_API_LEVEL}/arch-arm64 -fi