[PATCH] Android target support (as part of LLDB build)

Vince Harron vharron at google.com
Wed Nov 19 14:38:00 PST 2014


Why are you using the __ANDROID_NDK__ define?  I think we should use __ANDROID__ instead.  If it's not defined in out build, we should define it (instead of __ANDROID_NDK__)

I've checked Android NDK versions 3, 9, and 21 and all of them automatically have these symbols defined when building with Android.mk

__ANDROID__
ANDROID

vharron at tifa:~/dev/defines$ cat jni/main.c
#include <stdio.h>

int
main() {

#ifdef __ANDROID__
  printf("__ANDROID__\n");
#endif
#ifdef ANDROID
  printf("ANDROID\n");
#endif
#ifdef __ANDROID_NDK__
  printf("__ANDROID_NDK__\n");
#endif

}

vharron at tifa:~/dev/defines$ strings libs/armeabi/libhello-android-9.so | egrep ANDROID
__ANDROID__
ANDROID
vharron at tifa:~/dev/defines$ vi jni/Application.mk
vharron at tifa:~/dev/defines$ ~/Downloads/android-ndk-r10c/ndk-build
[armeabi] Compile thumb  : hello-android-21 <= main.c
[armeabi] SharedLibrary  : libhello-android-21.so
[armeabi] Install        : libhello-android-21.so => libs/armeabi/libhello-android-21.so
vharron at tifa:~/dev/defines$ strings libs/armeabi/libhello-android-21.so | egrep ANDROID
__ANDROID__
ANDROID

http://reviews.llvm.org/D6180






More information about the llvm-commits mailing list