Android build: Difference between revisions

From OpenMW Wiki
Jump to navigation Jump to search
No edit summary
No edit summary
 
(35 intermediate revisions by 5 users not shown)
Line 2: Line 2:
=== Preparation of building environment ===
=== Preparation of building environment ===
Before you start building OpenMW on Android you have to do few steps of preparation:
Before you start building OpenMW on Android you have to do few steps of preparation:
# Download Crystax NDK (because it supports wchar and long long types) from [https://github.com/crystax/android-platform-ndk GitHub repo], or [https://drive.google.com/file/d/0B5mOME9qjLFuZmZoXzJTSUMwQmM/edit?usp=sharing Google Drive]
# Download   [https://www.crystax.net/ Crystax NDK]
# Download and install [http://developer.android.com/sdk/index.html Google Android SDK]
Openmw building without errors only on crystax ndk 10.1.0 version.
# Download [https://github.com/taka-no-me/android-cmake Cmake for Android] (it will be used for OpenMW and its dependencies compilation)
# Download [https://github.com/taka-no-me/android-cmake Cmake for Android] (it will be used for OpenMW and its dependencies compilation)
# Download [http://www.oracle.com/technetwork/java/javase/downloads/index-jsp-138363.html java ]
# Download all OpenMW dependencies, ie:
# Download all OpenMW dependencies, ie:
#* Ogre 1.9
#* [https://github.com/openscenegraph/osg OSG]
#* Openal
#* [http://repo.or.cz/w/openal-soft/android.git Openal]
#* boost
#* boost integrated in crystax ndk for all android platforms
#* bullet
#* [https://github.com/bulletphysics/bullet3 bullet]
#* Sdl2
#* [https://www.libsdl.org/hg.php Sdl2]
#* Qt 4.8
#* [https://www.ffmpeg.org/download.html ffmpeg 1.26]
#* ffmpeg
#* [https://github.com/MyGUI/mygui mygui]
#* freeimage
#* zlib integrated in android
#* freetype
#* mygui
#* zzip
#* zlib


=== Compilation of OpenMW dependencies ===
Prebuilt openmw dependencies for armv7 arch
https://drive.google.com/file/d/0B5mOME9qjLFuckRrSWd6ZTMtZGM/view?usp=sharing


Than you should add PATH for crystax ndk adn goole sdk.
Prebuilt openmw dependencies for armv8 arch
For building boost I used it. You must build Ogre with Boost!
https://drive.google.com/file/d/0B5mOME9qjLFuVkpRc2FWb3h1SW8/view?usp=sharing
https://github.com/MysticTreeGames/Boost-for-Android


Than you must build freetype
=== Compilation of OpenMW dependencies ===
http://www.freetype.org/
For example like this
<syntaxhighlight lang="bash">
cmake /home/sylar/freetype -DCMAKE_TOOLCHAIN_FILE=/home/sylar/android-cmake-master/android.toolchain.cmake -DANDROID_NATIVE_API_LEVEL=14
</syntaxhighlight>
Than you bust 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.
 
<syntaxhighlight lang="bash">
ndk-build APP_PLATFORM=android-14 APP_ABI=armeabi-v7a
</syntaxhighlight>


Android.mk for building freeimage
Then you should add PATH for crystax ndk and google sdk.


<syntaxhighlight lang="cmake">
==== Building OSG ====
Next you must build OSG from source. I build osg with this tutorials .


LOCAL_PATH := $(call my-dir)
http://www.openscenegraph.org/index.php/documentation/platform-specifics/android/43-building-openscenegraph-for-android-3-0-2
include $(CLEAR_VARS)
GLOBAL_C_INCLUDES := \
    $(LOCAL_PATH)/../Source \
    $(LOCAL_PATH)/../Source \
    $(LOCAL_PATH)/../Source/DeprecationManager \
    $(LOCAL_PATH)/../Source/FreeImage \
    $(LOCAL_PATH)/../Source/FreeImageLib \
    $(LOCAL_PATH)/../Source/FreeImageToolkit \
    $(LOCAL_PATH)/../Source/LibJPEG \
    $(LOCAL_PATH)/../Source/LibMNG \
    $(LOCAL_PATH)/../Source/LibOpenJPEG \
    $(LOCAL_PATH)/../Source/LibPNG \
    $(LOCAL_PATH)/../Source/LibTIFF \
    $(LOCAL_PATH)/../Source/Metadata \
    $(LOCAL_PATH)/../Source/OpenEXR \
    $(LOCAL_PATH)/../Source/OpenEXR/Copyrights \
    $(LOCAL_PATH)/../Source/OpenEXR/Half \
    $(LOCAL_PATH)/../Source/OpenEXR/Iex \
    $(LOCAL_PATH)/../Source/OpenEXR/IlmImf \
    $(LOCAL_PATH)/../Source/OpenEXR/IlmThread \
    $(LOCAL_PATH)/../Source/OpenEXR/Imath \
    $(LOCAL_PATH)/../Source/ZLib \
LOCAL_SRC_FILES = ../Source/FreeImage/BitmapAccess.cpp ../Source/FreeImage/ColorLookup.cpp ../Source/FreeImage/FreeImage.cpp \
../Source/FreeImage/FreeImageC.c ../Source/FreeImage/FreeImageIO.cpp ../Source/FreeImage/GetType.cpp ../Source/FreeImage/MemoryIO.cpp \
../Source/FreeImage/PixelAccess.cpp ../Source/FreeImage/J2KHelper.cpp ../Source/FreeImage/MNGHelper.cpp ../Source/FreeImage/Plugin.cpp \
../Source/FreeImage/PluginBMP.cpp ../Source/FreeImage/PluginCUT.cpp ../Source/FreeImage/PluginDDS.cpp ../Source/FreeImage/PluginEXR.cpp \
../Source/FreeImage/PluginG3.cpp ../Source/FreeImage/PluginGIF.cpp ../Source/FreeImage/PluginHDR.cpp ../Source/FreeImage/PluginICO.cpp \
../Source/FreeImage/PluginIFF.cpp ../Source/FreeImage/PluginJ2K.cpp ../Source/FreeImage/PluginJNG.cpp ../Source/FreeImage/PluginJP2.cpp \
../Source/FreeImage/PluginJPEG.cpp ../Source/FreeImage/PluginKOALA.cpp ../Source/FreeImage/PluginMNG.cpp ../Source/FreeImage/PluginPCD.cpp \
../Source/FreeImage/PluginPCX.cpp ../Source/FreeImage/PluginPFM.cpp ../Source/FreeImage/PluginPICT.cpp ../Source/FreeImage/PluginPNG.cpp \
../Source/FreeImage/PluginPNM.cpp ../Source/FreeImage/PluginPSD.cpp ../Source/FreeImage/PluginRAS.cpp  ../Source/FreeImage/PluginSGI.cpp \
../Source/FreeImage/PluginTARGA.cpp ../Source/FreeImage/PluginTIFF.cpp ../Source/FreeImage/PluginWBMP.cpp ../Source/FreeImage/PluginXBM.cpp \
../Source/FreeImage/PluginXPM.cpp ../Source/FreeImage/PSDParser.cpp ../Source/FreeImage/TIFFLogLuv.cpp ../Source/FreeImage/Conversion.cpp \
../Source/FreeImage/Conversion16_555.cpp ../Source/FreeImage/Conversion16_565.cpp ../Source/FreeImage/Conversion24.cpp \
../Source/FreeImage/Conversion32.cpp ../Source/FreeImage/Conversion4.cpp ../Source/FreeImage/Conversion8.cpp ../Source/FreeImage/ConversionFloat.cpp \
../Source/FreeImage/ConversionRGB16.cpp ../Source/FreeImage/ConversionRGBF.cpp ../Source/FreeImage/ConversionType.cpp \
../Source/FreeImage/ConversionUINT16.cpp ../Source/FreeImage/Halftoning.cpp ../Source/FreeImage/tmoColorConvert.cpp ../Source/FreeImage/tmoDrago03.cpp \
../Source/FreeImage/tmoFattal02.cpp ../Source/FreeImage/tmoReinhard05.cpp ../Source/FreeImage/ToneMapping.cpp ../Source/FreeImage/NNQuantizer.cpp \
../Source/FreeImage/WuQuantizer.cpp ../Source/DeprecationManager/Deprecated.cpp ../Source/DeprecationManager/DeprecationMgr.cpp \
../Source/FreeImage/CacheFile.cpp ../Source/FreeImage/MultiPage.cpp ../Source/FreeImage/ZLibInterface.cpp ../Source/Metadata/Exif.cpp \
../Source/Metadata/FIRational.cpp ../Source/Metadata/FreeImageTag.cpp ../Source/Metadata/IPTC.cpp ../Source/Metadata/TagConversion.cpp \
../Source/Metadata/TagLib.cpp ../Source/Metadata/XTIFF.cpp ../Source/FreeImageToolkit/Background.cpp ../Source/FreeImageToolkit/BSplineRotate.cpp \
../Source/FreeImageToolkit/Channels.cpp ../Source/FreeImageToolkit/ClassicRotate.cpp ../Source/FreeImageToolkit/Colors.cpp \
../Source/FreeImageToolkit/CopyPaste.cpp ../Source/FreeImageToolkit/Display.cpp ../Source/FreeImageToolkit/Flip.cpp ../Source/FreeImageToolkit/JPEGTransform.cpp \
../Source/FreeImageToolkit/MultigridPoissonSolver.cpp ../Source/FreeImageToolkit/Rescale.cpp ../Source/FreeImageToolkit/Resize.cpp \
../Source/LibJPEG/./jaricom.c ../Source/LibJPEG/jcapimin.c ../Source/LibJPEG/jcapistd.c ../Source/LibJPEG/./jcarith.c ../Source/LibJPEG/jccoefct.c \
../Source/LibJPEG/jccolor.c ../Source/LibJPEG/jcdctmgr.c ../Source/LibJPEG/jchuff.c ../Source/LibJPEG/jcinit.c ../Source/LibJPEG/jcmainct.c \
../Source/LibJPEG/jcmarker.c ../Source/LibJPEG/jcmaster.c ../Source/LibJPEG/jcomapi.c ../Source/LibJPEG/jcparam.c ../Source/LibJPEG/jcprepct.c \
../Source/LibJPEG/jcsample.c ../Source/LibJPEG/jctrans.c ../Source/LibJPEG/jdapimin.c ../Source/LibJPEG/jdapistd.c ../Source/LibJPEG/./jdarith.c \
../Source/LibJPEG/jdatadst.c ../Source/LibJPEG/jdatasrc.c ../Source/LibJPEG/jdcoefct.c ../Source/LibJPEG/jdcolor.c ../Source/LibJPEG/jddctmgr.c \
../Source/LibJPEG/jdhuff.c ../Source/LibJPEG/jdinput.c ../Source/LibJPEG/jdmainct.c ../Source/LibJPEG/jdmarker.c ../Source/LibJPEG/jdmaster.c \
../Source/LibJPEG/jdmerge.c ../Source/LibJPEG/jdpostct.c ../Source/LibJPEG/jdsample.c ../Source/LibJPEG/jdtrans.c ../Source/LibJPEG/jerror.c \
../Source/LibJPEG/jfdctflt.c ../Source/LibJPEG/jfdctfst.c ../Source/LibJPEG/jfdctint.c ../Source/LibJPEG/jidctflt.c ../Source/LibJPEG/jidctfst.c \
../Source/LibJPEG/jidctint.c ../Source/LibJPEG/jmemmgr.c ../Source/LibJPEG/jmemnobs.c ../Source/LibJPEG/jquant1.c ../Source/LibJPEG/jquant2.c \
../Source/LibJPEG/jutils.c ../Source/LibJPEG/transupp.c ../Source/LibPNG/./png.c ../Source/LibPNG/./pngerror.c ../Source/LibPNG/./pngget.c \
../Source/LibPNG/./pngmem.c ../Source/LibPNG/./pngpread.c ../Source/LibPNG/./pngread.c ../Source/LibPNG/./pngrio.c ../Source/LibPNG/./pngrtran.c \
../Source/LibPNG/./pngrutil.c ../Source/LibPNG/./pngset.c ../Source/LibPNG/./pngtrans.c ../Source/LibPNG/./pngwio.c ../Source/LibPNG/./pngwrite.c \
../Source/LibPNG/./pngwtran.c ../Source/LibPNG/./pngwutil.c ../Source/LibTIFF4/./tif_aux.c ../Source/LibTIFF4/./tif_close.c ../Source/LibTIFF4/./tif_codec.c \
../Source/LibTIFF4/./tif_color.c ../Source/LibTIFF4/./tif_compress.c ../Source/LibTIFF4/./tif_dir.c ../Source/LibTIFF4/./tif_dirinfo.c \
../Source/LibTIFF4/./tif_dirread.c ../Source/LibTIFF4/./tif_dirwrite.c ../Source/LibTIFF4/./tif_dumpmode.c ../Source/LibTIFF4/./tif_error.c \
../Source/LibTIFF4/./tif_extension.c ../Source/LibTIFF4/./tif_fax3.c ../Source/LibTIFF4/./tif_fax3sm.c ../Source/LibTIFF4/./tif_flush.c \
../Source/LibTIFF4/./tif_getimage.c ../Source/LibTIFF4/./tif_jpeg.c ../Source/LibTIFF4/./tif_luv.c ../Source/LibTIFF4/./tif_lzma.c \
../Source/LibTIFF4/./tif_lzw.c ../Source/LibTIFF4/./tif_next.c ../Source/LibTIFF4/./tif_ojpeg.c ../Source/LibTIFF4/./tif_open.c ../Source/LibTIFF4/./tif_packbits.c \
../Source/LibTIFF4/./tif_pixarlog.c ../Source/LibTIFF4/./tif_predict.c ../Source/LibTIFF4/./tif_print.c ../Source/LibTIFF4/./tif_read.c \
../Source/LibTIFF4/./tif_strip.c ../Source/LibTIFF4/./tif_swab.c ../Source/LibTIFF4/./tif_thunder.c ../Source/LibTIFF4/./tif_tile.c \
../Source/LibTIFF4/./tif_version.c ../Source/LibTIFF4/./tif_warning.c ../Source/LibTIFF4/./tif_write.c ../Source/LibTIFF4/./tif_zip.c \
../Source/ZLib/./adler32.c ../Source/ZLib/./compress.c ../Source/ZLib/./crc32.c ../Source/ZLib/./deflate.c ../Source/ZLib/./gzclose.c \
../Source/ZLib/./gzlib.c ../Source/ZLib/./gzread.c ../Source/ZLib/./gzwrite.c ../Source/ZLib/./infback.c ../Source/ZLib/./inffast.c ../Source/ZLib/./inflate.c \
../Source/ZLib/./inftrees.c ../Source/ZLib/./trees.c ../Source/ZLib/./uncompr.c ../Source/ZLib/./zutil.c ../Source/LibOpenJPEG/bio.c \
../Source/LibOpenJPEG/./cidx_manager.c ../Source/LibOpenJPEG/cio.c ../Source/LibOpenJPEG/dwt.c ../Source/LibOpenJPEG/event.c ../Source/LibOpenJPEG/image.c \
../Source/LibOpenJPEG/j2k.c ../Source/LibOpenJPEG/j2k_lib.c ../Source/LibOpenJPEG/jp2.c ../Source/LibOpenJPEG/jpt.c ../Source/LibOpenJPEG/mct.c \
../Source/LibOpenJPEG/mqc.c ../Source/LibOpenJPEG/openjpeg.c ../Source/LibOpenJPEG/./phix_manager.c ../Source/LibOpenJPEG/pi.c \
../Source/LibOpenJPEG/./ppix_manager.c ../Source/LibOpenJPEG/raw.c ../Source/LibOpenJPEG/t1.c ../Source/LibOpenJPEG/t2.c ../Source/LibOpenJPEG/tcd.c \
../Source/LibOpenJPEG/tgt.c ../Source/LibOpenJPEG/./thix_manager.c ../Source/LibOpenJPEG/./tpix_manager.c ../Source/OpenEXR/./IlmImf/ImfAttribute.cpp \
../Source/OpenEXR/./IlmImf/ImfB44Compressor.cpp ../Source/OpenEXR/./IlmImf/ImfBoxAttribute.cpp ../Source/OpenEXR/./IlmImf/ImfChannelList.cpp \
../Source/OpenEXR/./IlmImf/ImfChannelListAttribute.cpp ../Source/OpenEXR/./IlmImf/ImfChromaticities.cpp ../Source/OpenEXR/./IlmImf/ImfChromaticitiesAttribute.cpp \
../Source/OpenEXR/./IlmImf/ImfCompressionAttribute.cpp ../Source/OpenEXR/./IlmImf/ImfCompressor.cpp ../Source/OpenEXR/./IlmImf/ImfConvert.cpp \
../Source/OpenEXR/./IlmImf/ImfCRgbaFile.cpp ../Source/OpenEXR/./IlmImf/ImfDoubleAttribute.cpp ../Source/OpenEXR/./IlmImf/ImfEnvmap.cpp \
../Source/OpenEXR/./IlmImf/ImfEnvmapAttribute.cpp ../Source/OpenEXR/./IlmImf/ImfFloatAttribute.cpp ../Source/OpenEXR/./IlmImf/ImfFrameBuffer.cpp \
../Source/OpenEXR/./IlmImf/ImfFramesPerSecond.cpp ../Source/OpenEXR/./IlmImf/ImfHeader.cpp ../Source/OpenEXR/./IlmImf/ImfHuf.cpp \
../Source/OpenEXR/./IlmImf/ImfInputFile.cpp ../Source/OpenEXR/./IlmImf/ImfIntAttribute.cpp ../Source/OpenEXR/./IlmImf/ImfIO.cpp \
../Source/OpenEXR/./IlmImf/ImfKeyCode.cpp ../Source/OpenEXR/./IlmImf/ImfKeyCodeAttribute.cpp ../Source/OpenEXR/./IlmImf/ImfLineOrderAttribute.cpp \
../Source/OpenEXR/./IlmImf/ImfLut.cpp ../Source/OpenEXR/./IlmImf/ImfMatrixAttribute.cpp ../Source/OpenEXR/./IlmImf/ImfMisc.cpp \
../Source/OpenEXR/./IlmImf/ImfOpaqueAttribute.cpp ../Source/OpenEXR/./IlmImf/ImfOutputFile.cpp ../Source/OpenEXR/./IlmImf/ImfPizCompressor.cpp \
../Source/OpenEXR/./IlmImf/ImfPreviewImage.cpp ../Source/OpenEXR/./IlmImf/ImfPreviewImageAttribute.cpp ../Source/OpenEXR/./IlmImf/ImfPxr24Compressor.cpp \
../Source/OpenEXR/./IlmImf/ImfRational.cpp ../Source/OpenEXR/./IlmImf/ImfRationalAttribute.cpp ../Source/OpenEXR/./IlmImf/ImfRgbaFile.cpp \
../Source/OpenEXR/./IlmImf/ImfRgbaYca.cpp ../Source/OpenEXR/./IlmImf/ImfRleCompressor.cpp ../Source/OpenEXR/./IlmImf/ImfScanLineInputFile.cpp \
../Source/OpenEXR/./IlmImf/ImfStandardAttributes.cpp ../Source/OpenEXR/./IlmImf/ImfStdIO.cpp ../Source/OpenEXR/./IlmImf/ImfStringAttribute.cpp \
../Source/OpenEXR/./IlmImf/ImfStringVectorAttribute.cpp ../Source/OpenEXR/./IlmImf/ImfTestFile.cpp ../Source/OpenEXR/./IlmImf/ImfThreading.cpp \
../Source/OpenEXR/./IlmImf/ImfTileDescriptionAttribute.cpp ../Source/OpenEXR/./IlmImf/ImfTiledInputFile.cpp ../Source/OpenEXR/./IlmImf/ImfTiledMisc.cpp \
../Source/OpenEXR/./IlmImf/ImfTiledOutputFile.cpp ../Source/OpenEXR/./IlmImf/ImfTiledRgbaFile.cpp ../Source/OpenEXR/./IlmImf/ImfTileOffsets.cpp \
../Source/OpenEXR/./IlmImf/ImfTimeCode.cpp ../Source/OpenEXR/./IlmImf/ImfTimeCodeAttribute.cpp ../Source/OpenEXR/./IlmImf/ImfVecAttribute.cpp \
../Source/OpenEXR/./IlmImf/ImfVersion.cpp ../Source/OpenEXR/./IlmImf/ImfWav.cpp ../Source/OpenEXR/./IlmImf/ImfZipCompressor.cpp \
../Source/OpenEXR/./Imath/ImathBox.cpp ../Source/OpenEXR/./Imath/ImathColorAlgo.cpp ../Source/OpenEXR/./Imath/ImathFun.cpp ../Source/OpenEXR/./Imath/ImathMatrixAlgo.cpp \
../Source/OpenEXR/./Imath/ImathRandom.cpp ../Source/OpenEXR/./Imath/ImathShear.cpp ../Source/OpenEXR/./Imath/ImathVec.cpp ../Source/OpenEXR/./Iex/IexBaseExc.cpp \
../Source/OpenEXR/./Iex/IexThrowErrnoExc.cpp ../Source/OpenEXR/./Half/half.cpp ../Source/OpenEXR/./IlmThread/IlmThread.cpp \
../Source/OpenEXR/./IlmThread/IlmThreadMutex.cpp ../Source/OpenEXR/./IlmThread/IlmThreadPool.cpp ../Source/OpenEXR/./IlmThread/IlmThreadSemaphore.cpp
LOCAL_MODULE := FreeImage


LOCAL_CPP_FEATURES := rtti exceptions
http://www.openscenegraph.org/index.php/documentation/platform-specifics/android/178-building-openscenegraph-for-android-3-4
GLOBAL_CFLAGS  := -O3 -DHAVE_CONFIG_H=1 -DFREEIMAGE_LIB -isystem 


ifeq ($(TARGET_ARCH),x86)
You must build osg with osgdb_dds osgdb_bmp, osgdb_tga ,osgdb_gif ,osgdb_jpeg, osgdb_png plugins and GLES1 profile !
    LOCAL_CFLAGS  := $(GLOBAL_CFLAGS)
else
    LOCAL_CFLAGS  := -mfpu=vfp -mfloat-abi=softfp -fno-short-enums -O3 -fPIC $(GLOBAL_CFLAGS)
endif


LOCAL_C_INCLUDES := $(GLOBAL_C_INCLUDES)
==== Building MyGUI ====
Then you must build mygui with 1 rendering system


include $(BUILD_STATIC_LIBRARY)
==== Building Bullet ====
Then you should build bullet2. You can use cmake android toolchain for it


</syntaxhighlight>
==== Building OpenAL ====
 
Then you must build openal .
Next you must build ogre from source . I build ogre 1.9 with this tutorial .
http://repo.or.cz/w/openal-soft/android.git
http://www.ogre3d.org/tikiwiki/tiki-index.php?page=CMake+Quick+Start+Guide&tikiversion=Android
You must add it
<syntaxhighlight lang="cpp">
if((opt = miscParams->find("externalWindowHandle")) != end)
{
  mWindow = (ANativeWindow*)(Ogre::StringConverter::parseInt(opt->second));
}
</syntaxhighlight>
and it
<syntaxhighlight lang="cpp">
if (!mEglConfig)
{
  _createInternalResources(mWindow, config);
  mHwGamma = false;
}
       
mEglDisplay = mGLSupport->getGLDisplay();
</syntaxhighlight>
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
<syntaxhighlight lang="cmake">
if(ANDROID)
  set(CMAKE_FIND_ROOT_PATH ${OGRE_DEPENDENCIES_DIR} "${CMAKE_FIND_ROOT_PATH}")
endif()
</syntaxhighlight>
Than you must build mygui for ogre
http://mygui.info/
And you should remove this line from cmake file
<syntaxhighlight lang="cmake">
add_definitions(-msse)
</syntaxhighlight>
Than you should build bullet. You can use cmake or ndk-build
https://github.com/bulletphysics/bullet3
Android.mk
<syntaxhighlight lang="cmake">
LOCAL_PATH:= $(call my-dir)
 
include $(CLEAR_VARS)
 
LOCAL_MODULE := bullet
LOCAL_C_INCLUDES := \
  $(LOCAL_PATH)/ \
  $(LOCAL_PATH)/BulletCollision/BroadphaseCollision \
  $(LOCAL_PATH)/BulletCollision/CollisionDispatch \
  $(LOCAL_PATH)/BulletCollision/CollisionShapes \
  $(LOCAL_PATH)/BulletCollision/NarrowPhaseCollision \
  $(LOCAL_PATH)/BulletDynamics/ConstraintSolver \
  $(LOCAL_PATH)/BulletDynamics/Dynamics \
  $(LOCAL_PATH)/BulletDynamics/Vehicle \
  $(LOCAL_PATH)/LinearMath \
  $(LOCAL_PATH)/../libzip/ \
  $(LOCAL_PATH)/../libpng/ \


==== Building Qt (optional) ====


LOCAL_ARM_MODE := arm
Note: Qt is only used by the launcher and OpenMW-CS, and can be skipped.
LOCAL_STATIC_LIBRARIES := libzip libpng 
To build Qt 4.8 for android:
LOCAL_CFLAGS := $(LOCAL_C_INCLUDES:%=-I%) -O3 -DANDROID_NDK
http://necessitas.kde.org/ I used this tutorial for building: https://community.kde.org/Necessitas/CompileQtFramework
LOCAL_LDLIBS := -L$(SYSROOT)/usr/lib -ldl -llog -lGLESv1_CM -lGLESv2 -lz


 
==== Building FFmpeg ====
LOCAL_SRC_FILES := \
Then you must build ffmpeg . Important! You must use ffmpeg 1.26: http://www.roman10.net/how-to-build-ffmpeg-with-ndk-r9/
  BulletMultiThreaded/SpuCollisionObjectWrapper.cpp \
BulletMultiThreaded/SpuSampleTask/SpuSampleTask.cpp \
BulletMultiThreaded/SpuLibspe2Support.cpp \
BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuContactResult.cpp \
BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuGatheringCollisionTask.cpp \
BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuMinkowskiPenetrationDepthSolver.cpp \
BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuCollisionShapes.cpp \
BulletMultiThreaded/btThreadSupportInterface.cpp \
BulletMultiThreaded/SequentialThreadSupport.cpp \
BulletMultiThreaded/SpuGatheringCollisionDispatcher.cpp \
BulletMultiThreaded/Win32ThreadSupport.cpp \
BulletMultiThreaded/SpuFakeDma.cpp \
BulletMultiThreaded/PosixThreadSupport.cpp \
BulletMultiThreaded/SpuCollisionTaskProcess.cpp \
BulletMultiThreaded/SpuContactManifoldCollisionAlgorithm.cpp \
BulletMultiThreaded/SpuSampleTaskProcess.cpp \
BulletMultiThreaded/SpuSampleTask/SpuSampleTask.h \
BulletMultiThreaded/PpuAddressSpace.h \
BulletMultiThreaded/SpuSampleTaskProcess.h \
BulletMultiThreaded/SequentialThreadSupport.h \
BulletMultiThreaded/PlatformDefinitions.h \
BulletMultiThreaded/Win32ThreadSupport.h \
BulletMultiThreaded/SpuContactManifoldCollisionAlgorithm.h \
BulletMultiThreaded/btThreadSupportInterface.h \
BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuGatheringCollisionTask.h \
BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuConvexPenetrationDepthSolver.h \
BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuPreferredPenetrationDirections.h \
BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuCollisionShapes.h \
BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuLocalSupport.h \
BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuMinkowskiPenetrationDepthSolver.h \
BulletMultiThreaded/SpuNarrowPhaseCollisionTask/SpuContactResult.h \
BulletMultiThreaded/SpuGatheringCollisionDispatcher.h \
BulletMultiThreaded/SpuFakeDma.h \
BulletMultiThreaded/SpuSync.h \
BulletMultiThreaded/SpuCollisionObjectWrapper.h \
BulletMultiThreaded/SpuDoubleBuffer.h \
BulletMultiThreaded/SpuCollisionTaskProcess.h \
BulletMultiThreaded/PosixThreadSupport.h \
BulletMultiThreaded/SpuLibspe2Support.h \
BulletMultiThreaded/SpuNarrowPhaseCollisionTask/boxBoxDistance.cpp \
BulletMultiThreaded/SpuNarrowPhaseCollisionTask/boxBoxDistance.h \
BulletMultiThreaded/SpuNarrowPhaseCollisionTask/Box.h\
LinearMath/btQuickprof.cpp \
LinearMath/btGeometryUtil.cpp \
LinearMath/btAlignedAllocator.cpp \
LinearMath/btSerializer.cpp \
LinearMath/btConvexHull.cpp \
LinearMath/btPolarDecomposition.cpp \
LinearMath/btVector3.cpp \
LinearMath/btConvexHullComputer.cpp \
LinearMath/btHashMap.h \
LinearMath/btConvexHull.h \
LinearMath/btAabbUtil2.h \
LinearMath/btGeometryUtil.h \
LinearMath/btQuadWord.h \
LinearMath/btPoolAllocator.h \
LinearMath/btPolarDecomposition.h \
LinearMath/btScalar.h \
LinearMath/btMinMax.h \
LinearMath/btVector3.h \
LinearMath/btList.h \
LinearMath/btStackAlloc.h \
LinearMath/btMatrix3x3.h \
LinearMath/btMotionState.h \
LinearMath/btAlignedAllocator.h \
LinearMath/btQuaternion.h \
LinearMath/btAlignedObjectArray.h \
LinearMath/btQuickprof.h \
LinearMath/btSerializer.h \
LinearMath/btTransformUtil.h \
LinearMath/btTransform.h \
LinearMath/btDefaultMotionState.h \
LinearMath/btIDebugDraw.h \
LinearMath/btRandom.h \
BulletCollision/NarrowPhaseCollision/btRaycastCallback.cpp \
BulletCollision/NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.cpp \
BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.cpp \
BulletCollision/NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.cpp \
BulletCollision/NarrowPhaseCollision/btGjkConvexCast.cpp \
BulletCollision/NarrowPhaseCollision/btPersistentManifold.cpp \
BulletCollision/NarrowPhaseCollision/btConvexCast.cpp \
BulletCollision/NarrowPhaseCollision/btPolyhedralContactClipping.cpp \
BulletCollision/NarrowPhaseCollision/btContinuousConvexCollision.cpp \
BulletCollision/NarrowPhaseCollision/btGjkPairDetector.cpp \
BulletCollision/NarrowPhaseCollision/btGjkEpa2.cpp \
BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.cpp \
BulletCollision/CollisionDispatch/btActivatingCollisionAlgorithm.cpp \
BulletCollision/CollisionDispatch/btCollisionObject.cpp \
BulletCollision/CollisionDispatch/btEmptyCollisionAlgorithm.cpp \
BulletCollision/CollisionDispatch/btGhostObject.cpp \
BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.cpp \
BulletCollision/CollisionDispatch/btSphereBoxCollisionAlgorithm.cpp \
BulletCollision/CollisionDispatch/btCollisionDispatcher.cpp \
BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.cpp \
BulletCollision/CollisionDispatch/btSimulationIslandManager.cpp \
BulletCollision/CollisionDispatch/btBoxBoxDetector.cpp \
BulletCollision/CollisionDispatch/btConvexPlaneCollisionAlgorithm.cpp \
BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.cpp \
BulletCollision/CollisionDispatch/btBoxBoxCollisionAlgorithm.cpp \
BulletCollision/CollisionDispatch/btBox2dBox2dCollisionAlgorithm.cpp \
BulletCollision/CollisionDispatch/SphereTriangleDetector.cpp \
BulletCollision/CollisionDispatch/btInternalEdgeUtility.cpp \
BulletCollision/CollisionDispatch/btManifoldResult.cpp \
BulletCollision/CollisionDispatch/btCollisionWorld.cpp \
BulletCollision/CollisionDispatch/btSphereTriangleCollisionAlgorithm.cpp \
BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.cpp \
BulletCollision/CollisionDispatch/btConvex2dConvex2dAlgorithm.cpp \
BulletCollision/CollisionDispatch/btUnionFind.cpp \
BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.cpp \
BulletCollision/CollisionDispatch/btHashedSimplePairCache.cpp \
BulletCollision/CollisionDispatch/btCompoundCompoundCollisionAlgorithm.cpp \
BulletCollision/CollisionShapes/btTetrahedronShape.cpp \
BulletCollision/CollisionShapes/btShapeHull.cpp \
BulletCollision/CollisionShapes/btMinkowskiSumShape.cpp \
BulletCollision/CollisionShapes/btCompoundShape.cpp \
BulletCollision/CollisionShapes/btConeShape.cpp \
BulletCollision/CollisionShapes/btConvexPolyhedron.cpp \
BulletCollision/CollisionShapes/btMultiSphereShape.cpp \
BulletCollision/CollisionShapes/btUniformScalingShape.cpp \
BulletCollision/CollisionShapes/btSphereShape.cpp \
BulletCollision/CollisionShapes/btTriangleIndexVertexArray.cpp \
BulletCollision/CollisionShapes/btBvhTriangleMeshShape.cpp \
BulletCollision/CollisionShapes/btTriangleMeshShape.cpp \
BulletCollision/CollisionShapes/btTriangleBuffer.cpp \
BulletCollision/CollisionShapes/btStaticPlaneShape.cpp \
BulletCollision/CollisionShapes/btPolyhedralConvexShape.cpp \
BulletCollision/CollisionShapes/btEmptyShape.cpp \
BulletCollision/CollisionShapes/btCollisionShape.cpp \
BulletCollision/CollisionShapes/btConvexShape.cpp \
BulletCollision/CollisionShapes/btConvex2dShape.cpp \
BulletCollision/CollisionShapes/btConvexInternalShape.cpp \
BulletCollision/CollisionShapes/btConvexHullShape.cpp \
BulletCollision/CollisionShapes/btTriangleCallback.cpp \
BulletCollision/CollisionShapes/btCapsuleShape.cpp \
BulletCollision/CollisionShapes/btConvexTriangleMeshShape.cpp \
BulletCollision/CollisionShapes/btConcaveShape.cpp \
BulletCollision/CollisionShapes/btConvexPointCloudShape.cpp \
BulletCollision/CollisionShapes/btBoxShape.cpp \
BulletCollision/CollisionShapes/btBox2dShape.cpp \
BulletCollision/CollisionShapes/btOptimizedBvh.cpp \
BulletCollision/CollisionShapes/btHeightfieldTerrainShape.cpp \
BulletCollision/CollisionShapes/btMultimaterialTriangleMeshShape.cpp \
BulletCollision/CollisionShapes/btCylinderShape.cpp \
BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.cpp \
BulletCollision/CollisionShapes/btStridingMeshInterface.cpp \
BulletCollision/CollisionShapes/btTriangleIndexVertexMaterialArray.cpp \
BulletCollision/CollisionShapes/btTriangleMesh.cpp \
BulletCollision/BroadphaseCollision/btAxisSweep3.cpp \
BulletCollision/BroadphaseCollision/btOverlappingPairCache.cpp \
BulletCollision/BroadphaseCollision/btDbvtBroadphase.cpp \
BulletCollision/BroadphaseCollision/btMultiSapBroadphase.cpp \
BulletCollision/BroadphaseCollision/btDispatcher.cpp \
BulletCollision/BroadphaseCollision/btBroadphaseProxy.cpp \
BulletCollision/BroadphaseCollision/btQuantizedBvh.cpp \
BulletCollision/BroadphaseCollision/btCollisionAlgorithm.cpp \
BulletCollision/BroadphaseCollision/btDbvt.cpp \
BulletCollision/BroadphaseCollision/btSimpleBroadphase.cpp \
BulletCollision/NarrowPhaseCollision/btGjkEpaPenetrationDepthSolver.h \
BulletCollision/NarrowPhaseCollision/btVoronoiSimplexSolver.h \
BulletCollision/NarrowPhaseCollision/btConvexCast.h \
BulletCollision/NarrowPhaseCollision/btGjkEpa2.h \
BulletCollision/NarrowPhaseCollision/btGjkPairDetector.h \
BulletCollision/NarrowPhaseCollision/btMinkowskiPenetrationDepthSolver.h \
BulletCollision/NarrowPhaseCollision/btPointCollector.h \
BulletCollision/NarrowPhaseCollision/btConvexPenetrationDepthSolver.h \
BulletCollision/NarrowPhaseCollision/btSimplexSolverInterface.h \
BulletCollision/NarrowPhaseCollision/btRaycastCallback.h \
BulletCollision/NarrowPhaseCollision/btContinuousConvexCollision.h \
BulletCollision/NarrowPhaseCollision/btSubSimplexConvexCast.h \
BulletCollision/NarrowPhaseCollision/btPersistentManifold.h \
BulletCollision/NarrowPhaseCollision/btGjkConvexCast.h \
BulletCollision/NarrowPhaseCollision/btManifoldPoint.h \
BulletCollision/NarrowPhaseCollision/btDiscreteCollisionDetectorInterface.h \
BulletCollision/CollisionDispatch/btCollisionObject.h \
BulletCollision/CollisionDispatch/btCollisionObjectWrapper.h \
BulletCollision/CollisionDispatch/btGhostObject.h \
BulletCollision/CollisionDispatch/btSphereTriangleCollisionAlgorithm.h \
BulletCollision/CollisionDispatch/btBoxBoxCollisionAlgorithm.h \
BulletCollision/CollisionDispatch/btBox2dBox2dCollisionAlgorithm.h \
BulletCollision/CollisionDispatch/btConvexPlaneCollisionAlgorithm.h \
BulletCollision/CollisionDispatch/btEmptyCollisionAlgorithm.h \
BulletCollision/CollisionDispatch/btCollisionCreateFunc.h \
BulletCollision/CollisionDispatch/btConvexConvexAlgorithm.h \
BulletCollision/CollisionDispatch/btConvex2dConvex2dAlgorithm.h \
BulletCollision/CollisionDispatch/btBoxBoxDetector.h \
BulletCollision/CollisionDispatch/btCollisionDispatcher.h \
BulletCollision/CollisionDispatch/SphereTriangleDetector.h \
BulletCollision/CollisionDispatch/btConvexConcaveCollisionAlgorithm.h \
BulletCollision/CollisionDispatch/btUnionFind.h \
BulletCollision/CollisionDispatch/btCompoundCollisionAlgorithm.h \
BulletCollision/CollisionDispatch/btHashedSimplePairCache.h \
BulletCollision/CollisionDispatch/btCompoundCompoundCollisionAlgorithm.h \
BulletCollision/CollisionDispatch/btSimulationIslandManager.h \
BulletCollision/CollisionDispatch/btDefaultCollisionConfiguration.h \
BulletCollision/CollisionDispatch/btCollisionWorld.h \
BulletCollision/CollisionDispatch/btInternalEdgeUtility.h \
BulletCollision/CollisionDispatch/btManifoldResult.h \
BulletCollision/CollisionDispatch/btSphereSphereCollisionAlgorithm.h \
BulletCollision/CollisionDispatch/btSphereBoxCollisionAlgorithm.h \
BulletCollision/CollisionDispatch/btCollisionConfiguration.h \
BulletCollision/CollisionShapes/btConvexShape.h \
BulletCollision/CollisionShapes/btConvex2dShape.h \
BulletCollision/CollisionShapes/btTriangleCallback.h \
BulletCollision/CollisionShapes/btPolyhedralConvexShape.h \
BulletCollision/CollisionShapes/btMultimaterialTriangleMeshShape.h \
BulletCollision/CollisionShapes/btCompoundShape.h \
BulletCollision/CollisionShapes/btBoxShape.h \
BulletCollision/CollisionShapes/btBox2dShape.h \
BulletCollision/CollisionShapes/btMultiSphereShape.h \
BulletCollision/CollisionShapes/btCollisionMargin.h \
BulletCollision/CollisionShapes/btConcaveShape.h \
BulletCollision/CollisionShapes/btConvexTriangleMeshShape.h \
BulletCollision/CollisionShapes/btEmptyShape.h \
BulletCollision/CollisionShapes/btUniformScalingShape.h \
BulletCollision/CollisionShapes/btScaledBvhTriangleMeshShape.h \
BulletCollision/CollisionShapes/btMaterial.h \
BulletCollision/CollisionShapes/btTriangleIndexVertexArray.h \
BulletCollision/CollisionShapes/btTriangleInfoMap.h \
BulletCollision/CollisionShapes/btSphereShape.h \
BulletCollision/CollisionShapes/btConvexPointCloudShape.h \
BulletCollision/CollisionShapes/btCapsuleShape.h \
BulletCollision/CollisionShapes/btHeightfieldTerrainShape.h \
BulletCollision/CollisionShapes/btCollisionShape.h \
BulletCollision/CollisionShapes/btStaticPlaneShape.h \
BulletCollision/CollisionShapes/btBvhTriangleMeshShape.h \
BulletCollision/CollisionShapes/btTriangleMeshShape.h \
BulletCollision/CollisionShapes/btStridingMeshInterface.h \
BulletCollision/CollisionShapes/btTriangleMesh.h \
BulletCollision/CollisionShapes/btTriangleBuffer.h \
BulletCollision/CollisionShapes/btShapeHull.h \
BulletCollision/CollisionShapes/btMinkowskiSumShape.h \
BulletCollision/CollisionShapes/btOptimizedBvh.h \
BulletCollision/CollisionShapes/btTriangleShape.h \
BulletCollision/CollisionShapes/btTriangleIndexVertexMaterialArray.h \
BulletCollision/CollisionShapes/btCylinderShape.h \
        BulletCollision/CollisionShapes/btTetrahedronShape.h \
        BulletCollision/CollisionShapes/btConvexInternalShape.h \
BulletCollision/CollisionShapes/btConeShape.h \
BulletCollision/CollisionShapes/btConvexHullShape.h \
BulletCollision/BroadphaseCollision/btAxisSweep3.h \
BulletCollision/BroadphaseCollision/btDbvtBroadphase.h \
BulletCollision/BroadphaseCollision/btSimpleBroadphase.h \
BulletCollision/BroadphaseCollision/btMultiSapBroadphase.h \
BulletCollision/BroadphaseCollision/btDbvt.h \
BulletCollision/BroadphaseCollision/btOverlappingPairCallback.h \
BulletCollision/BroadphaseCollision/btDispatcher.h \
BulletCollision/BroadphaseCollision/btCollisionAlgorithm.h \
BulletCollision/BroadphaseCollision/btBroadphaseProxy.h \
BulletCollision/BroadphaseCollision/btOverlappingPairCache.h \
BulletCollision/BroadphaseCollision/btBroadphaseInterface.h \
        BulletCollision/BroadphaseCollision/btQuantizedBvh.h \
        BulletCollision/Gimpact/btGImpactBvh.cpp\
                BulletCollision/Gimpact/btGImpactQuantizedBvh.cpp\
                BulletCollision/Gimpact/btTriangleShapeEx.cpp\
                BulletCollision/Gimpact/btGImpactCollisionAlgorithm.cpp\
                BulletCollision/Gimpact/btGImpactShape.cpp\
                BulletCollision/Gimpact/gim_box_set.cpp\
                BulletCollision/Gimpact/gim_contact.cpp\
                BulletCollision/Gimpact/gim_memory.cpp\
                BulletCollision/Gimpact/gim_tri_collision.cpp \
        BulletDynamics/Dynamics/btRigidBody.cpp \
        BulletDynamics/Dynamics/btSimpleDynamicsWorld.cpp \
        BulletDynamics/Dynamics/Bullet-C-API.cpp \
        BulletDynamics/Dynamics/btDiscreteDynamicsWorld.cpp \
        BulletDynamics/ConstraintSolver/btFixedConstraint.cpp \
        BulletDynamics/ConstraintSolver/btGearConstraint.cpp \
        BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.cpp \
        BulletDynamics/ConstraintSolver/btGeneric6DofSpringConstraint.cpp \
        BulletDynamics/ConstraintSolver/btSolve2LinearConstraint.cpp \
        BulletDynamics/ConstraintSolver/btPoint2PointConstraint.cpp \
        BulletDynamics/ConstraintSolver/btTypedConstraint.cpp \
        BulletDynamics/ConstraintSolver/btContactConstraint.cpp \
        BulletDynamics/ConstraintSolver/btSliderConstraint.cpp \
        BulletDynamics/ConstraintSolver/btConeTwistConstraint.cpp \
        BulletDynamics/ConstraintSolver/btHingeConstraint.cpp \
        BulletDynamics/ConstraintSolver/btHinge2Constraint.cpp \
        BulletDynamics/ConstraintSolver/btUniversalConstraint.cpp \
        BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.cpp \
        BulletDynamics/Vehicle/btWheelInfo.cpp \
        BulletDynamics/Vehicle/btRaycastVehicle.cpp \
        BulletDynamics/Character/btKinematicCharacterController.cpp \
        BulletDynamics/Character/btKinematicCharacterController.h \
        BulletDynamics/Character/btCharacterControllerInterface.h \
        BulletDynamics/Dynamics/btActionInterface.h \
        BulletDynamics/Dynamics/btSimpleDynamicsWorld.h \
BulletDynamics/Dynamics/btRigidBody.h \
        BulletDynamics/Dynamics/btDiscreteDynamicsWorld.h \
BulletDynamics/Dynamics/btDynamicsWorld.h \
BulletDynamics/ConstraintSolver/btSolverBody.h \
BulletDynamics/ConstraintSolver/btConstraintSolver.h \
BulletDynamics/ConstraintSolver/btConeTwistConstraint.h \
BulletDynamics/ConstraintSolver/btTypedConstraint.h \
BulletDynamics/ConstraintSolver/btContactSolverInfo.h \
BulletDynamics/ConstraintSolver/btContactConstraint.h \
BulletDynamics/ConstraintSolver/btPoint2PointConstraint.h \
BulletDynamics/ConstraintSolver/btJacobianEntry.h \
BulletDynamics/ConstraintSolver/btSolverConstraint.h \
BulletDynamics/ConstraintSolver/btSequentialImpulseConstraintSolver.h \
BulletDynamics/ConstraintSolver/btGearConstraint.h \
BulletDynamics/ConstraintSolver/btGeneric6DofConstraint.h \
BulletDynamics/ConstraintSolver/btGeneric6DofSpringConstraint.h \
BulletDynamics/ConstraintSolver/btSliderConstraint.h \
BulletDynamics/ConstraintSolver/btHingeConstraint.h \
BulletDynamics/ConstraintSolver/btHinge2Constraint.h \
BulletDynamics/ConstraintSolver/btUniversalConstraint.h \
BulletDynamics/ConstraintSolver/btSolve2LinearConstraint.h \
BulletDynamics/Vehicle/btVehicleRaycaster.h \
BulletDynamics/Vehicle/btRaycastVehicle.h \
BulletDynamics/Vehicle/btWheelInfo.h \
BulletDynamics/Featherstone/btMultiBody.cpp \
        BulletDynamics/Featherstone/btMultiBodyConstraintSolver.cpp \
BulletDynamics/Featherstone/btMultiBodyDynamicsWorld.cpp \
BulletDynamics/Featherstone/btMultiBodyJointMotor.cpp \
BulletDynamics/Featherstone/btMultiBodyJointLimitConstraint.cpp \
BulletDynamics/Featherstone/btMultiBodyJointMotor.h \
                BulletDynamics/Featherstone/btMultiBodyJointLimitConstraint.h \
BulletDynamics/Featherstone/btMultiBody.h \
BulletDynamics/Featherstone/btMultiBodyConstraintSolver.h \
BulletDynamics/Featherstone/btMultiBodyDynamicsWorld.h \
BulletDynamics/Featherstone/btMultiBodyLink.h \
BulletDynamics/Featherstone/btMultiBodyLinkCollider.h \
BulletDynamics/Featherstone/btMultiBodySolverConstraint.h \
BulletDynamics/Featherstone/btMultiBodyConstraint.h \
BulletDynamics/Featherstone/btMultiBodyPoint2Point.h \
BulletDynamics/Featherstone/btMultiBodyConstraint.cpp \
BulletDynamics/Featherstone/btMultiBodyPoint2Point.cpp \
BulletDynamics/MLCPSolvers/btDantzigLCP.cpp \
                BulletDynamics/MLCPSolvers/btMLCPSolver.cpp \
BulletDynamics/MLCPSolvers/btDantzigLCP.h \
        BulletDynamics/MLCPSolvers/btDantzigSolver.h \
        BulletDynamics/MLCPSolvers/btMLCPSolver.h \
        BulletDynamics/MLCPSolvers/btMLCPSolverInterface.h \
        BulletDynamics/MLCPSolvers/btPATHSolver.h \
        BulletDynamics/MLCPSolvers/btSolveProjectedGaussSeidel.h \
        BulletSoftBody/btDefaultSoftBodySolver.cpp \
BulletSoftBody/btSoftBodyRigidBodyCollisionConfiguration.cpp \
BulletSoftBody/btSoftBody.cpp \
BulletSoftBody/btSoftRigidCollisionAlgorithm.cpp \
BulletSoftBody/btSoftBodyConcaveCollisionAlgorithm.cpp \
BulletSoftBody/btSoftRigidDynamicsWorld.cpp \
BulletSoftBody/btSoftBodyHelpers.cpp \
BulletSoftBody/btSoftSoftCollisionAlgorithm.cpp \
BulletSoftBody/btSparseSDF.h \
BulletSoftBody/btSoftRigidCollisionAlgorithm.h \
BulletSoftBody/btSoftBodyRigidBodyCollisionConfiguration.h \
BulletSoftBody/btSoftBody.h \
BulletSoftBody/btSoftSoftCollisionAlgorithm.h \
BulletSoftBody/btSoftBodyInternals.h \
BulletSoftBody/btSoftBodyConcaveCollisionAlgorithm.h \
BulletSoftBody/btSoftRigidDynamicsWorld.h \
BulletSoftBody/btSoftBodyHelpers.h
 
include $(BUILD_SHARED_LIBRARY)
</syntaxhighlight>
Than you must build openal .
http://repo.or.cz/w/openal-soft/android.git
Than you nust build qt 4.8 for android
http://necessitas.kde.org/ I used this tutorual for building: https://community.kde.org/Necessitas/CompileQtFramework
Than 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
my script for build
Line 588: Line 58:
./configure \
./configure \
     --prefix=$(pwd)/android/$CPU  \
     --prefix=$(pwd)/android/$CPU  \
     --enable-shared \
     --enable-static \
    --disable-static \
     --disable-doc \
     --disable-doc \
     --disable-ffmpeg \
     --disable-ffmpeg \
Line 606: Line 75:
     --extra-ldflags="$ADDI_LDFLAGS"
     --extra-ldflags="$ADDI_LDFLAGS"
</syntaxhighlight>
</syntaxhighlight>
Than you must build SDL2: https://www.libsdl.org/hg.php
I used Sdl2 mercurial latest source.


then I started to build OpenMW. At first you must remove all lines associated with x server in FindOGRE.cmake
==== Building SDL2 ====
and add GLES2 instead GLES .
Then you must build SDL2: https://www.libsdl.org/hg.php
For example
I used SDL2 mercurial latest source.
<syntaxhighlight lang="cmake">
 
ogre_find_plugin(RenderSystem_GLES2 OgreGLES2RenderSystem.h RenderSystems/GLES2/include)
=== Building OpenMW ===
</syntaxhighlight>
Then I started to build OpenMW.  
next I add this to main cmake file:
I copied all  libraries  in one folder . For example AndroidDependencies, and build openmw like this
<syntaxhighlight lang="cmake">
 
set(CMAKE_FIND_ROOT_PATH ${OPENMW_DEPENDENCIES_DIR} "${CMAKE_FIND_ROOT_PATH}")
</syntaxhighlight>
And now I can build OpenMW with it
<syntaxhighlight lang="bash">
<syntaxhighlight lang="bash">
cmake /home/sylar/openmw -DCMAKE_TOOLCHAIN_FILE=/home/sylar/android-cmake-master/android.toolchain.cmake -DOPENMW_DEPENDENCIES_DIR=/home/sylar/AndroidDependencies -DANDROID_NATIVE_API_LEVEL=14
cmake /home/sandstranger/Android/openmw -DCMAKE_TOOLCHAIN_FILE=/home/sandstranger/Android/android-cmake-master/android.toolchain.cmake -DANDROID_TOOLCHAIN_NAME=aarch64-linux-android-4.9 -DANDROID_NATIVE_API_LEVEL=android-21 -DANDROID_NDK=/home/sandstranger/Android/crystax-ndk-10.1.0/ -DANDROID_ABI=arm64-v8a -DOPENMW_DEPENDENCIES_DIR=/home/sandstranger/Android/AndroidDependenciesARMV8 -DOSG_PLUGINS_DIR=/home/sandstranger/Android/AndroidDependenciesARMV8/lib/osgPlugins-3.5.1 -DBUILD_BSATOOL=OFF -DBUILD_ESMTOOL=OFF -DBUILD_LAUNCHER=OFF -DBUILD_MWINIIMPORTER=OFF -DBUILD_ESSIMPORTER=OFF -DBUILD_OPENCS=OFF -DBUILD_WIZARD=OFF -DBUILD_MYGUI_PLUGIN=OFF -DMYGUI_STATIC=ON -DBOOST_STATIC=ON
</syntaxhighlight>
next I remove line from main cmake file:
<syntaxhighlight lang="cmake">
add_static_ogre_plugin(RenderSystem_GL)
</syntaxhighlight>
and add it
<syntaxhighlight lang="cmake">
add_static_ogre_plugin(RenderSystem_GLES2)
</syntaxhighlight>
</syntaxhighlight>
Next I add I remove line
<syntaxhighlight lang="cmake">
add_library(openmw executable
    ${OPENMW_LIBS} ${OPENMW_LIBS_HEADER}
    ${OPENMW_FILES}
    ${GAME} ${GAME_HEADER}
    ${APPLE_BUNDLE_RESOURCES}
)
</syntaxhighlight>
in /openmw/apps/openmw/Cmakelists.txt
and add it
<syntaxhighlight lang="cmake">
add_library(main SHARED
    ${OPENMW_LIBS} ${OPENMW_LIBS_HEADER}
    ${OPENMW_FILES}
    ${GAME} ${GAME_HEADER}
    ${APPLE_BUNDLE_RESOURCES}
)
</syntaxhighlight>
also I add it
<syntaxhighlight lang="cmake">
set(GAME
    main.cpp
    SDL_android_main.c
    engine.cpp
)
#//if(NOT WIN32)
# //  set(GAME ${GAME} crashcatcher.cpp)
#endif()
# Main executable
set(BOOST_COMPONENTS system filesystem program_options thread wave atomic)
target_link_libraries(main
${OGRE_STATIC_PLUGINS}
#RenderSystem_GLES2Static
#//Plugin_OctreeSceneManagerStatic
#//Plugin_ParticleFXStatic
#  ${OGRE_Plugin_OctreeSceneManager_LIBRARY_REL} 
# ${OGRE_Plugin_ParticleFX_LIBRARY_REL}   
#${OGRE_RenderSystem_GLES2_LIBRARY_REL} 
)


target_link_libraries(main
-O2 or -Os optimal optimizations flags for building . Without this flags fps will be very low
EGL
android
log
dl


#  ${OGRE_Plugin_OctreeSceneManager_LIBRARY_REL} 
After builing openmw library, you must copy all the libraries to libs folder in the  java project folder
# ${OGRE_Plugin_ParticleFX_LIBRARY_REL}   
#${OGRE_RenderSystem_GLES2_LIBRARY_REL} 
)
target_link_libraries(main
boost_atomic
boost_chrono
boost_date_time
boost_filesystem
boost_program_options
boost_system
boost_thread
boost_wave
#  ${OGRE_Plugin_OctreeSceneManager_LIBRARY_REL} 
# ${OGRE_Plugin_ParticleFX_LIBRARY_REL}   
#${OGRE_RenderSystem_GLES2_LIBRARY_REL} 
)
target_link_libraries(main
FreeImage
freetype
#  ${OGRE_Plugin_OctreeSceneManager_LIBRARY_REL} 
# ${OGRE_Plugin_ParticleFX_LIBRARY_REL}   
#${OGRE_RenderSystem_GLES2_LIBRARY_REL} 
)
 
target_link_libraries(main
OgreMainStatic
#  ${OGRE_Plugin_OctreeSceneManager_LIBRARY_REL} 
# ${OGRE_Plugin_ParticleFX_LIBRARY_REL}   
#${OGRE_RenderSystem_GLES2_LIBRARY_REL} 
)
 
target_link_libraries(main
MyGUI.OgrePlatform
MyGUIEngineStatic
Plugin_StrangeButtonStatic
cpufeatures
#  ${OGRE_Plugin_OctreeSceneManager_LIBRARY_REL} 
# ${OGRE_Plugin_ParticleFX_LIBRARY_REL}   
#${OGRE_RenderSystem_GLES2_LIBRARY_REL} 
)
</syntaxhighlight>
Next I changed paths in: /openmw/components/files/linuxpath.cpp
for example
<syntaxhighlight lang="cpp">
return getEnv("XDG_DATA_HOME", "/sdcard/morrowind/share") / mName;
</syntaxhighlight>
Next I add patch in ogreinit.cpp and ogreinit.hpp
I comment it
<syntaxhighlight lang="cpp">
// Set up logging first
  //    new Ogre::LogManager;
    //  Ogre::Log *log = Ogre::LogManager::getSingleton().createLog(logPath);


  // #if OGRE_PLATFORM == OGRE_PLATFORM_WIN32
For example :  /eclipse-project/app/src/main/jniLibs/armeabi-v7a
        // Use custom listener only on Windows
      // log->addListener(new LogListener(logPath));
//  #endif


        // Disable logging to cout/cerr
Then you must import this [https://github.com/OpenMW/eclipse-project java project] in android-studio , which included with the android sdk.
      // log->setDebugOutputEnabled(false);
</syntaxhighlight>
and change plugin gl on gles2
<syntaxhighlight lang="cpp">
#ifdef ENABLE_PLUGIN_GLES2
# include "OgreGLES2Plugin.h"
#endif


#ifdef ENABLE_PLUGIN_GLES2
Also you need to import the configuration files from desktop openmw version.
        Ogre::GLES2Plugin* mGLES2Plugin;
        #endif
</syntaxhighlight>
Next you must add it to
<syntaxhighlight lang="cpp">
opt["externalWindowHandle"] = Ogre::StringConverter::toString((int) wmInfo.info.android.window );
  opt["externalSurface"] = Ogre::StringConverter::toString((int) wmInfo.info.android.surface );
</syntaxhighlight>
  /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
=== Building Gotchas ===


<pre>
CMake Error at /home/bcurtis/workspace/OpenMW/android/android-cmake/android.toolchain.cmake:429 (math):
  math cannot parse the expression: "+0": syntax error, unexpected exp_PLUS,
  expecting exp_OPENPARENT or exp_NUMBER (1)
Call Stack (most recent call first):
  /home/bcurtis/workspace/OpenMW/android/build/CMakeFiles/3.2.2/CMakeSystem.cmake:6 (include)
  CMakeLists.txt:1 (project)
</pre>


Next for eclipse project I use android-project example from SDL
Don't panic, this can be worked around with the removal (or comment '#') of the non-critical line in the file android-cmake/android.toolchain.cmake on line 429.
and use README-android.txt tutorial from sdl
Next you must change shaders
<syntaxhighlight lang="diff">
diff --git a/files/materials/atmosphere.shader b/files/materials/atmosphere.shader
index f02c576..c8a8e02 100644
--- a/files/materials/atmosphere.shader
+++ b/files/materials/atmosphere.shader
@@ -33,7 +33,7 @@
    SH_START_PROGRAM
    {
-        shOutputColour(0) = alphaFade * atmosphereColour + (1.f - alphaFade) * horizonColour;
+        shOutputColour(0) = alphaFade * atmosphereColour + (1.0 - alphaFade) * horizonColour;
    }
#endif
diff --git a/files/materials/clouds.shader b/files/materials/clouds.shader
index d3e5f08..9e9b102 100644
--- a/files/materials/clouds.shader
+++ b/files/materials/clouds.shader
@@ -25,7 +25,7 @@
        shOutputPosition = shMatrixMult(proj, shMatrixMult(worldviewFixed, shInputPosition));
        UV = uv0;
-            alphaFade = (shInputPosition.z <= 200.f) ? ((shInputPosition.z <= 100.f) ? 0.0 : 0.25) : 1.0;
+            alphaFade = (shInputPosition.z <= 200.0) ? ((shInputPosition.z <= 100.0) ? 0.0 : 0.25) : 1.0;
    }
#else
diff --git a/files/materials/mygui.shader b/files/materials/mygui.shader
index 014558d..4d12eba 100644
--- a/files/materials/mygui.shader
+++ b/files/materials/mygui.shader
@@ -14,7 +14,7 @@
    SH_START_PROGRAM
    {
-        shOutputPosition = float4(shInputPosition.xyz, 1.f);
+        shOutputPosition = float4(shInputPosition.xyz, 1.0);
#if TEXTURE
        UV.xy = uv0;
#endif
diff --git a/files/materials/objects.shader b/files/materials/objects.shader
index ed75bab..bacf3f9 100644
--- a/files/materials/objects.shader
+++ b/files/materials/objects.shader
@@ -210,11 +210,11 @@
#if VERTEXCOLOR_MODE == 2
            lightResult.xyz += colour.xyz * lightDiffuse[@shIterator].xyz
                    * shSaturate(1.0 / ((lightAttenuation[@shIterator].y) + (lightAttenuation[@shIterator].z * d) + (lightAttenuation[@shIterator].w * d * d)))
-                    * max(dot(viewNormal.xyz, lightDir), 0);
+                    * max(dot(viewNormal.xyz, lightDir), 0.0);
#else
            lightResult.xyz += materialDiffuse.xyz * lightDiffuse[@shIterator].xyz
                    * shSaturate(1.0 / ((lightAttenuation[@shIterator].y) + (lightAttenuation[@shIterator].z * d) + (lightAttenuation[@shIterator].w * d * d)))
-                    * max(dot(viewNormal.xyz, lightDir), 0);
+                    * max(dot(viewNormal.xyz, lightDir), 0.0);
#endif
#if @shIterator == 0
@@ -432,11 +432,11 @@
#if VERTEXCOLOR_MODE == 2
            lightResult.xyz += colourPassthrough.xyz * lightDiffuse[@shIterator].xyz
                    * shSaturate(1.0 / ((lightAttenuation[@shIterator].y) + (lightAttenuation[@shIterator].z * d) + (lightAttenuation[@shIterator].w * d * d)))
-                    * max(dot(viewNormal.xyz, lightDir), 0);
+                    * max(dot(viewNormal.xyz, lightDir), 0.0);
#else
            lightResult.xyz += materialDiffuse.xyz * lightDiffuse[@shIterator].xyz
                    * shSaturate(1.0 / ((lightAttenuation[@shIterator].y) + (lightAttenuation[@shIterator].z * d) + (lightAttenuation[@shIterator].w * d * d)))
-                    * max(dot(viewNormal.xyz, lightDir), 0);
+                    * max(dot(viewNormal.xyz, lightDir), 0.0);
#endif
#if @shIterator == 0
@@ -504,8 +504,8 @@
#if ENV_MAP
        // Everything looks better with fresnel
-        float facing = 1.0 - max(abs(dot(-eyeDir, normal)), 0);
-        float envFactor = shSaturate(0.25 + 0.75 * pow(facing, 1));
+        float facing = 1.0 - max(abs(dot(-eyeDir, normal)), 0.0);
+        float envFactor = shSaturate(0.25 + 0.75 * pow(facing, 1.0));
        shOutputColour(0).xyz += shSample(envMap, UV.zw).xyz * envFactor * env_map_color;
#endif
@@ -513,7 +513,7 @@
#if SPECULAR
        float3 light0Dir = normalize(lightPosObjSpace0.xyz);
-       float NdotL = max(dot(normal, light0Dir), 0);
+        float NdotL = max(dot(normal, light0Dir), 0.0);
        float3 halfVec = normalize (light0Dir + eyeDir);
        float shininess = matShininess;
@@ -522,7 +522,7 @@
        shininess *= (specTex.a);
#endif
-        float3 specular = pow(max(dot(normal, halfVec), 0), shininess) * lightSpec0 * matSpec;
+        float3 specular = pow(max(dot(normal, halfVec), 0.0), shininess) * lightSpec0 * matSpec;
#if SPEC_MAP
        specular *= specTex.xyz;
#else
diff --git a/files/materials/terrain.shader b/files/materials/terrain.shader
index 1436de0..8384588 100644
--- a/files/materials/terrain.shader
+++ b/files/materials/terrain.shader
@@ -175,7 +175,7 @@
            lightResult.xyz += lightDiffuse[@shIterator].xyz
                    * shSaturate(1.0 / ((lightAttenuation[@shIterator].y) + (lightAttenuation[@shIterator].z * d) + (lightAttenuation[@shIterator].w * d * d)))
-                    * max(dot(normal.xyz, lightDir), 0);
+                    * max(dot(normal.xyz, lightDir), 0.0);
#if @shIterator == 0
            directionalResult = lightResult.xyz;
@@ -310,7 +310,7 @@ shUniform(float4, cameraPos) @shAutoConstant(cameraPos, camera_position)
#if !IS_FIRST_PASS
// Opacity the previous passes should have, i.e. 1 - (opacity of this pass)
-float previousAlpha = 1.f;
+float previousAlpha = 1.0;
#endif
@@ -334,7 +334,7 @@ float2 blendUV = (UV - 0.5) * (16.0 / (16.0+1.0)) + 0.5;
        float4 albedo = float4(0,0,0,1);
-        float2 layerUV = float2(UV.x, 1.f-UV.y) * 16; // Reverse Y, required to get proper tangents
+        float2 layerUV = float2(UV.x, 1.0-UV.y) * 16.0; // Reverse Y, required to get proper tangents
        float2 thisLayerUV;
        float4 normalTex;
        float4 diffuseTex;
@@ -349,9 +349,9 @@ float2 blendUV = (UV - 0.5) * (16.0 / (16.0+1.0)) + 0.5;
#if @shPropertyBool(use_normal_map_@shIterator)
        normalTex = shSample(normalMap@shIterator, thisLayerUV);
#if @shIterator == 0 && IS_FIRST_PASS
-        TSnormal = normalize(normalTex.xyz * 2 - 1);
+        TSnormal = normalize(normalTex.xyz * 2.0 - 1.0);
#else
-        TSnormal = shLerp(TSnormal, normalTex.xyz * 2 - 1, blendValues@shPropertyString(blendmap_component_@shIterator));
+        TSnormal = shLerp(TSnormal, normalTex.xyz * 2.0 - 1.0, blendValues@shPropertyString(blendmap_component_@shIterator));
#endif
#endif
@@ -361,7 +361,7 @@ float2 blendUV = (UV - 0.5) * (16.0 / (16.0+1.0)) + 0.5;
        diffuseTex = shSample(diffuseMap@shIterator, layerUV);
#if !@shPropertyBool(use_specular_@shIterator)
-        diffuseTex.a = 0;
+        diffuseTex.a = 0.0;
#endif
#if @shIterator == 0
@@ -371,7 +371,7 @@ albedo = shLerp(albedo, diffuseTex, blendValues@shPropertyString(blendmap_compon
#endif
#if !IS_FIRST_PASS
-        previousAlpha *= 1.f-blendValues@shPropertyString(blendmap_component_@shIterator);
+        previousAlpha *= 1.0-blendValues@shPropertyString(blendmap_component_@shIterator);
#endif
@@ -404,7 +404,7 @@ albedo = shLerp(albedo, diffuseTex, blendValues@shPropertyString(blendmap_compon
            lightResult.xyz += lightDiffuse[@shIterator].xyz
                    * shSaturate(1.0 / ((lightAttenuation[@shIterator].y) + (lightAttenuation[@shIterator].z * d) + (lightAttenuation[@shIterator].w * d * d)))
-                    * max(dot(normal.xyz, lightDir), 0);
+                    * max(dot(normal.xyz, lightDir), 0.0);
#if @shIterator == 0
            float3 directionalResult = lightResult.xyz;
#endif
@@ -444,10 +444,10 @@ albedo = shLerp(albedo, diffuseTex, blendValues@shPropertyString(blendmap_compon
        // Specular
        float3 light0Dir = normalize(lightPos0.xyz);
-        float NdotL = max(dot(normal, light0Dir), 0);
+        float NdotL = max(dot(normal, light0Dir), 0.0);
        float3 halfVec = normalize (light0Dir + eyeDir);
-        float3 specular = pow(max(dot(normal, halfVec), 0), 32) * lightSpec0;
+        float3 specular = pow(max(dot(normal, halfVec), 0.0), 32.0) * lightSpec0;
        shOutputColour(0).xyz += specular * (albedo.a) * shadow;
#endif
@@ -465,9 +465,9 @@ albedo = shLerp(albedo, diffuseTex, blendValues@shPropertyString(blendmap_compon
        shOutputColour(0).xyz = max(shOutputColour(0).xyz, float3(0,0,0));
#if IS_FIRST_PASS
-        shOutputColour(0).a = 1;
+        shOutputColour(0).a = 1.0;
#else
-        shOutputColour(0).a = 1.f-previousAlpha;
+        shOutputColour(0).a = 1.0-previousAlpha;
#endif
    }
</syntaxhighlight>
and add this line to all textures_units
<syntaxhighlight lang="cpp">
filtering linear linear none
</syntaxhighlight>

Latest revision as of 11:12, 30 December 2015

Android build OpenMW

Preparation of building environment

Before you start building OpenMW on Android you have to do few steps of preparation:

  1. Download Crystax NDK

Openmw building without errors only on crystax ndk 10.1.0 version.

  1. Download Cmake for Android (it will be used for OpenMW and its dependencies compilation)
  2. Download java
  3. Download all OpenMW dependencies, ie:

Prebuilt openmw dependencies for armv7 arch https://drive.google.com/file/d/0B5mOME9qjLFuckRrSWd6ZTMtZGM/view?usp=sharing

Prebuilt openmw dependencies for armv8 arch https://drive.google.com/file/d/0B5mOME9qjLFuVkpRc2FWb3h1SW8/view?usp=sharing

Compilation of OpenMW dependencies

Then you should add PATH for crystax ndk and google sdk.

Building OSG

Next you must build OSG from source. I build osg with this tutorials .

http://www.openscenegraph.org/index.php/documentation/platform-specifics/android/43-building-openscenegraph-for-android-3-0-2

http://www.openscenegraph.org/index.php/documentation/platform-specifics/android/178-building-openscenegraph-for-android-3-4

You must build osg with osgdb_dds osgdb_bmp, osgdb_tga ,osgdb_gif ,osgdb_jpeg, osgdb_png plugins and GLES1 profile !

Building MyGUI

Then you must build mygui with 1 rendering system

Building Bullet

Then you should build bullet2. You can use cmake android toolchain for it

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 OpenMW-CS, 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

./configure \
    --prefix=$(pwd)/android/$CPU  \
    --enable-static \
    --disable-doc \
    --disable-ffmpeg \
    --disable-ffplay \
    --disable-ffprobe \
    --disable-ffserver \
    --disable-doc \
    --disable-symver \
    --cross-prefix=/home/sylar/android-ndk-r9d/toolchains/arm-linux-androideabi-4.8/prebuilt/linux-x86/bin/arm-linux-androideabi- \
    --target-os=linux \
    --arch=arm \
    --enable-asm \
    --enable-cross-compile \
    --sysroot=/home/sylar/android-ndk-r9d/platforms/android-19/arch-arm \
    --extra-cflags="-Os -fpic $ADDI_CFLAGS" \
    --extra-ldflags="$ADDI_LDFLAGS"

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. I copied all libraries in one folder . For example AndroidDependencies, and build openmw like this

cmake /home/sandstranger/Android/openmw -DCMAKE_TOOLCHAIN_FILE=/home/sandstranger/Android/android-cmake-master/android.toolchain.cmake -DANDROID_TOOLCHAIN_NAME=aarch64-linux-android-4.9 -DANDROID_NATIVE_API_LEVEL=android-21 -DANDROID_NDK=/home/sandstranger/Android/crystax-ndk-10.1.0/ -DANDROID_ABI=arm64-v8a -DOPENMW_DEPENDENCIES_DIR=/home/sandstranger/Android/AndroidDependenciesARMV8 -DOSG_PLUGINS_DIR=/home/sandstranger/Android/AndroidDependenciesARMV8/lib/osgPlugins-3.5.1 -DBUILD_BSATOOL=OFF -DBUILD_ESMTOOL=OFF -DBUILD_LAUNCHER=OFF -DBUILD_MWINIIMPORTER=OFF -DBUILD_ESSIMPORTER=OFF -DBUILD_OPENCS=OFF -DBUILD_WIZARD=OFF -DBUILD_MYGUI_PLUGIN=OFF -DMYGUI_STATIC=ON -DBOOST_STATIC=ON

-O2 or -Os optimal optimizations flags for building . Without this flags fps will be very low

After builing openmw library, you must copy all the libraries to libs folder in the java project folder

For example : /eclipse-project/app/src/main/jniLibs/armeabi-v7a

Then you must import this java project in android-studio , which included with the android sdk.

Also you need to import the configuration files from desktop openmw version.

Building Gotchas

CMake Error at /home/bcurtis/workspace/OpenMW/android/android-cmake/android.toolchain.cmake:429 (math):
  math cannot parse the expression: "+0": syntax error, unexpected exp_PLUS,
  expecting exp_OPENPARENT or exp_NUMBER (1)
Call Stack (most recent call first):
  /home/bcurtis/workspace/OpenMW/android/build/CMakeFiles/3.2.2/CMakeSystem.cmake:6 (include)
  CMakeLists.txt:1 (project)

Don't panic, this can be worked around with the removal (or comment '#') of the non-critical line in the file android-cmake/android.toolchain.cmake on line 429.