Building Ogre 3D on OSX

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.

Prerequisites

Building Ogre

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.

Press Configure.

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.

Config value Description
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.

Press Generate.

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 🙂

11 comments

  1. When I hit configure for the first time I get this error:
    send_error/Users/somedirectories/sinbad-ogre-09201443384d/Dependencies/bin/debug/libOIS.a did not exist, can’t install!

  2. Aw crap, would you mind deleting that last reply? I probably shouldn’t post the name of my home folder out for everyone to see.

  3. Thanks 🙂

    So, as I said, I simply changed lib to bin and that solved it.

    Now that I’ve copied and pasted Cg.framework into the folders that cmake expects and then hit configure I get lots of errors like this:

    Now when I hit compile I get a bunch of errors like this:
    CMake Error at CMake/InstallDependencies.cmake:26 (install):
    install FILES given directory
    “/Users/abunchoffolders/sinbad-ogre-09201443384d/Dependencies/bin/debug/Cg.framework”
    to install.
    Call Stack (most recent call first):
    CMake/InstallDependencies.cmake:133 (install_debug)
    CMake/Dependencies.cmake:242 (include)
    CMakeLists.txt:175 (include)

    I’ve been told that I should try to change the permissions. I will give that a try.

    1. Why does it think Cg.framework is in bin/debug? It should only be in /Library/Frameworks.

      If you’re sure it’s only in /Library/Frameworks, I would start from scratch. It finds it ok for me, since that’s where it looks.

    2. Also, you should probably just ignore that OIS error. Looking at my successfully built Ogre 1.7, I didn’t have to change lib to bin. But that could be because I also didn’t build the samples.

      I may try the same process with Ogre 1.8; and if it’s a bit smoother, I might update this article to use that instead.

      If all else fails, PM me on the Ogre forums and I will send you my Cg.framework.

  4. Hi, great tutorial, it seems so simple yet I can’t get it to work! I downloaded v 1.7 of Ogre and the dependencies folder as you mentioned. I then put the Dependencies folder to the root of Ogre. When I press configure in cmake, it seems that it can’t find OIS?


    checking for module 'OIS'
    package 'OIS' not found
    Found OIS: optimized;/Developer/SDKs/OgreSDK_1-7/lib/release/libOIS.a;debug;/usr/local/lib/libOIS.a

    I then press Configure again and Generate. When I try to build the generated project, I get errors regarding linking to OIS, e.g.:


    Undefined symbols for architecture x86_64:
    "OIS::InputManager::createInputObject(OIS::Type, bool, std::string const&)", referenced from:
    OgreBites::SampleContext::createInputDevices() in SampleBrowser.o

    Have you seen this before?

Leave a Reply

Your email address will not be published. Required fields are marked *