CMake Quick Start Guide         A guide to get you building OGRE from source with the default settings in the shortest possible time
IMPORTANT: These instructions are meant to be used with old releases of Ogre. For Ogre 1.10+, rather use BuildingOgre.md.
Image

For the impatient: Learn how to build Ogre with CMake in two minutes. If you encounter any problems or need some more advanced procedures, do read the rest of the sections below!

Introduction

This guide is designed to get you building OGRE from source with the default settings in the shortest possible time, showing you the barest minimum of CMake to do that, and minus any real discussion. Remember that there is a lot more to the hows and whys of this process, so it's a good idea to go back to the Getting Started With CMake page and read the whole thing when you have time.

We assume here that you've already downloaded / extracted the OGRE source code into a folder on your local machine. From here, go to the section for your platform.

Done Make sure that you've sorted out the Prerequisites before attempting to build Ogre with CMake!


Building Ogre via CMake GUI (see alt. command line below)


Xcode 4.3 changed the layout of developer tools on disk which can cause some serious problems for CMake. The issue has been fixed but is not yet publicly released. CMake 2.8.8 will include Xcode 4.3 support. At the time of writing, a release candidate is available that includes this support.

You will also need to install the Command Line Tools from within Xcode's Downloads Preferences and set the Xcode path from the command line like this.

Assuming that Xcode is installed in /Applications,

sudo xcode-select -switch /Applications/Xcode.app/Contents/Developer

  1. Download CMake. You want the 'Mac OS X Universal' release in the binary distribution section
  2. The .dmg will probably auto-mount when it downloads, if not, double-click it to open
  3. Double-click the .pkg installer, install on your main drive and opt to install the command-line tools too (in case you want to use them later, we will use the GUI here)
  4. Launch CMake via Applications
  5. In the "Where is the source code" box, type or browse to the root directory of your OGRE source (the one that contains the OgreMain folder)
  6. In the "Where to build the binaries" box, type or browse to any folder you like - this will be where the build output will go (libraries, headers, dlls & sample exes). The folder does not have to exist yet. Note that you can run this process more than once with different output folders if you want (but we won't complicate matters now)
  7. Hit the 'Configure' button near the bottom of the screen
  8. Pick 'Xcode' as the generator and opt to use native compilers
  9. Answer 'Ok' when asked if you want to create the build directory
  10. Wait for the configure process to finish
  11. The screen will now have a bunch of configuration options on it, which will be red (this is to indicate this is the first time you've seen them). You can see the potential for customising your build here, but for now just click the 'Configure' button again
  12. The values will turn grey, and the 'Generate' button at the bottom will now be enabled. Click 'Generate'
  13. Build files will now be generated in the location you picked
  14. Now, open OGRE.xcodeproj in the build directory you picked, open it in Xcode. SampleBrowser will build everything!


Note: ALL_BUILD does not work properly with Xcode 4.

Building Ogre via Command Line (see alt. GUI method above)

  1. Download Ogre Source (Instructions below assume current version of 1.8.0, update as needed)
  2. Decompress:
    tar xjf ogre_src_v1-8-0.tar.bz2
  3. Move to source directory:
    cd ogre_src_v1-8-0
  4. Create build directory:
    mkdir build
  5. Move into build directory:
    cd build
  6. Trigger cmake, specify Xcode generation and pass path to Ogre source directory:
    cmake -GXcode ..
    See the Extensive CMake page for a list of compilation options which can be passed to CMake at this stage, and Getting Started With CMake for even more background material.
  7. Build via Xcode
    xcodebuild -configuration RelWithDebInfo
    (or open OGRE.xcodeproj and build within Xcode)

Installing Ogre

You will find Ogre.framework in 'lib' within your build directory. You can embed this in your application bundle, or drag it to /Library/Frameworks for system-wide installation.

You will also find plugins (Plugin_*.dylib and RenderSystem_GL.dylib) in the same location, you can copy these to the framework's Resource directory or your own application's bundle. Be sure to configure you applications' plugins.cfg to match (e.g. /Library/Frameworks/Ogre.framework/Resources/)