Ogre:Android
Download
Download the dependencies and extract inside the OGRE src dir. The deps are compiled for armeabi and armeabi-v7a.
http://sourceforge.net/projects/ogre/files/ogre-dependencies-android/1.9/AndroidDependencies_17_12_2012.zip/download
Building for Android on Windows host
Download and install the android sdk:
After the install open the "Android SDK Manager" and download & install your target API
Due the usage of the native activity and the asset manager if we would skip these we could go a bit lower but that would not make much sense because OGRE still needs a decent hardware to run.
Now add the install directory to your enviroment variables
Append %ANDROID_SDK%\tools and %ANDROID_SDK%\platform-tools
to your PATH variable
Download the android ndk
- Extract the content to
C:/android/ndk
and create a env var%ANDROID_NDK%
- Add
%ANDROID_NDK%
to yourPATH
http://dl.google.com/android/ndk/android-ndk-r8c-windows.zip
Android NDK revision 8b is not supported due a bug in the toolchain
We need ant to build projects from the command line
- I use this version http://tweedo.com/mirror/apache//ant/binaries/apache-ant-1.8.4-bin.zip
- Extract the content under
C:/android/ant
and add the bin dir to yourPATH
- Use the command
ant -version
with the windows terminal (cmd.exe) to the test version. Should look like this
cmake build
The build command for the deps, using Visual Studio command prompt (this is necessary only if you are building the dependencies from source)
cmake -G"NMake Makefiles" -DCMAKE_TOOLCHAIN_FILE=..\cmake\android.toolchain.cmake -DANDROID_ABI=armeabi ..
nmake
The build command for ogre create a build dir inside the OGRE src tree and cd to this dir and execute this command:
## for armeabi - if you want to build for armeabi v7a just remove -DANDROID_ABI=armeabi
cmake -G"NMake Makefiles" -DCMAKE_TOOLCHAIN_FILE=..\cmake\toolchain\android.toolchain.cmake -DOGRE_DEPENDENCIES_DIR=..\AndroidDependencies -DANDROID_ABI=armeabi -DANDROID_NATIVE_API_LEVEL=9 ..
You may have to call nmake after executing the cmake script. Currently there are a couple targets in the system which you can see by typing nmake help
If you want to build the old OgreSampleBrowser, which you can download from the Google Play Store, you have to type nmake SampleBrowserDummy
Currently, the default value is the JNI Sample, which might not be complete just yet.
Note: standard
NMake
can only build one file at a time. For functionality similar to ``make -j`` (parallel builds), use
JOM
in place of the ``nmake`` command above.
JOM
can be found here:
http://qt-project.org/wiki/jom
Once you have successfully built Ogre with nmake or JOM, you still need to make the SampleBrowser app itself. This is a native activity and the project resides in a SampleBrowserNDK
subdirectory of the build directory you provided earlier. Change to this directory, run ndk-build all
(optionally with a -j
option for parallel build), and then ant debug install
to build a debug APK and install it to your device.
Building for Android on Mac OSX host
cmake -DCMAKE_TOOLCHAIN_FILE="`pwd`/../CMake/toolchain/android.toolchain.cmake" -DOGRE_DEPENDENCIES_DIR="`pwd`/../AndroidDependencies" -DANDROID_ABI=armeabi -DANDROID_NATIVE_API_LEVEL=9 ..
See also
Favorite site
- CMake Quick Start Guide | Ogre Wiki
- GitHub: Simple ogre demo project for android derived from the ogre sources
- bitbucket: ogre-android
- Ogre wiki: Ogre Android
- Ogre3D to Android
- Android and Ogre Wiki Tutorial Framework (Android 샘플소스코드)
- Bitbucket ogre-android project page
- OGRE Project generator (Latest release: January 20'th 2012)
- [추천] (Android Game Project) Ogre3d + Android Porting 1
References
-
Ogre-android_porting.pdf ↩