Go to file
Sam Lantinga 4349cb5769 Fixed bug 2146 - Enable static linking of libSDL on Android
Denis Bernard

This patch to Android.mk adds support for static linking of libSDL for Android applications. A patched readme with static build instructions is also provided.

It does not break existing build environments setup according to the README-android.txt since the static library version will not be built in not required.

The static build uses the Android NDK module system (see docs/IMPORT-MODULE.html in the NDK folder and step 5 in the instructions below).

Instructions:
1. Copy the android-project directory wherever you want to keep your projects
   and rename it to the name of your project.
2. Create a symlink to SDL/src/main/android/SDL_android_main.c as
   <project>/jni/src/SDL_android_main.c
3. Rename <project>/jni/src/Android_static.mk to <project>/jni/src/Android.mk
   (overwrite the existing one)
4. Edit <project>/jni/src/Android.mk to include your source files
5. create and export an environment variable named NDK_MODULE_PATH that points
   to the parent directory of this SDL directory. e.g.:

   export NDK_MODULE_PATH="$PWD"/..

6. Edit <project>/src/org/libsdl/app/SDLActivity.java and remove the call to
   System.loadLibrary("SDL2") line 42.
7. Run 'ndk-build' (a script provided by the NDK). This compiles the C source

Although this requires an environment variable to be setup, it can be added once and for all to the main Android.mk of the project.
2013-10-10 21:51:39 -07:00
VisualC Added SDL_GetBasePath() and SDL_GetPrefPath() in new filesystem module. 2013-08-20 19:57:11 -04:00
Xcode Updated SDL to version 2.0.1 2013-10-10 21:50:25 -07:00
Xcode-iOS OCD fixes: Adds a space after /* (glory to regular expressions!) 2013-08-21 09:47:10 -03:00
acinclude Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
android-project Fixed bug 2146 - Enable static linking of libSDL on Android 2013-10-10 21:51:39 -07:00
build-scripts Raspberry Pi build script: let caller specify final tarball name. 2013-10-10 02:37:36 -04:00
cmake Separate EGL / GL ES detection in CMake 2013-08-22 14:56:07 -03:00
debian Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
include Updated SDL to version 2.0.1 2013-10-10 21:50:25 -07:00
src Updated SDL to version 2.0.1 2013-10-10 21:50:25 -07:00
test Updated SDL to version 2.0.1 2013-10-10 21:50:25 -07:00
.hgignore Added SDL_GetBasePath() and SDL_GetPrefPath() in new filesystem module. 2013-08-20 19:57:11 -04:00
Android.mk Fixed bug 2146 - Enable static linking of libSDL on Android 2013-10-10 21:51:39 -07:00
BUGS.txt Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
CMakeLists.txt Updated SDL to version 2.0.1 2013-10-10 21:50:25 -07:00
COPYING.txt Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
CREDITS.txt Added Julian Winter to the credits for the SDL 2.0 website. 2013-08-12 08:45:37 -07:00
INSTALL.txt Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
Makefile.in Added SDL_GetBasePath() and SDL_GetPrefPath() in new filesystem module. 2013-08-20 19:57:11 -04:00
Makefile.minimal Added SDL_GetBasePath() and SDL_GetPrefPath() in new filesystem module. 2013-08-20 19:57:11 -04:00
Makefile.pandora Added SDL_GetBasePath() and SDL_GetPrefPath() in new filesystem module. 2013-08-20 19:57:11 -04:00
Makefile.psp Added SDL_GetBasePath() and SDL_GetPrefPath() in new filesystem module. 2013-08-20 19:57:11 -04:00
Makefile.wiz Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
README-SDL.txt Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
README-android.txt Fixed bug 2146 - Enable static linking of libSDL on Android 2013-10-10 21:51:39 -07:00
README-cmake.txt Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
README-directfb.txt Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
README-gesture.txt Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
README-hg.txt Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
README-ios.txt Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
README-macosx.txt Mac: Better handling when someone else is the app delegate. 2013-10-07 16:01:40 -07:00
README-pandora.txt Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
README-platforms.txt Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
README-porting.txt Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
README-psp.txt Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
README-raspberrypi.txt SDL_TEXTINPUT support for EVDEV 2013-10-03 10:28:10 -03:00
README-touch.txt Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
README-wince.txt Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
README.txt Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
SDL2.spec.in Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
TODO.txt Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
VisualC.html Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
WhatsNew.txt Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
autogen.sh Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
configure Updated SDL to version 2.0.1 2013-10-10 21:50:25 -07:00
configure.in Updated SDL to version 2.0.1 2013-10-10 21:50:25 -07:00
sdl2-config.in Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
sdl2.m4 Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00
sdl2.pc.in Fixes #2022, do not resume on Android when surfaceChanged 2013-08-12 11:13:50 -03:00

README.txt

This file contains invisible Unicode characters!

This file contains invisible Unicode characters that may be processed differently from what appears below. If your use case is intentional and legitimate, you can safely ignore this warning. Use the Escape button to reveal hidden characters.


                         Simple DirectMedia Layer

                                  (SDL)

                                Version 2.0

---
http://www.libsdl.org/

Simple DirectMedia Layer is a cross-platform development library designed
to provide low level access to audio, keyboard, mouse, joystick, and graphics
hardware via OpenGL and Direct3D. It is used by video playback software,
emulators, and popular games including Valve's award winning catalog
and many Humble Bundle games.

SDL officially supports Windows, Mac OS X, Linux, iOS, and Android.
Support for other platforms may be found in the source code.

SDL is written in C, works natively with C++, and there are bindings 
available for several other languages, including C# and Python.

This library is distributed under the zlib license, which can be found
in the file "COPYING.txt".

The best way to learn how to use SDL is to check out the header files in
the "include" subdirectory and the programs in the "test" subdirectory.
The header files and test programs are well commented and always up to date.
More documentation and FAQs are available online at:
	http://wiki.libsdl.org/

If you need help with the library, or just want to discuss SDL related
issues, you can join the developers mailing list:
	http://www.libsdl.org/mailing-list.php

Enjoy!
	Sam Lantinga				(slouken@libsdl.org)