Difference between revisions of "Compile ECWolf on Android"

From ECWolf Wiki
(Created page with "This guide will demonstrate how to cross compile ECWolf for Android. Note that at the moment only ARM is supported by the build system. == Compile for host == The build syste...")
 
Line 18: Line 18:
 
* [http://cmake.org/ CMake] 2.8 (CMake GUI recommended)
 
* [http://cmake.org/ CMake] 2.8 (CMake GUI recommended)
 
* [http://www.libsdl.org/ libsdl] 1.2
 
* [http://www.libsdl.org/ libsdl] 1.2
* [http://www.libsdl.org/projects/SDL_mixer/ SDL_mixer] 1.2
+
* [http://maniacsvault.net/ecwolf/files/tools/dev/ SDL_mixer for ECWolf] (Standard [http://www.libsdl.org/projects/SDL_mixer/release-1.2.html SDL_mixer] 1.2 will also work, but features will be disabled.)
  
 
For your convenience, pre-built SDL libraries are available [http://maniacsvault.net/ecwolf/files/tools/SDL_1.2-android.7z here].
 
For your convenience, pre-built SDL libraries are available [http://maniacsvault.net/ecwolf/files/tools/SDL_1.2-android.7z here].

Revision as of 06:32, 8 January 2015

This guide will demonstrate how to cross compile ECWolf for Android. Note that at the moment only ARM is supported by the build system.

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.

For your convenience, pre-built SDL libraries are available here.

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.

Next, generate a standalone toolchain for the NDK. There is a script make-standalone-toolchain which can do this easily. On Linux execute this from the NDK directory. You may change the install-dir to any location of your preference.

build/tools/make-standalone-release.sh --platform=android-12 --install-dir=~/android-toolchain

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

Configure CMake to use Makefiles and specify native compilers. You will want to set the C and C++ compiler to the ones in the android toolchain bin directory. They will be called arm-*-androidabi-gcc and arm-*-androidabi-g++.

The configuration will error looking for SDL. Before specifying the locations for SDL, be sure to set the ANDROID option and FORCE_CROSSCOMPILE.

The next time, it should error for the ANDROID_SDK. First set IMPORT_EXECUTBALES to the ImportExecutables.cmake file that can be found in your native ECWolf build directory. Then set ANDROID_SDK to the location of android.jar in your 4.4 SDK. This will be something like sdk/platforms/android-19. Set ANDROID_SDK_TOOLS to the build-tools for your platform in the sdk directory (sdk/build-tools/android-4.4W).

Configure again and it should now be looking for SDL_mixer. Also set ANDROID_MOGA_CONTROLLER_JAR to the location of com.bda.controller.jar from the MOGA SDK. ANDROID_SIGN_KEYNAME should be set your your key alias, ANDROID_SIGN_KEYSTORE to your keystore file, and ANDROID_SIGN_STOREPASS to the password for your key store.

Check that all other ANDROID_* values are filled in and provide them accordingly if need be.

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/.