Following on from my popular Building Ogre with Visual Studio guide, I’m going to show you how to build Ogre on OSX with XCode. This is the cause of a lot of frustration for those new to Ogre/mac, so I thought I’d address that and show just how easy it is. Let me know in the comments if you have any problems/suggestions.
- Download and install CMake. 2.8.0 is the most reliable when building Ogre, so grab cmake-2.8.0-Darwin-universal.dmg from: http://www.cmake.org/files/v2.8/
- Download the latest dependencies package OgreDependencies_OSX_???.zip: http://sourceforge.net/projects/ogre/files/ogre-dependencies-mac/1.7/
- Download Ogre from: https://bitbucket.org/sinbad/ogre/. For this tutorial we will be using the 1.7 branch since this is the latest stable version. So where it says “branches”, choose “v1-7” from the dropdown. Then choose a package from “get source”.
Extract the Ogre package.
Extract the dependencies package and move the Dependencies folder to the root directory of Ogre.
Open CMake. Point “Where is the source code” to the root directory of Ogre. Now copy and paste that path into “Where to build the binaries” and add “/build” to the end.
It should say “Build directory does not exist, should I create it?”. Choose Yes.
“Specify the generator for this project” should be “Xcode” and “Use default native compilers” should be checked.
Wait until configuration has finished.
At this point, you can choose the optional features you’d like to include when building Ogre. Below I have included a table of features which you may want to consider. Anything I haven’t included is not relevant for the purpose of this tutorial.
|OGRE_BUILD_COMPONENT_PAGING||Ogre’s paging component. This must be checked if you also checked the terrain component below.|
|OGRE_BUILD_COMPONENT_PROPERTY||Ogre’s property component. It’s rare that you will need this, so leave it unchecked unless you know you need it.|
|OGRE_BUILD_COMPONENT_RTSHADERSYSTEM||Ogre’s RT Shader System. I highly recommend this if you are going to be working with shaders.|
|OGRE_BUILD_COMPONENT_TERRAIN||Ogre’s terrain component. Leave this checked if you need a terrain system for your project.|
|OGRE_BUILD_PLUGIN_BSP||The Binary Space Partitioning Scene Manager. This is a pretty old format now, only check it if you know you need it.|
|OGRE_BUILD_PLUGIN_CG||The CG plugin. You probably want this if you’re going to work with shaders. Be warned that you may need to install the CG framework on mac if you don’t already have it. Check the CMake logs to ensure it has been found.|
|OGRE_BUILD_PLUGIN_OCTREE||The Octree Scene Manager. I recommend you leave this one checked.|
|OGRE_BUILD_PLUGIN_PCZ||The Portal Connected Zone Scene Manager.|
|OGRE_BUILD_PLUGIN_PFX||The ParticleFX plugin for Ogre. You probably need this.|
|OGRE_RENDERSYSTEM_GL||Ogre wouldn’t be very useful without this 🙂|
|OGRE_BUILD_SAMPLES||Leave it checked if you are new to Ogre and want to check out it’s samples. Uncheck this if you want faster build times.|
|OGRE_CONFIG_THREADS||0 to disable threading. 2 if you only want resource preparation to be threaded. 1 if you want both resource preparation and loading to be threaded. Caution: You may get link errors related to architecture if threading is enabled due to outdated dependencies. I’ll update this guide as soon as I find a solution.|
|OGRE_STATIC||Check this if you want to build Ogre statically.|
Press Configure again. The config values should turn white.
Navigate to the build directory and open OGRE.xcodeproj.
Select the configuration you wish to build for (by default it’s set to Debug). I’d recommend building both Debug and Release.
Hit Build -> Build, or Cmd + B.
Grab some coffee and enjoy 🙂