Add Android arm toolchains files.

This commit is contained in:
Tom Finegan 2018-04-26 13:47:33 -07:00
parent 171184405c
commit 2c08fdb93c
3 changed files with 62 additions and 0 deletions

View File

@ -51,6 +51,7 @@ _**Contents**_
* [Googletest Integration](#googletest-integration)
* [Javascript Encoder/Decoder](#javascript-encoderdecoder)
* [Android Studio Project Integration](#android-studio-project-integration)
* [Native Android Builds](#native-android-builds)
* [Usage](#usage)
* [Command Line Applications](#command-line-applications)
* [Encoding Tool](#encoding-tool)
@ -310,6 +311,31 @@ To add Draco to your project:
}
}
Native Android Builds
---------------------
It's sometimes useful to build Draco command line tools and run them directly on
Android devices via adb.
~~~~~ bash
# arm
$ cmake path/to/draco -DCMAKE_TOOLCHAIN_FILE=path/to/draco/cmake/toolchains/armv7-android-clang-libstdc++.cmake
$ make
# arm64
$ cmake path/to/draco -DCMAKE_TOOLCHAIN_FILE=path/to/draco/cmake/toolchains/arm64-android-clang-libstdc++.cmake
$ make
~~~~~
Note: The above assumes that make_standalone_toolchain.py has been used to
generate a standalone NDK toolchain for arm or arm64. In addition, Draco, as of
this writing, requires that libc++ is used for the stl argument when the
toolchain is generated.
After building the tools they can be moved to an android device via the use of
`adb push`, and then run with an `adb shell` instance.
Usage
======

View File

@ -0,0 +1,18 @@
if (NOT DRACO_CMAKE_TOOLCHAINS_ARM64_ANDROID_CLANG_LIBSTDCPP_CMAKE_)
set(DRACO_CMAKE_TOOLCHAINS_ARM64_ANDROID_CLANG_LIBSTDCPP_CMAKE_ 1)
set(CMAKE_SYSTEM_NAME "Linux")
if ("${CROSS}" STREQUAL "")
# Default the cross compiler prefix to something known to work.
set(CROSS aarch64-linux-android-)
endif ()
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_C_COMPILER ${CROSS}clang)
set(CMAKE_CXX_COMPILER ${CROSS}clang++)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie -static-libstdc++")
set(AS_EXECUTABLE ${CROSS}as)
set(CMAKE_SYSTEM_PROCESSOR "arm64")
endif () # DRACO_CMAKE_TOOLCHAINS_ARM64_ANDROID_CLANG_LIBSTDCPP_CMAKE_

View File

@ -0,0 +1,18 @@
if (NOT DRACO_CMAKE_TOOLCHAINS_ARMV7_ANDROID_CLANG_LIBSTDCPP_CMAKE_)
set(DRACO_CMAKE_TOOLCHAINS_ARMV7_ANDROID_CLANG_LIBSTDCPP_CMAKE_ 1)
set(CMAKE_SYSTEM_NAME "Linux")
if ("${CROSS}" STREQUAL "")
# Default the cross compiler prefix to something known to work.
set(CROSS arm-linux-androideabi-)
endif ()
set(CMAKE_POSITION_INDEPENDENT_CODE ON)
set(CMAKE_C_COMPILER ${CROSS}clang)
set(CMAKE_CXX_COMPILER ${CROSS}clang++)
set(CMAKE_EXE_LINKER_FLAGS "${CMAKE_EXE_LINKER_FLAGS} -pie -static-libstdc++")
set(AS_EXECUTABLE ${CROSS}as)
set(CMAKE_SYSTEM_PROCESSOR "armv7")
endif () # DRACO_CMAKE_TOOLCHAINS_ARMV7_ANDROID_CLANG_LIBSTDCPP_CMAKE_