Compile ECWolf on Android

From ECWolf Wiki

This guide will demonstrate how to cross compile ECWolf for Android.

Compile for host

The build system for ECWolf generates some files by building tools. Since we will be cross compiling, we can not actually run the tools on the host. To work around this, first build ECWolf for your host system. Linux is known to work as a host.

It is recommended to use Makefiles for this step, although IDE project files may work as well.

Dependencies

The following are required in order to build ECWolf for Android. The build process will not be using Eclipse or Android Studio so it doesn't matter which SDK you download.

It is highly recommended to use the vendored copies of all third party libraries.

Setting up the Android SDK

After downloading the SDK, start the Android SDK Manager and select download the 4.4 SDK, Android SDK Tools, Android SDK Platform-tools, Android SDK Build-tools, and Android Support Library.

You will also need to set up a signing key. You may generate a self signing key. The file name of the keystore and the alias may be changed as you will, but be sure to remember them for the next step.

keytool -genkey -v -keystore android.keystore -alias android -keyalg RSA -keysize 2048 -validity 10000

Configuring CMake

If using the CMake GUI, populate the source and build directories, but before clicking configure we'll want to input a few variables. You can use the "Add Entry" to fill in these values. If using the command line use "-DVARIABLE=VALUE".

Variable Type Value
FORCE_CROSSCOMPILE BOOL ON
IMPORT_EXECUTABLES FILEPATH Location of ImportExecutables.cmake from your native build.
CMAKE_SYSTEM_NAME STRING Android
CMAKE_SYSTEM_VERSION STRING NDK API version. Use 21 if you don't know.
CMAKE_ANDROID_NDK PATH Location of Android NDK (i.e. ndk-r14b or ndk-bundle directory).
CMAKE_ANDROID_ARCH_ABI STRING Architecture. Typically armeabi-v7a. (See docs.)
ANDROID_SDK PATH Location to Android SDK (i.e. platforms/android-19). This path should contain android.jar.
ANDROID_SDK_TOOLS PATH Location of Android build tools (i.e. build-tools/19.1.0). This path should contain aapt among other tools.
ANDROID_SIGN_KEYSTORE FILEPATH Location of your keystore file.
ANDROID_SIGN_KEYNAME STRING Key alias. In the example above: android
ANDROID_SIGN_STOREPASS STRING Password given for your keystore.
INTERNAL_SDL BOOL ON
INTERNAL_SDL_MIXER BOOL ON
INTERNAL_SDL_MIXER_CODECS BOOL ON
INTERNAL_SDL_NET BOOL ON

Now click "Configure" and in the dialog that appears select Makefiles and default compilers. If done correctly CMake should automatically find your NDK compilers and configuration should be successful.

Compiling

Now open up a terminal and go to your build directory. Run make and ECWolf should proceed to build. If all is successful you should have a signed ecwolf.apk in the build directory ready to be installed.

Installing and running

At this point you can manually transfer the apk to your device and run, or you an hook it up to your computer with USB debugging. Run the following command to install and run the application through adb.

make runadb

Install your game data to /sdcard/Beloko/Wolf3d/FULL/.