Enable building of Android libraries using a standalone NDK

This commit is contained in:
Dimitris Zenios 2014-04-06 00:30:48 +03:00
parent 6dd9ea8d37
commit 9eccde51c3
2 changed files with 37 additions and 0 deletions

View File

@ -2139,6 +2139,10 @@ AC_HELP_STRING([--enable-pthreads], [use POSIX threads for multi-threading [[def
AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]),
, enable_pthread_sem=yes)
case "$host" in
*-*-androideabi*)
pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
pthread_lib=""
;;
*-*-linux*|*-*-uclinux*)
pthread_cflags="-D_REENTRANT"
pthread_lib="-lpthread"
@ -2642,6 +2646,20 @@ case "$host" in
$as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h
fi
;;
*-*-androideabi*)
# Android
ARCH=android
ANDROID_CFLAGS="-DGL_GLEXT_PROTOTYPES"
CFLAGS="$CFLAGS $ANDROID_CFLAGS"
SDL_CFLAGS="$SDL_CFLAGS $ANDROID_CFLAGS"
EXTRA_CFLAGS="$EXTRA_CFLAGS $ANDROID_CFLAGS"
EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl -lGLESv1_CM -lGLESv2 -llog -landroid"
if test x$enable_video = xyes; then
SOURCES="$SOURCES $srcdir/src/core/android/*.c $srcdir/src/video/android/*.c"
$as_echo "#define SDL_VIDEO_DRIVER_ANDROID 1" >>confdefs.h
fi
;;
*-*-linux*) ARCH=linux ;;
*-*-uclinux*) ARCH=linux ;;
*-*-kfreebsd*-gnu) ARCH=kfreebsd-gnu ;;
@ -2706,6 +2724,11 @@ case "$host" in
SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
have_audio=yes
;;
android)
AC_DEFINE(SDL_AUDIO_DRIVER_ANDROID, 1, [ ])
SOURCES="$SOURCES $srcdir/src/audio/android/*.c"
have_audio=yes
;;
esac
fi
# Set up files for the joystick library
@ -2716,6 +2739,11 @@ case "$host" in
SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
have_joystick=yes
;;
android)
AC_DEFINE(SDL_JOYSTICK_ANDROID, 1, [ ])
SOURCES="$SOURCES $srcdir/src/joystick/android/*.c"
have_joystick=yes
;;
esac
fi
# Set up files for the haptic library
@ -2738,6 +2766,11 @@ case "$host" in
SOURCES="$SOURCES $srcdir/src/power/linux/*.c"
have_power=yes
;;
android)
AC_DEFINE(SDL_POWER_ANDROID, 1, [ ])
SOURCES="$SOURCES $srcdir/src/power/android/*.c"
have_power=yes
;;
esac
fi
# Set up files for the filesystem library

View File

@ -201,6 +201,7 @@
#undef SDL_AUDIO_DRIVER_COREAUDIO
#undef SDL_AUDIO_DRIVER_DISK
#undef SDL_AUDIO_DRIVER_DUMMY
#undef SDL_AUDIO_DRIVER_ANDROID
#undef SDL_AUDIO_DRIVER_XAUDIO2
#undef SDL_AUDIO_DRIVER_DSOUND
#undef SDL_AUDIO_DRIVER_ESD
@ -227,6 +228,7 @@
#undef SDL_JOYSTICK_DUMMY
#undef SDL_JOYSTICK_IOKIT
#undef SDL_JOYSTICK_LINUX
#undef SDL_JOYSTICK_ANDROID
#undef SDL_JOYSTICK_WINMM
#undef SDL_JOYSTICK_USBHID
#undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H
@ -272,6 +274,7 @@
#undef SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON
#undef SDL_VIDEO_DRIVER_X11
#undef SDL_VIDEO_DRIVER_RPI
#undef SDL_VIDEO_DRIVER_ANDROID
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT
#undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR
@ -317,6 +320,7 @@
#undef SDL_POWER_WINDOWS
#undef SDL_POWER_MACOSX
#undef SDL_POWER_HAIKU
#undef SDL_POWER_ANDROID
#undef SDL_POWER_HARDWIRED
/* Enable system filesystem support */