Enable building of Android libraries using a standalone NDK
authorDimitris Zenios
Sun, 06 Apr 2014 00:30:48 +0300
changeset 87144e57cfd9fca8
parent 8713 e3a80970cf0b
child 8715 1c4a634f364e
Enable building of Android libraries using a standalone NDK
configure.in
include/SDL_config.h.in
     1.1 --- a/configure.in	Thu Apr 17 21:00:25 2014 -0700
     1.2 +++ b/configure.in	Sun Apr 06 00:30:48 2014 +0300
     1.3 @@ -2139,6 +2139,10 @@
     1.4  AC_HELP_STRING([--enable-pthread-sem], [use pthread semaphores [[default=yes]]]),
     1.5                    , enable_pthread_sem=yes)
     1.6      case "$host" in
     1.7 +	 *-*-androideabi*)
     1.8 +            pthread_cflags="-D_REENTRANT -D_THREAD_SAFE"
     1.9 +            pthread_lib=""
    1.10 +	    ;;
    1.11          *-*-linux*|*-*-uclinux*)
    1.12              pthread_cflags="-D_REENTRANT"
    1.13              pthread_lib="-lpthread"
    1.14 @@ -2642,6 +2646,20 @@
    1.15                      $as_echo "#define SDL_VIDEO_DRIVER_RPI 1" >>confdefs.h
    1.16                  fi
    1.17                  ;;
    1.18 +            *-*-androideabi*)
    1.19 +                # Android
    1.20 +                ARCH=android
    1.21 +                ANDROID_CFLAGS="-DGL_GLEXT_PROTOTYPES"
    1.22 +                CFLAGS="$CFLAGS $ANDROID_CFLAGS"
    1.23 +                SDL_CFLAGS="$SDL_CFLAGS $ANDROID_CFLAGS"
    1.24 +                EXTRA_CFLAGS="$EXTRA_CFLAGS $ANDROID_CFLAGS"
    1.25 +                EXTRA_LDFLAGS="$EXTRA_LDFLAGS -ldl -lGLESv1_CM -lGLESv2 -llog -landroid"
    1.26 +
    1.27 +                if test x$enable_video = xyes; then
    1.28 +                    SOURCES="$SOURCES $srcdir/src/core/android/*.c $srcdir/src/video/android/*.c"
    1.29 +                    $as_echo "#define SDL_VIDEO_DRIVER_ANDROID 1" >>confdefs.h
    1.30 +                fi
    1.31 +                ;;
    1.32              *-*-linux*)         ARCH=linux ;;
    1.33              *-*-uclinux*)       ARCH=linux ;;
    1.34              *-*-kfreebsd*-gnu)  ARCH=kfreebsd-gnu ;;
    1.35 @@ -2706,6 +2724,11 @@
    1.36                  SOURCES="$SOURCES $srcdir/src/audio/paudio/*.c"
    1.37                  have_audio=yes
    1.38              ;;
    1.39 +            android)
    1.40 +                AC_DEFINE(SDL_AUDIO_DRIVER_ANDROID, 1, [ ])
    1.41 +                SOURCES="$SOURCES $srcdir/src/audio/android/*.c"
    1.42 +                have_audio=yes
    1.43 +            ;;
    1.44            esac
    1.45          fi
    1.46          # Set up files for the joystick library
    1.47 @@ -2716,6 +2739,11 @@
    1.48                  SOURCES="$SOURCES $srcdir/src/joystick/linux/*.c"
    1.49                  have_joystick=yes
    1.50              ;;
    1.51 +            android)
    1.52 +                AC_DEFINE(SDL_JOYSTICK_ANDROID, 1, [ ])
    1.53 +                SOURCES="$SOURCES $srcdir/src/joystick/android/*.c"
    1.54 +                have_joystick=yes
    1.55 +            ;;
    1.56            esac
    1.57          fi
    1.58          # Set up files for the haptic library
    1.59 @@ -2738,6 +2766,11 @@
    1.60                     SOURCES="$SOURCES $srcdir/src/power/linux/*.c"
    1.61                     have_power=yes
    1.62                 ;;
    1.63 +               android)
    1.64 +                   AC_DEFINE(SDL_POWER_ANDROID, 1, [ ])
    1.65 +                   SOURCES="$SOURCES $srcdir/src/power/android/*.c"
    1.66 +                   have_power=yes
    1.67 +               ;;
    1.68               esac
    1.69          fi
    1.70          # Set up files for the filesystem library
     2.1 --- a/include/SDL_config.h.in	Thu Apr 17 21:00:25 2014 -0700
     2.2 +++ b/include/SDL_config.h.in	Sun Apr 06 00:30:48 2014 +0300
     2.3 @@ -201,6 +201,7 @@
     2.4  #undef SDL_AUDIO_DRIVER_COREAUDIO
     2.5  #undef SDL_AUDIO_DRIVER_DISK
     2.6  #undef SDL_AUDIO_DRIVER_DUMMY
     2.7 +#undef SDL_AUDIO_DRIVER_ANDROID
     2.8  #undef SDL_AUDIO_DRIVER_XAUDIO2
     2.9  #undef SDL_AUDIO_DRIVER_DSOUND
    2.10  #undef SDL_AUDIO_DRIVER_ESD
    2.11 @@ -227,6 +228,7 @@
    2.12  #undef SDL_JOYSTICK_DUMMY
    2.13  #undef SDL_JOYSTICK_IOKIT
    2.14  #undef SDL_JOYSTICK_LINUX
    2.15 +#undef SDL_JOYSTICK_ANDROID
    2.16  #undef SDL_JOYSTICK_WINMM
    2.17  #undef SDL_JOYSTICK_USBHID
    2.18  #undef SDL_JOYSTICK_USBHID_MACHINE_JOYSTICK_H
    2.19 @@ -272,6 +274,7 @@
    2.20  #undef SDL_VIDEO_DRIVER_MIR_DYNAMIC_XKBCOMMON
    2.21  #undef SDL_VIDEO_DRIVER_X11
    2.22  #undef SDL_VIDEO_DRIVER_RPI
    2.23 +#undef SDL_VIDEO_DRIVER_ANDROID
    2.24  #undef SDL_VIDEO_DRIVER_X11_DYNAMIC
    2.25  #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XEXT
    2.26  #undef SDL_VIDEO_DRIVER_X11_DYNAMIC_XCURSOR
    2.27 @@ -317,6 +320,7 @@
    2.28  #undef SDL_POWER_WINDOWS
    2.29  #undef SDL_POWER_MACOSX
    2.30  #undef SDL_POWER_HAIKU
    2.31 +#undef SDL_POWER_ANDROID
    2.32  #undef SDL_POWER_HARDWIRED
    2.33  
    2.34  /* Enable system filesystem support */