From 833979268ebac7a002ad3a56b5f2656b5ebe06ed Mon Sep 17 00:00:00 2001 From: Andrew Hsieh Date: Thu, 21 Nov 2013 16:19:10 +0800 Subject: [PATCH] Enhance hello-jni to report APP_ABI at compilation Change-Id: I24989212cfb729705cc4177a7112804fa68144c4 --- ndk/samples/hello-jni/jni/Application.mk | 1 + ndk/samples/hello-jni/jni/hello-jni.c | 20 +++++++++++++++++++- 2 files changed, 20 insertions(+), 1 deletion(-) create mode 100644 ndk/samples/hello-jni/jni/Application.mk diff --git a/ndk/samples/hello-jni/jni/Application.mk b/ndk/samples/hello-jni/jni/Application.mk new file mode 100644 index 000000000..e619d92fc --- /dev/null +++ b/ndk/samples/hello-jni/jni/Application.mk @@ -0,0 +1 @@ +APP_ABI := all \ No newline at end of file diff --git a/ndk/samples/hello-jni/jni/hello-jni.c b/ndk/samples/hello-jni/jni/hello-jni.c index be1e6a74e..19fcc6a86 100644 --- a/ndk/samples/hello-jni/jni/hello-jni.c +++ b/ndk/samples/hello-jni/jni/hello-jni.c @@ -27,5 +27,23 @@ jstring Java_com_example_hellojni_HelloJni_stringFromJNI( JNIEnv* env, jobject thiz ) { - return (*env)->NewStringUTF(env, "Hello from JNI !"); +#if defined(__arm__) + #if defined(__ARM_ARCH_7A__) + #if defined(__ARM_NEON__) + #define ABI "armeabi-v7a/NEON" + #else + #define ABI "armeabi-v7a" + #endif + #else + #define ABI "armeabi" + #endif +#elif defined(__i386__) + #define ABI "x86" +#elif defined(__mips__) + #define ABI "mips" +#else + #define ABI "unknown" +#endif + + return (*env)->NewStringUTF(env, "Hello from JNI ! Compiled with ABI " ABI "."); }