2018-03-06 10:07:39 -08:00
|
|
|
set(ANDROID_CPP_FEATURES "rtti exceptions" CACHE STRING "")
|
|
|
|
set(CMAKE_SYSTEM_NAME Android CACHE STRING "")
|
|
|
|
set(ANDROID_TOOLCHAIN clang CACHE STRING "")
|
2020-11-19 00:45:05 +01:00
|
|
|
set(ANDROID_NATIVE_API_LEVEL ${CMAKE_SYSTEM_VERSION} CACHE STRING "")
|
2021-12-07 05:15:20 +01:00
|
|
|
if(CMAKE_SYSTEM_VERSION MATCHES "^[0-9]+$")
|
|
|
|
set(ANDROID_PLATFORM android-${CMAKE_SYSTEM_VERSION} CACHE STRING "")
|
|
|
|
else()
|
|
|
|
set(ANDROID_PLATFORM ${CMAKE_SYSTEM_VERSION} CACHE STRING "")
|
|
|
|
endif()
|
2018-03-06 10:07:39 -08:00
|
|
|
set(CMAKE_ANDROID_NDK_TOOLCHAIN_VERSION clang CACHE STRING "")
|
|
|
|
|
2020-05-12 04:42:08 +08:00
|
|
|
if (VCPKG_CRT_LINKAGE STREQUAL "dynamic")
|
|
|
|
set(ANDROID_STL c++_shared CACHE STRING "")
|
|
|
|
else()
|
|
|
|
set(ANDROID_STL c++_static CACHE STRING "")
|
|
|
|
endif()
|
|
|
|
|
2018-07-03 15:20:13 +02:00
|
|
|
if(DEFINED ENV{ANDROID_NDK_HOME})
|
|
|
|
set(ANDROID_NDK_HOME $ENV{ANDROID_NDK_HOME})
|
|
|
|
else()
|
2021-05-05 23:32:47 +03:00
|
|
|
set(ANDROID_NDK_HOME "$ENV{ProgramData}/Microsoft/AndroidNDK64/android-ndk-r13b/")
|
|
|
|
if(NOT EXISTS "${ANDROID_NDK_HOME}")
|
|
|
|
# Use Xamarin default installation folder
|
|
|
|
set(ANDROID_NDK_HOME "$ENV{ProgramFiles\(x86\)}/Android/android-sdk/ndk-bundle")
|
|
|
|
endif()
|
2018-03-06 10:07:39 -08:00
|
|
|
endif()
|
|
|
|
|
2018-07-03 15:20:13 +02:00
|
|
|
if(NOT EXISTS "${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake")
|
|
|
|
message(FATAL_ERROR "Could not find android ndk. Searched at ${ANDROID_NDK_HOME}")
|
|
|
|
endif()
|
|
|
|
|
|
|
|
include("${ANDROID_NDK_HOME}/build/cmake/android.toolchain.cmake")
|
2018-11-14 15:11:41 -08:00
|
|
|
|
|
|
|
if(NOT _VCPKG_ANDROID_TOOLCHAIN)
|
2021-05-05 23:32:47 +03:00
|
|
|
set(_VCPKG_ANDROID_TOOLCHAIN 1)
|
2024-06-19 23:38:36 +02:00
|
|
|
|
|
|
|
if(POLICY CMP0056)
|
|
|
|
cmake_policy(SET CMP0056 NEW)
|
|
|
|
endif()
|
|
|
|
if(POLICY CMP0066)
|
|
|
|
cmake_policy(SET CMP0066 NEW)
|
|
|
|
endif()
|
|
|
|
if(POLICY CMP0067)
|
|
|
|
cmake_policy(SET CMP0067 NEW)
|
2021-05-05 23:32:47 +03:00
|
|
|
endif()
|
2024-06-19 23:38:36 +02:00
|
|
|
if(POLICY CMP0137)
|
|
|
|
cmake_policy(SET CMP0137 NEW)
|
|
|
|
endif()
|
|
|
|
list(APPEND CMAKE_TRY_COMPILE_PLATFORM_VARIABLES
|
|
|
|
VCPKG_CRT_LINKAGE VCPKG_TARGET_ARCHITECTURE
|
|
|
|
VCPKG_C_FLAGS VCPKG_CXX_FLAGS
|
|
|
|
VCPKG_C_FLAGS_DEBUG VCPKG_CXX_FLAGS_DEBUG
|
|
|
|
VCPKG_C_FLAGS_RELEASE VCPKG_CXX_FLAGS_RELEASE
|
|
|
|
VCPKG_LINKER_FLAGS VCPKG_LINKER_FLAGS_RELEASE VCPKG_LINKER_FLAGS_DEBUG
|
|
|
|
)
|
|
|
|
|
|
|
|
string(APPEND CMAKE_C_FLAGS " -fPIC ${VCPKG_C_FLAGS} ")
|
|
|
|
string(APPEND CMAKE_CXX_FLAGS " -fPIC ${VCPKG_CXX_FLAGS} ")
|
|
|
|
string(APPEND CMAKE_C_FLAGS_DEBUG " ${VCPKG_C_FLAGS_DEBUG} ")
|
|
|
|
string(APPEND CMAKE_CXX_FLAGS_DEBUG " ${VCPKG_CXX_FLAGS_DEBUG} ")
|
|
|
|
string(APPEND CMAKE_C_FLAGS_RELEASE " ${VCPKG_C_FLAGS_RELEASE} ")
|
|
|
|
string(APPEND CMAKE_CXX_FLAGS_RELEASE " ${VCPKG_CXX_FLAGS_RELEASE} ")
|
|
|
|
|
|
|
|
string(APPEND CMAKE_MODULE_LINKER_FLAGS " ${VCPKG_LINKER_FLAGS} ")
|
|
|
|
string(APPEND CMAKE_SHARED_LINKER_FLAGS " ${VCPKG_LINKER_FLAGS} ")
|
|
|
|
string(APPEND CMAKE_EXE_LINKER_FLAGS " ${VCPKG_LINKER_FLAGS} ")
|
|
|
|
string(APPEND CMAKE_MODULE_LINKER_FLAGS_DEBUG " ${VCPKG_LINKER_FLAGS_DEBUG} ")
|
|
|
|
string(APPEND CMAKE_SHARED_LINKER_FLAGS_DEBUG " ${VCPKG_LINKER_FLAGS_DEBUG} ")
|
|
|
|
string(APPEND CMAKE_EXE_LINKER_FLAGS_DEBUG " ${VCPKG_LINKER_FLAGS_DEBUG} ")
|
|
|
|
string(APPEND CMAKE_MODULE_LINKER_FLAGS_RELEASE " ${VCPKG_LINKER_FLAGS_RELEASE} ")
|
|
|
|
string(APPEND CMAKE_SHARED_LINKER_FLAGS_RELEASE " ${VCPKG_LINKER_FLAGS_RELEASE} ")
|
|
|
|
string(APPEND CMAKE_EXE_LINKER_FLAGS_RELEASE " ${VCPKG_LINKER_FLAGS_RELEASE} ")
|
2018-11-14 15:11:41 -08:00
|
|
|
endif()
|