Since Gradle seems like a new hot push by Google over Android.mk, how can I enable NEON to build ARM? I am clearly not interested in the solutions that cause the obsolete Android.mk file, since I want ARM NEON assemblies to work using only the new Gradle system, and not a hybrid approach.
Here's the hacked build.gradle test from the hello-jni project in the NDK:
apply plugin: 'com.android.model.application'
model {
android {
compileSdkVersion = 23
buildToolsVersion = "23.0.2"
defaultConfig.with {
applicationId = "com.example.hellojni"
minSdkVersion.apiLevel = 4
targetSdkVersion.apiLevel = 23
}
}
compileOptions.with {
sourceCompatibility=JavaVersion.VERSION_1_7
targetCompatibility=JavaVersion.VERSION_1_7
}
android.ndk {
moduleName = "hello-jni"
cppFlags.add("-std=c++11")
cppFlags.add("-fexceptions")
cppFlags.add("-DNOPENCL")
stl = "c++_static"
}
android.buildTypes {
release {
minifyEnabled = false
proguardFiles.add(file('proguard-rules.txt'))
}
}
android.productFlavors {
create("arm7") {
ndk.abiFilters.add("armeabi-v7a")
}
create("x86") {
ndk.abiFilters.add("x86")
}
create("x86-64") {
ndk.abiFilters.add("x86_64")
}
}
}
However, __ARM_NEON__it is not defined in accordance with the following code:
#if defined(__arm__)
#if defined(__ARM_ARCH_7A__)
#if defined(__ARM_NEON__)
#if defined(__ARM_PCS_VFP)
#define ABI "armeabi-v7a/NEON (hard-float)"
#else
#define ABI "armeabi-v7a/NEON"
#endif
#else
#if defined(__ARM_PCS_VFP)
#define ABI "armeabi-v7a (hard-float)"
#else
#define ABI "armeabi-v7a"
#endif
#endif
#else
#define ABI "armeabi"
#endif
#elif defined(__i386__)
#define ABI "x86"
#elif defined(__x86_64__)
#define ABI "x86_64"
#elif defined(__mips64)
#define ABI "mips64"
#elif defined(__mips__)
#define ABI "mips"
#elif defined(__aarch64__)
#define ABI "arm64-v8a"
#else
#define ABI "unknown"
#endif
Any thoughts? I also tried to install abiFiltersin armeabi-v7a-hardwith no luck, and also explicitly convey -mfloat-abi=hardand -mfpu-neonhow cppFlags(but this obviously breaks the build for other platforms).
source
share