Sergey K.
Sergey K.

Reputation: 25386

How can i enable VFP or NEON support in my C++ Android appolication?

By default Android NDK does not generate code with VFP (vector floating point) or NEON instructions turned on. How can i turn them on?

Upvotes: 4

Views: 4893

Answers (1)

Mārtiņš Možeiko
Mārtiņš Možeiko

Reputation: 12917

There are documentation about this in the following files in Android NDK: docs/CPU-ARCH-ABIS.html and docs/CPU-ARM-NEON.html.

Basically you want to put

APP_ABI := armeabi armeabi-v7a

to generate two shared libraries, one without (targeting ARMv5TE) and one with VFP support (targeting ARMv7).

To build .c/.cpp file with NEON support add .neon suffix to filename (for example: file.cpp.neon) in Android.mk file. Or to build all files with NEON enabled, put into Android.mk file:

LOCAL_ARM_NEON := true

Be careful - not all ARMv7 devices support NEON (like Nvidia Tegra 2). Better detect it at runtime and choose different codepath then.

Read the docs for more info.

Upvotes: 7

Related Questions