diff --git a/infra/nnfw/cmake/buildtool/cross/toolchain_aarch64-android.cmake b/infra/nnfw/cmake/buildtool/cross/toolchain_aarch64-android.cmake index b304543e6cf..95f075b5cef 100644 --- a/infra/nnfw/cmake/buildtool/cross/toolchain_aarch64-android.cmake +++ b/infra/nnfw/cmake/buildtool/cross/toolchain_aarch64-android.cmake @@ -14,7 +14,6 @@ set(ANDROID_ABI arm64-v8a) set(ANDROID_API_LEVEL 29) set(ANDROID_PLATFORM android-${ANDROID_API_LEVEL}) set(ANDROID_STL c++_shared) -set(ANDROID_STL_LIB "${NDK_DIR}/sources/cxx-stl/llvm-libc++/libs/arm64-v8a/libc++_shared.so") # Find package in the host. `nnfw_find_package` won't work without this # Others (library, path) will follow android.toolchain.cmake settings @@ -23,6 +22,8 @@ set(CMAKE_FIND_ROOT_PATH_MODE_PACKAGE NEVER) # Use the toolchain file that NDK provides include(${NDK_DIR}/build/cmake/android.toolchain.cmake) +find_library(ANDROID_STL_LIB c++_shared PATHS /usr/lib/${CMAKE_LIBRARY_ARCHITECTURE}) + # Install libc++_shared.so to lib folder install(FILES ${ANDROID_STL_LIB} DESTINATION lib) diff --git a/infra/nnfw/cmake/packages/ARMComputeConfig.cmake b/infra/nnfw/cmake/packages/ARMComputeConfig.cmake index fa5c851ba3e..e55a0f4aebd 100644 --- a/infra/nnfw/cmake/packages/ARMComputeConfig.cmake +++ b/infra/nnfw/cmake/packages/ARMComputeConfig.cmake @@ -163,8 +163,14 @@ function(_ARMCompute_Build ARMComputeInstall_DIR) set(SCONS_CC "gcc") set(SCONS_CXX "g++") + # Refer https://android.googlesource.com/platform/external/armnn/+/HEAD/BuildGuideAndroidNDK.md#build-arm-compute-library if(ANDROID) - list(APPEND SCONS_OPTIONS "toolchain_prefix=${ANDROID_TOOLCHAIN_PREFIX}") + if(ANDROID_NDK_MAJOR LESS 22) + # Use legacy toolchain + list(APPEND SCONS_OPTIONS "toolchain_prefix=${ANDROID_TOOLCHAIN_PREFIX}") + else(ANDROID_NDK_MAJOR LESS 22) + list(APPEND SCONS_OPTIONS "toolchain_prefix=${ANDROID_TOOLCHAIN_ROOT}/bin/llvm-") + endif(ANDROID_NDK_MAJOR LESS 22) list(APPEND SCONS_OPTIONS "compiler_prefix=${ANDROID_TOOLCHAIN_ROOT}/bin/aarch64-linux-android${ANDROID_API_LEVEL}-") set(SCONS_CC "clang") set(SCONS_CXX "clang++")