Android build

From OpenMW Wiki
Jump to navigation Jump to search

Android build OpenMW[edit]

Preparation of building environment[edit]

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

Prebuilt openmw dependencies for armv8 arch

Compilation of OpenMW dependencies[edit]

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

Building OSG[edit]

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

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

Building MyGUI[edit]

Then you must build mygui with 1 rendering system

Building Bullet[edit]

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

Building OpenAL[edit]

Then you must build openal .

Building Qt (optional)[edit]

Note: Qt is only used by the launcher and OpenMW-CS, and can be skipped. To build Qt 4.8 for android: I used this tutorial for building:

Building FFmpeg[edit]

Then you must build ffmpeg . Important! You must use ffmpeg 1.26:

my script for build <syntaxhighlight lang="bash"> ./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" \


Building SDL2[edit]

Then you must build SDL2: I used SDL2 mercurial latest source.

Building OpenMW[edit]

Then I started to build OpenMW. I copied all libraries in one folder . For example AndroidDependencies, and build openmw like this

<syntaxhighlight lang="bash"> 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>

-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[edit]

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.