aboutsummaryrefslogtreecommitdiff
path: root/contrib/depends/toolchain.cmake.in
diff options
context:
space:
mode:
authorHoward Chu <hyc@symas.com>2019-11-01 03:38:13 +0000
committerHoward Chu <hyc@symas.com>2019-11-03 21:16:56 +0000
commitd904ffbaca6aa75ed5f410872a714bf2fd46a00c (patch)
treec8414b27be7c20b916149a4585e0453a673eae57 /contrib/depends/toolchain.cmake.in
parentMerge pull request #6079 (diff)
downloadmonero-d904ffbaca6aa75ed5f410872a714bf2fd46a00c.tar.xz
Add Android support
Diffstat (limited to '')
-rw-r--r--contrib/depends/toolchain.cmake.in36
1 files changed, 31 insertions, 5 deletions
diff --git a/contrib/depends/toolchain.cmake.in b/contrib/depends/toolchain.cmake.in
index ebe96b69c..0728515e3 100644
--- a/contrib/depends/toolchain.cmake.in
+++ b/contrib/depends/toolchain.cmake.in
@@ -1,4 +1,4 @@
-# Set the system name, either Darwin, Linux, or Windows
+# Set the system name to one of Android, Darwin, Linux, or Windows
SET(CMAKE_SYSTEM_NAME @depends@)
SET(CMAKE_BUILD_TYPE @release_type@)
@@ -18,13 +18,14 @@ SET(CMAKE_FIND_ROOT_PATH @prefix@ /usr)
SET(ENV{PKG_CONFIG_PATH} @prefix@/lib/pkgconfig)
-SET(LRELEASE_PATH @prefix@/native/bin CACHE FILEPATH "path to lrelease" FORCE)
-
SET(Readline_ROOT_DIR @prefix@)
SET(Readline_INCLUDE_DIR @prefix@/include)
SET(Readline_LIBRARY @prefix@/lib/libreadline.a)
SET(Termcap_LIBRARY @prefix@/lib/libtinfo.a)
+if(NOT CMAKE_SYSTEM_NAME STREQUAL "Android")
+SET(LRELEASE_PATH @prefix@/native/bin CACHE FILEPATH "path to lrelease" FORCE)
+
SET(LIBUNWIND_INCLUDE_DIR @prefix@/include)
SET(LIBUNWIND_LIBRARIES @prefix@/lib/libunwind.a)
SET(LIBUNWIND_LIBRARY_DIRS @prefix@/lib)
@@ -37,6 +38,7 @@ SET(Protobuf_PROTOC_EXECUTABLE @prefix@/native/bin/protoc CACHE FILEPATH "Path t
SET(Protobuf_INCLUDE_DIR @prefix@/include CACHE PATH "Protobuf include dir")
SET(Protobuf_INCLUDE_DIRS @prefix@/include CACHE PATH "Protobuf include dir")
SET(Protobuf_LIBRARY @prefix@/lib/libprotobuf.a CACHE FILEPATH "Protobuf library")
+endif()
SET(ZMQ_INCLUDE_PATH @prefix@/include)
SET(ZMQ_LIB @prefix@/lib/libzmq.a)
@@ -78,6 +80,22 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Darwin")
SET(CMAKE_OSX_ARCHITECTURES "x86_64")
SET(LLVM_ENABLE_PIC OFF)
SET(LLVM_ENABLE_PIE OFF)
+elseif(CMAKE_SYSTEM_NAME STREQUAL "Android")
+ SET(ANDROID TRUE)
+ if(ARCHITECTURE STREQUAL "arm")
+ SET(CMAKE_ANDROID_ARCH_ABI "armeabi-v7a")
+ SET(CMAKE_SYSTEM_PROCESSOR "armv7-a")
+ SET(CMAKE_ANDROID_ARM_MODE ON)
+ SET(CMAKE_C_COMPILER_TARGET arm-linux-androideabi)
+ SET(CMAKE_CXX_COMPILER_TARGET arm-linux-androideabi)
+ SET(_CMAKE_TOOLCHAIN_PREFIX arm-linux-androideabi-)
+ elseif(ARCHITECTURE STREQUAL "aarch64")
+ SET(CMAKE_ANDROID_ARCH_ABI "arm64-v8a")
+ SET(CMAKE_SYSTEM_PROCESSOR "aarch64")
+ endif()
+ SET(CMAKE_ANDROID_STANDALONE_TOOLCHAIN @prefix@/native)
+ SET(CMAKE_C_COMPILER "${_CMAKE_TOOLCHAIN_PREFIX}clang")
+ SET(CMAKE_CXX_COMPILER "${_CMAKE_TOOLCHAIN_PREFIX}clang++")
else()
SET(CMAKE_C_COMPILER @CC@)
SET(CMAKE_CXX_COMPILER @CXX@)
@@ -89,13 +107,21 @@ if(ARCHITECTURE STREQUAL "arm")
set(ARM_ID "armv7-a")
set(BUILD_64 OFF)
set(CMAKE_BUILD_TYPE release)
- set(BUILD_TAG "linux-armv7")
+ if(ANDROID)
+ set(BUILD_TAG "android-armv7")
+ else()
+ set(BUILD_TAG "linux-armv7")
+ endif()
set(ARM7)
elseif(ARCHITECTURE STREQUAL "aarch64")
set(ARCH "armv8-a")
set(ARM ON)
set(ARM_ID "armv8-a")
- set(BUILD_TAG "linux-armv8")
+ if(ANDROID)
+ set(BUILD_TAG "android-armv8")
+ else()
+ set(BUILD_TAG "linux-armv8")
+ endif()
set(BUILD_64 ON)
endif()