News

Building Ogre for iOS

This post was going to include a long set of instructions on how to set up and build Ogre for iOS 4.3 and get it all working with Xcode 4. Then I discovered a very handy shell script that does all of the building and spits out a lovely .dmg file.

The Ogre website does have precompiled SDKs for various platforms, and they can be found here: http://www.ogre3d.org/download/sdk.

If there is not a precompiled version there for your SDK you need to build your own. Currently there is only a prebuilt version for iOS 4.1. This will probably be fine for most people.

 Building Ogre

  1. First get the source (the current version is v1.7.3), and extract it some where (eg $HOME/Src/ogre_src_v1-7-3)
  2. Get the dependencies and templates for iOS, or browse the Mac and iOS dependency releases here.
  3. Open the dependencies dmg and copy the iPhoneDependencies folder to ogre_src_v1-7-3. It should be at the same level as the OrgeMain folder.
  4. Open terminal and go to the iPhone SDK folder in the source code and run the make_iphone shell script.
    cd $HOME/Src/ogre_src_v1-7-3/SDK/iPhone
    sh ./map_iphone.sh
  5. This will begin building the SDK in a folder called build.
  6. Eventually it should spit out a dmg file called OgreSDK_iOS_v1-7-3.dmg
  7. Put this somewhere safe, and open it in Finder.
  8. I renamed mine OgreSDK_iOS4.3_v1-7-3.dmg so I know which iOS SDK it is built against.
  9. Open the dmg and copy the OgreSDK folder somewhere sensible like $HOME/Src/OgreSDK
  10. For some reason the iPhone dependencies where not copied across, so you will need to copy them into the OgreSDK at the top level.

Install the Xcode 4 templates

  1. unzip Ogre_Xcode4_Templates_20110728.pkg.zip.
  2. run Ogre Templates for Xcode 4.pkg.

Create an Xcode 4 project

  1. In Xcode create a new project, and select Ogre from the list on the left and then the template type of “iOS Application”.
  2. Set the ogre SDK path to where the SDK is, e.g. $HOME/Src/OgreSDK
  3. Build and run.

There is also a nice guide here: http://www.ogre3d.org/tikiwiki/ogreOnIphoneFast

Some caveats

  • I use macports and have a variety of software installed via that, including Boost. The build process may pick those up rather than the files in the iPhone dependencies folder.
  • If you run into issues, have a look at the readme.txt included with the shell script on how to point to the prebuilt iPhone dependencies.

Result

Tags: , ,

2 comments

Feel free to join the discussion by leaving your own comment
  1. duke
    September 23, 2011 at 06:36 #

    Hi~ This is a good tutorial.
    I according to the steps. When I build and run. It say “OgreCamera.h file not found”.
    Do you know this problem?
    Thank you.

    • robert
      September 23, 2011 at 11:09 #

      Either the file does not exist or your project is not looking in the right place for the file.

      OgreCamera.h lives in /include/OGRE/

      Check that it exists there first, then check in your project settings. Under the target look for ‘Header Search Paths’ and the entry there should contain something like the following:

      "//Users/yourname/Src/OgreSDK/include/OGRE"
      "//Users/yourname/Src/OgreSDK/include/OGRE/RenderSystems/GLES"
      "//Users/yourname/Src/OgreSDK/include/OGRE/iPhone"
      "//Users/yourname/Src/OgreSDK/include"
      "//Users/yourname/Src/OgreSDK/include/OIS"
      "//Users/yourname/Src/OgreSDK/iPhoneDependencies/include"
      

      The same paths should be under Debug and Release as well.

      Hope this helps.

This site uses Cookies - By using this site or closing this you agree to our Cookies policy.
Accept
x