Android NDK编译带ARM neon优化的库

使用NEON对代码进行优化时需要#include 。NEON库只支持armeabi-v7a和x86 ABIs. 所以在使用ndk-build编译带有NEON优化代码的库时需要对Android.mk进行编译平台的指定。具体方式如下。

# define a static library containing our NEON code
ifeq ($(TARGET_ARCH_ABI),$(filter $(TARGET_ARCH_ABI), armeabi-v7a x86))
include $(CLEAR_VARS)
LOCAL_MODULE    := mylib-neon
LOCAL_SRC_FILES := mylib-neon.c
LOCAL_ARM_NEON  := true
include $(BUILD_STATIC_LIBRARY)
endif # TARGET_ARCH_ABI == armeabi-v7a || x86

Reference:
https://developer.android.com/ndk/guides/cpu-arm-neon.html#rd

你可能感兴趣的:(Android NDK编译带ARM neon优化的库)