Skip to main content

History: Building From Source - iPhone

Source of version: 24

Copy to clipboard
            !Prerequisites

This article assumes that you have already downloaded and installed CMake, and obtained the Ogre source.  For instructions on obtaining the Ogre source via Mercurial, see ((Building Ogre)).

If you want to test your build on an iOS device (instead of just the simulator), you should also have obtained an App ID from the iOS Provisioning Portal on [http://developer.apple.com|developer.apple.com].

!Obtaining Dependencies

Head over to http://sourceforge.net/projects/ogre/files/ogre-dependencies-mac/ and download the latest iPhone dependencies package. Once it has finished downloading, double-click on the disc image to mount it. Copy the iPhoneDependencies folder to the root of the Ogre source tree. It should reside alongside folders such as OgreMain, Samples, Tests, PlugIns, etc.

Your Ogre directory should look similar to this:
{CODE(wrap="1")}
CMake
Components
iPhoneDependencies
Docs
OgreMain
Other
PlugIns
RenderSystems
Samples
SDK
Tests
Tools
{CODE}

!Building

Two common build cases are:

{FANCYLIST()}
1) Build for running the sample projects.
2) Build for compatibility with Ogre's "iPhone OS" Xcode project template.
{FANCYLIST}

These two cases are detailed below.

!!For Running the Sample Projects

The best way to configure for iPhone is using Terminal. Using CMake-Gui doesn't quite configure correctly at the time of this writing. 
First change to the directory of the Ogre sources. Now create a build directory and change to it:
{MONO()}  mkdir build && cd build{MONO}
You need to run cmake from the build directory and provide it with the location of the build directory. If you followed the above guideline, then you can simply type:
{MONO()}  cmake -D OGRE_BUILD_PLATFORM_IPHONE=1 -G Xcode ..{MONO}
CMake will now parse the scripts in the Ogre source tree. Watch the output, especially if all necessary dependencies have been found. If not, you might need to install the missing ones or provide their locations manually.

A Xcode project has now been generated in the build directory, so to start the Ogre build, open OGRE.xcodeproj and build as usual.

To run samples on your device you will need to have a valid iPhone Developer certificate installed. For each sample, double click on target in the Groups & Files list. Ensure that a valid identity is selected in the Code Signing Identity drop menu.

Also, because we can't tell CMake what Xcode project format you want, you will have to change it yourself. Open the Project Menu, choose Edit Project Settings. Click on the General tab in the settings window. Change Project Format to Xcode 3.1-compatible.  If you are using CMake 2.8 it is not necessary to change the Project Format.

And another thing. You will need to manually set the Bundle Identifier property of the Info.plist file to match the App ID of the chosen code signing identity. This can be done from the Target Properties panel. It must match the bundle identifier of a valid developer certificate if you are building for devices.

!!For Compatibility with the Template Project

If you want to use the Xcode template installer package after building the source, use the script below to create and modify your build directory so it matches the pre-built SDK.

__NOTE: This revision of the script is work-in-progress and will be improved over the next few days.  At present, it should work for deployment to the device but not the simulator.  Modify the global variables depending on your own directory paths.__

{CODE(wrap="1", colors="bash")}
#!/bin/bash

####################
# GLOBAL VARIABLES #
####################

# Absolute path to the source code directory.
SRC=`pwd`/ogre_src

# Absolute path to the iPhoneDependencies directory.
DEP=$SRC/iPhoneDependencies

# Absolute path to the build directory.
BUILD=`pwd`/OgreSDK_iOS

####################

# Clear the old build and recompile the new one.
rm -rf $BUILD
mkdir $BUILD
cd $BUILD
cmake -D OGRE_BUILD_PLATFORM_IPHONE=1 -G Xcode $SRC
cd $BUILD
xcodebuild -sdk iphoneos -configuration Release

# Copy the iPhoneDependencies directory.
cp -R $DEP $BUILD

# Standardize the lib/* directories.
mkdir $BUILD/lib/pkgconfig

# Add necessary files to the Debug directory.
cp $DEP/lib/Debug/* $BUILD/lib/Debug

# Add necessary files to the Release directory.
cp $DEP/lib/Release/* $BUILD/lib/Release

# Add necessary files to the pkgconfig directory.
cp $BUILD/pkgconfig/* $BUILD/lib/pkgconfig

# Handle the include directory.
mkdir $BUILD/include/OGRE
mkdir $BUILD/include/OGRE/iPhone
mkdir $BUILD/include/OGRE/Paging
mkdir $BUILD/include/OGRE/Plugins
mkdir $BUILD/include/OGRE/Plugins/BSPSceneManager
mkdir $BUILD/include/OGRE/Plugins/OctreeSceneManager
mkdir $BUILD/include/OGRE/Plugins/OctreeZone
mkdir $BUILD/include/OGRE/Plugins/ParticleFX
mkdir $BUILD/include/OGRE/Plugins/PCZSceneManager
mkdir $BUILD/include/OGRE/Property
mkdir $BUILD/include/OGRE/RenderSystems
mkdir $BUILD/include/OGRE/RenderSystems/GLES
mkdir $BUILD/include/OGRE/RenderSystems/GLES/APPLE
mkdir $BUILD/include/OGRE/RTShaderSystem
mkdir $BUILD/include/OGRE/Terrain
mkdir $BUILD/include/OGRE/Threading
mv $BUILD/include/OgreBuildSettings.h $BUILD/include/OGRE
cp $SRC/OgreMain/include/*.h $BUILD/include/OGRE
cp $BUILD/Samples/include/ExampleApplication.h $BUILD/include/OGRE
cp $BUILD/Samples/include/ExampleFrameListener.h $BUILD/include/OGRE
cp $BUILD/Samples/include/ExampleLoadingBar.h $BUILD/include/OGRE
cp $BUILD/Samples/include/FileSystemLayer.h $BUILD/include/OGRE
cp $BUILD/Samples/include/Sample.h $BUILD/include/OGRE
cp $BUILD/Samples/include/SampleContext.h $BUILD/include/OGRE
cp $BUILD/Samples/include/SamplePlugin.h $BUILD/include/OGRE
cp $BUILD/Samples/include/SdkCameraMan.h $BUILD/include/OGRE
cp $BUILD/Samples/include/SdkSample.h $BUILD/include/OGRE
cp $BUILD/Samples/include/SdkTrays.h $BUILD/include/OGRE
cp $SRC/OgreMain/include/iPhone/* $BUILD/include/OGRE/iPhone
cp $SRC/Components/Paging/include/* $BUILD/include/OGRE/Paging
cp $SRC/Plugins/BSPSceneManager/include/* $BUILD/include/OGRE/Plugins/BSPSceneManager
cp $SRC/Plugins/OctreeSceneManager/include/* $BUILD/include/OGRE/Plugins/OctreeSceneManager
cp $SRC/Plugins/OctreeZone/include/* $BUILD/include/OGRE/Plugins/OctreeZone
cp $SRC/Plugins/ParticleFX/include/* $BUILD/include/OGRE/Plugins/ParticleFX
cp $SRC/Plugins/PCZSceneManager/include/* $BUILD/include/OGRE/Plugins/PCZSceneManager
cp $SRC/Components/Property/include/* $BUILD/include/OGRE/Property
cp $SRC/RenderSystems/GLES/include/*.h $BUILD/include/OGRE/RenderSystems/GLES
cp $SRC/RenderSystems/GLES/include/EAGL/* $BUILD/include/OGRE/RenderSystems/GLES/APPLE
cp $SRC/Components/RTShaderSystem/include/* $BUILD/include/OGRE/RTShaderSystem
cp $SRC/Components/Terrain/include/* $BUILD/include/OGRE/Terrain
cp $SRC/OgreMain/include/Threading/* $BUILD/include/OGRE/Threading

# Handle the Media directory.
cp -R $SRC/Samples/Media $BUILD/media

# Handle the Samples directory.
cp -R $SRC/Samples $BUILD/Samples

# Remove the extra copy of the Media directory.
rm -rf $BUILD/Samples/Media
{CODE}

---
Alias: (alias(Building From Source (for iPhone)))
        

History

Information Version
Tue 19 of Nov, 2013 07:59 GMT-0000 masterfalcon Notes about 1.9 and libc++ 47
Tue 12 of Jun, 2012 11:18 GMT-0000 manixate 46
Tue 12 of Jun, 2012 11:17 GMT-0000 manixate 45
Tue 12 of Jun, 2012 11:16 GMT-0000 manixate Fixed error in the script while building for Xcode 4.3 and iOS 5 simulator 44
Thu 29 of Mar, 2012 18:01 GMT-0000 masterfalcon Added notes about Xcode 4.3 43
Mon 20 of Feb, 2012 21:11 GMT-0000 masterfalcon Updated for 1.8. 42
Mon 20 of Feb, 2012 21:08 GMT-0000 masterfalcon 41
Sun 31 of Jul, 2011 22:39 GMT-0000 jacmoe 40
Wed 19 of Jan, 2011 19:32 GMT-0000 masterfalcon Added note about changed CMake define in 1.8 branch 39
Mon 03 of Jan, 2011 13:11 GMT-0000 Joseph Howse Updated build script for compatibility with current template installer. 38
Thu 23 of Dec, 2010 04:09 GMT-0000 Joseph Howse 37
Thu 23 of Dec, 2010 04:08 GMT-0000 Joseph Howse 36
Thu 23 of Dec, 2010 04:06 GMT-0000 Joseph Howse 35
Thu 23 of Dec, 2010 03:59 GMT-0000 Joseph Howse 34
Thu 23 of Dec, 2010 03:28 GMT-0000 Joseph Howse 33
Thu 23 of Dec, 2010 03:19 GMT-0000 Joseph Howse 32
Thu 23 of Dec, 2010 03:17 GMT-0000 Joseph Howse 31
Thu 23 of Dec, 2010 03:11 GMT-0000 Joseph Howse 30
Thu 23 of Dec, 2010 03:04 GMT-0000 Joseph Howse 29
Wed 22 of Dec, 2010 23:56 GMT-0000 Joseph Howse 28
Tue 21 of Dec, 2010 18:08 GMT-0000 Joseph Howse 27
Tue 21 of Dec, 2010 18:06 GMT-0000 Joseph Howse 26
Tue 21 of Dec, 2010 16:40 GMT-0000 Joseph Howse 25
Tue 21 of Dec, 2010 16:38 GMT-0000 Joseph Howse 24
Tue 21 of Dec, 2010 16:35 GMT-0000 Joseph Howse 23
  • «
  • 1 (current)
  • 2