Skip to content
eikelangbehn edited this page Dec 4, 2014 · 7 revisions

General Approach

  • Install/Compile Dependencies (Ogre3D, Bullet, MyGUI) -> see their websites for instructions
  • Clone this repository
  • Put include files of Bullet to repo/Dependencies/bullet/include
  • Put include files of MyGUI to repo/Dependencies/mygui/include
  • Create a build directory and go there
  • Run: cmake path/to/source OPTIONS

Then to create an application:

  • Create an application directory
  • Create an "assets" directory there and put all assets in (scripts, gui, meshes)
  • Create options.cfg in "assets" and fill it with your values
  • Put the engine binary in the application directory (desktop platforms)

Build for Mobile Platforms

Android

Preparations

Install/Compile Dependencies

  • Install Ogre for Android

OR

* Download the Ogre Android Dependencies and move them to the ogre source dir: http://sourceforge.net/projects/ogre/files/ogre-dependencies-android/1.9/AndroidDependencies_27_08_2013.zip/download
* Create build directory: mkdir ogre-android
* Move into build directory: cd ogre-android
* Run cmake: cmake -DCMAKE_TOOLCHAIN_FILE="../ogre/CMake/toolchain/android.toolchain.cmake" -DOGRE_DEPENDENCIES_DIR="../ogre/AndroidDependencies" -DANDROID_NATIVE_API_LEVEL=9 ../ogre
* Run make: make -j4
* (Don't worry if the build stops at some point. Type "make" again until the process is at 100%. Some of the ogre features aren't ported to android yet. In the lib subdirectory of the build directory should now be some static libraries (.a).)
  • Compile Bullet for Android

    • Get sourcecode (2.82-r2704): https://code.google.com/p/bullet/downloads/list
    • Unpack it and create build directory: mkdir android-build
    • Move into build directory: cd android-build
    • Run cmake: cmake ../path/to/bullet -DCMAKE_TOOLCHAIN_FILE=path/to/the/android.toolchain.cmake (is in engine/android)
    • Run make: make -j4
    • sudo make install
  • Compile MyGUI for Android

    • Get sourcecode(v 3.2.1) from https://github.com/MyGUI/mygui.git

    • Create build directory: mkdir android-build

    • Move into build directory: cd android-build

    • Run cmake: cmake path/to/mygui/code -DCMAKE_TOOLCHAIN_FILE=path/to/the/android.toolchain.cmake -DMYGUI_RENDERSYSTEM=3 -DMYGUI_STATIC=TRUE -DOGRE_LIB_DIR=path/to/ogre-android-build/lib -DOGRE_LIBRARIES=path/to/ogre-android-build/lib -DOGRE_BUILD=path/to/ogre-android-build/lib -DOGRE_INCLUDE_DIR=path/to/ogre/OgreMain/include -DOGRE_SOURCE_DIR=path/to/ogre/OgreMain/src -DMYGUI_BUILD_DEMOS=FALSE -DMYGUI_BUILD_PLUGINS=FALSE -DMYGUI_BUILD_TOOLS=FALSE

    • Compile: make -j4

    • (The toolchain file is in engine/android)

    • I had to copy the files for OIS and FREETYPE from the ogre/AndroidDependencies folder to mygui/android-build/Dependencies.

    • And I had to add two directories to the mygui include_directories:

      • /path/to/ogre/OgreMain/include
      • /path/to/ogre-android-build/include
    • Change OgreDataManager.cpp like explained here: http://www.ogre3d.org/addonforums/viewtopic.php?f=17&t=30221

    • And do this shader stuff explained here in the last post: http://www.ogre3d.org/addonforums/viewtopic.php?f=17&t=29605

    • Now there should be two static library files in mygui/android-build/lib

Compile and deploy engine

  • Because there is a bug in the ogre build system, you have to change something in the FindOGRE.cmake file (located in /usr/local/lib/OGRE/cmake/FindOGRE.cmake): Comment out the if clause around lines 222-231 (if (NOT OGRE_SOURCE)). Otherwise cmake won't find the right ogre libraries. See this topic: http://www.ogre3d.org/forums/viewtopic.php?f=4&t=80097

  • Go to the android directory in the main engine dir and type: ndk-build

  • Then you will find a 'libs' folder that you copy into the sample android project. Edit the AndroidManifest.xml and put your assets in the assets folder. Then run this to deploy the app on your device: ant debug install

iOS

  • Copy iOSDependencies folder (with include files and libs of mygui, bullet, lua) into engine folder

  • Compile Ogre for iOS

    • Put iOSDependencies in source
    • make build dir
    • run cmake .. -D OGRE_BUILD_PLATFORM_APPLE_IOS=1 -G Xcode
    • open Xcode Project and set optimization level to "fastest, smallest"
    • build samplebrowser or other targets
    • install pkg-config and have the FindPkgCofnig.cmake in CMAKE_MODULE_PATH
  • Have ogre/source and ogre/build folders at the same level like engine

  • Create build directory

  • Run: cmake ../engine/ios -DCMAKE_TOOLCHAIN_FILE=../engine/ios/iOS.cmake -DOGRE_BUILD_PLATFORM_IOS=TRUE -GXcode (three times)

  • Open generated XCode Project

  • Mark main.cpp and iOSInputSystem.cpp in XCode as Objective-C++ Source

  • For target "engine" set:

Build Phases:

  • Add "Link Binary with Libraries"
  • Then add "OpenGLES.framework" and libstdc++.dylib, libstdc++.6.dylib, libstdc++.6.0.9.dylib
  • Add all asset folders and files to "Copy Bundle Resources"

Build Settings:

  • Base SDK: iOS 7.1
  • Build Active Architecture Only: Yes
  • Architectures: Standard architectures (armv7, arm64)
  • COMPRESS_PNG_FILES: No
  • Valid provisioning profile and signing certificate

In Info.plist:

  • The Executable file (CFBundleExecutable) must be ${EXECUTABLE_NAME}
  • Set Bundle name like you want
  • Set bundle Identifier to a valid value

Clone this wiki locally