-
Notifications
You must be signed in to change notification settings - Fork 0
Build Engine
- 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)
Preparations
-
Install ant and java
-
Download the Android SDK (for example the Eclipse ADT Plugin) from https://developer.android.com/sdk/index.html
-
Install the SDK: https://developer.android.com/sdk/installing/index.html
-
Adding packages in the SDK Manager: https://developer.android.com/sdk/installing/adding-packages.html
-
Download and install API 10 (Android 2.3.3) in the SDK Manager
-
Download the Android NDK: https://developer.android.com/tools/sdk/ndk/index.html
-
Install the Android NDK: https://developer.android.com/tools/sdk/ndk/index.html#Installing
-
Write the subdirectories "tools" and "platform-tools" of the android sdk folder and the android-ndk folder to the path variable:
- PATH=$PATH:/path/to/android-sdk/sdk/tools
- PATH=$PATH:/path/to/android-sdk/sdk/platform-tools
- PATH=$PATH:/path/to/android-ndk
- export PATH
- (For permanent change edit the /etc/environment file)
-
export ANDROID_NDK=~/my-android-ndk
-
Set up a virtual device: https://developer.android.com/tools/devices/index.html
-
OR set up a hardware device: https://developer.android.com/tools/device.html
Install/Compile Dependencies
- Install Ogre for Android
- Download the Ogre Android SDK from: http://www.ogre3d.org/download/sdk
- Move the OgreAndroidSDK folder to Dependencies/OgreAndroidSDK parallel to the "engine" folder
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
-
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