Support custom Android NDK, better ABI specification (#4986)

This commit is contained in:
Bradley Austin Davis 2018-12-17 16:45:09 -08:00 committed by Robert Schumacher
parent c094d3133c
commit b2996e1fd4
2 changed files with 14 additions and 1 deletions

View File

@ -1,11 +1,22 @@
set(ANDROID_CPP_FEATURES "rtti exceptions" CACHE STRING "")
set(CMAKE_SYSTEM_NAME Android CACHE STRING "")
set(ANDROID_ABI x86_64 CACHE STRING "")
set(ANDROID_TOOLCHAIN clang CACHE STRING "")
set(ANDROID_NATIVE_API_LEVEL 21 CACHE STRING "")
set(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION clang CACHE STRING "")
if (VCPKG_TARGET_TRIPLET STREQUAL "arm64-android")
set(ANDROID_ABI arm64-v8a CACHE STRING "")
elseif(VCPKG_TARGET_TRIPLET STREQUAL "arm-android")
set(ANDROID_ABI armeabi-v7a CACHE STRING "")
elseif(VCPKG_TARGET_TRIPLET STREQUAL "x64-android")
set(ANDROID_ABI x86_64 CACHE STRING "")
elseif(VCPKG_TARGET_TRIPLET STREQUAL "x86-android")
set(ANDROID_ABI x86 CACHE STRING "")
else()
message(FATAL_ERROR "Unknown ABI for target triplet ${VCPKG_TARGET_TRIPLET}")
endif()
if(DEFINED ENV{ANDROID_NDK_HOME})
set(ANDROID_NDK_HOME $ENV{ANDROID_NDK_HOME})
else()

View File

@ -170,6 +170,8 @@ namespace vcpkg::System
L"NVCUDASAMPLES_ROOT",
// Enables find_package(Vulkan) in CMake. Environmental variable generated by Vulkan SDK installer
L"VULKAN_SDK",
// Enable targeted Android NDK
L"ANDROID_NDK_HOME",
};
std::wstring env_cstr;