Game Development Reference
In-Depth Information
How to do it...
The parameter NDK_TOOLCHAIN_VERSION in Application.mk corresponds to one of the
available toolchains. In NDK r9b, you can switch between three GCC versions—4.6, and 4.7,
which are marked as deprecated and will be removed from the next NDK releases, and 4.8.
And two Clang versions—Clang3.2, which is also marked as deprecated, and Clang3.3. The
default toolchain in the NDK r9b is still GCC 4.6.
Starting from the NDK r8e, you can just specify clang as the value of NDK_TOOLCHAIN_
VERSION . This option will select the most recent version of the available Clang toolchain.
There's more...
The toolchains are discovered by the $(NDK_ROOT)/build/core/init.mk script, so you
can deine your own toolchain in a folder named <ABI>-<ToolchainName> and use it in
Application.mk .
Supporting multiple CPU architectures
Android NDK supports different CPU architectures such as ARMv5TE and ARMv7-based
devices, x86, and MIPS (big-endian architecture). We can create fat binaries that can run on
any of the supported platforms.
Getting ready
Find out the architecture of your Android-based device. You can do it using the adb command
as follows:
>adb shell cat /proc/cpuinfo
How to do it...
The following are the two approaches to pick an appropriate set of CPU architectures:
1.
By default, the NDK will generate the code for ARMv5TE-based CPUs. Use the
parameter APP_ABI in Application.mk to select a different architecture, for
example (use only one line from the following list):
APP_ABI := armeabi-v7a
APP_ABI := x86
APP_ABI := mips
 
Search WWH ::




Custom Search