NoteFor those who aren’t familiar with git, once the SFML repo freshly cloned, type: git checkout –b ios_and_android origin/ios_and_android to get the right branch.
How to compile the Android port? To compile the Android port, you must use CMake with the toolchain configuration script located at cmake/toolchains/android.toolchain.cmake. To do that, define the CMAKE_TOOLCHAIN_FILE variable when invoking CMake and make it point to the android.toolchain.cmake script. You’ll also need to define an environments variable ANDROID_NDK telling where the NDK directory is. There are a few options available to customize the build process:
ANDROID_ABI :
armeabi, armeabi-v7a, x86, mipsANDROID_NATIVE_API_LEVEL:
9, 14, 18, etc.ANDROID_USE_STLPORT:
Make sure this one is set at TRUE because I’m not sure if it’s set automatically. Usage of the STL port is MANDATORY. If you don’t use it, no error will be reported and your application will just.. crash Once compiled, type "make install" to install everything in your NDK directory.
Getting familiar with the compilation process of native Android application isn’t an easy task so, don’t give up and read carefully the NDK documentation. Maybe you should start with compiling an official example such as NativeActivty located in your NDK. You’ll need to get through this because you won’t be able to reuse this CMake toolchain script to compile your own application (unless your application is a library
).
There’s an example available in the SFML source files directory. I advise you to “create a project from existing source” from the Android IDE (Eclipse). Once the example imported and set up, you can’t simply press the “Run” button, you’ll need to compile the example project first. To do that, open a console, head to the example directory and invoke the ndk-build script located in your NDK: your command might look like this: $ANDROID_NDK/ndk-build
Things to know for AndroidOn Android, the working directory is automatically set to the resources directory (assets/).
sf::SoundRecorder won’t record any sounds.
Since recently I no longer get the orchestral.ogg song to play with sf::Music ... but canary.wav does work.
The implementation is compatible with Android 9 or later.
You may have to install some 32bits libs on Linux. I can’t tell which exactly but on Fedora 64bits, type the following: sudo yum install glibc.i686 glibc-devel.i686 libstdc++.i686 zlib-devel.i686 ncurses-devel.i686 libX11-devel.i686 libXrender.i686 libXrandr.i686. If someone could give the list for Debian based distribution, it would great!
How to compile the OpenGL ES port for Linux?Unfortunately, this isn’t available yet because I need to refactor the EGL code to avoid duplication, as well as time to test the new CMake scripts on a Raspberry Pi. I’ll implement this really soon.
ImportantI really am busy right now and I won't be able to provide much support until 8th of December.