Android build

Preparation of building environment
Before you start building OpenMW on Android you have to do few steps of preparation:
 * 1) Download Crystax NDK (because it supports wchar and long long types) from GitHub repo, or Google Drive
 * 2) Download and install Google Android SDK
 * 3) Download Cmake for Android (it will be used for OpenMW and its dependencies compilation)
 * 4) Download all OpenMW dependencies, ie:
 * 5) * Ogre 1.9
 * 6) * Openal
 * 7) * boost
 * 8) * bullet
 * 9) * Sdl2
 * 10) * Qt 4.8
 * 11) * ffmpeg
 * 12) * freeimage
 * 13) * freetype
 * 14) * mygui
 * 15) * zzip
 * 16) * zlib

Compilation of OpenMW dependencies
Then you should add PATH for crystax ndk and google sdk.

Building Boost
For building boost I used it. You must build Ogre with Boost! https://github.com/MysticTreeGames/Boost-for-Android

Building Freetype
Then you must build freetype http://www.freetype.org/ For example like this

Building Freeimage
Then you must build freeimage. I used this tutorial for building http://freeimage.sourceforge.net/ http://recursify.com/blog/2013/05/25/building-freeimage-for-android

Since my phone supports manual armeabi-v7a I used this architecture for building. For example.

Android.mk for building freeimage

Building Ogre3D
Next you must build ogre from source. I build ogre 1.9 with this tutorial. http://www.ogre3d.org/tikiwiki/tiki-index.php?page=CMake+Quick+Start+Guide&tikiversion=Android You must add it and it to /sinbad-ogre-7c776867621e/RenderSystems/GLES2/src/EGL/Android/OgreAndroidEGLWindow.cpp ogre otherwise not be able to work with sdl2 ,because android can have only one active window. Also in Ogre 1.9 forgot to add this line to cmake file

Building MyGUI
Then you must build mygui for ogre http://mygui.info/ And you should remove this line from cmake file

Building Bullet
Then you should build bullet. You can use cmake or ndk-build https://github.com/bulletphysics/bullet3 Android.mk

Building OpenAL
Then you must build openal. http://repo.or.cz/w/openal-soft/android.git

Building Qt (optional)
Note: Qt is only used by the launcher and OpenCS, and can be skipped. To build Qt 4.8 for android: http://necessitas.kde.org/ I used this tutorial for building: https://community.kde.org/Necessitas/CompileQtFramework

Building FFmpeg
Then you must build ffmpeg. Important! You must use ffmpeg 1.26: http://www.roman10.net/how-to-build-ffmpeg-with-ndk-r9/

my script for build

Building SDL2
Then you must build SDL2: https://www.libsdl.org/hg.php I used SDL2 mercurial latest source.

Building OpenMW
then I started to build OpenMW. At first you must remove all lines associated with x server in FindOGRE.cmake and add GLES2 instead GLES. For example next I add this to main cmake file:

And now I can build OpenMW with it next I remove line from main cmake file: and add it Next I add I remove line in /openmw/apps/openmw/Cmakelists.txt and add it also I add it Next I changed paths in: /openmw/components/files/linuxpath.cpp for example Next I add patch in ogreinit.cpp and ogreinit.hpp I comment it and change plugin gl on gles2 Next you must add it to /openmw/extern/sdl4ogre/sdlwindowhelper.cpp Next I add this file to OpenMW SDL_android_main.c With it, I calle native c code from java wtih help jni. I rename main function in main.cpp to SDL_main.

Now you can build openmw lib

Next for eclipse project I use android-project example from SDL and use README-android.txt tutorial from sdl

Disable mipmaps
Add this line to all textures_units