Skip to content

Sturmflut/sdl2-multiplatform-base

Repository files navigation

PREREQUISITE 1: SDL2
============================

1. Download the current SDL2 sources.

2. Unpack to a permanent location.

3. Create a symlink called "jni/SDL" inside this project which points to the unpacked SDL2 source code.



PREREQUISITE 2: SDL2_mixer
============================

1. Download the current SDL2_mixer sources.

2. Unpack to a permanent location.

3. Create a symlink called "jni/SDL2_mixer" inside this project which points to the unpacked SDL2_mixer source code.

4. Create a symlink called "jni/libmikmod" inside this project which points to the "external/libmikmod-*" directory in the SDL2_mixer source code.

5. Create a symlink called "jni/smpeg2" inside this project which points to the "external/smpeg2-*" directory in the SDL2_mixer source code.



PREREQUISITE 3: SDL2_image
============================

1. Download the current SDL2_image sources.

2. Unpack to a permanent location.

3. Create a symlink called "jni/SDL2_image" inside this project which points to the unpacked SDL2_image source code.

4. Create a symlink called "jni/libpng" inside this project which points to the "external/libpng-*" directory in the SDL2_mixer source code.



PREREQUISITE 4: The Android SDK
===============================

1. Download and install Android Studio.

2. Run the SDK Manager inside Android Studio ("Configure -> SDK Manager" on the Welcome screen).

3. In the "SDK Platforms" tab, click on "Show Package Details". Navigate to "Android 4.0.3 (IceCreamSandwich)" and activate the following three entries:

- "SDK Platform Android 4.0.3"
- "Sources for Android SDK"
- "ARM EABI v7a System Image"
- "Intel x86 Atom System Image"

4. In the "SDK Tools" tab, activate the following entries:

- "Android NDK"

5. Click on "Apply" and finish the wizard. If everything went well, you now have an ~/Android/Sdk/ folder containing all the necessary Android SDK stuff.

6. Make sure "~/Android/Sdk/ndk-bundle/" is part of your PATH environment variable (otherwise the "ndk-build" command cannot be found), and set the environment variable ANDROID_HOME to "~/Android/Sdk/". You can do both by e.g. putting the following line at the bottom of your ~/.bashrc :

export PATH=$PATH:~/Android/Sdk/ndk-bundle/
export ANDROID_HOME=~/Android/Sdk/

7. Run "./boostrap-android.sh" to build everything for the first time. The APK will end up in the bin/ subdirectory.



HOW TO BUILD
============

Run the "./build-android.sh" script after every modification to the source code. If something breaks, you can try to run "./boostrap-android.sh" which will clean everything and then rebuild.

Run "ant install" to automatically install the generated APK on a connected device.



HOW TO ADD YOUR PROJECT FILES
=============================

All your source code files have to be added to the LOCAL_SRC_FILES variable in the ./jni/src/Android.mk makefile.

All the assets go into the assets/ subdirectory. All the SDL_Load*() calls will work correctly and look into this directory on Android.

About

An SDL2 base project with build system files for Linux and Android.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published