History: Building Ogre on Mac OS X (2013)
Preview of version: 4
Intro
This is an attempt to provide an up to date guide on how to build Ogre from scratch on a recent Mac platform. We will be using Xcode 4.6, and Mac OS X 10.7.5. Tested on a Mac mini 2011, if that matters.
The motivation for this guide was the result of general frustration of the difficulty of building Ogre the Mac platform.
For simplicity, directories will be created in the home directory, although that may not be generally desirable.
Because of my requirements (32 bit only third party library), we will build a static version for i386 only, although it should be easy to identify and tweak those options for your own use.
Building Boost for Ogre
Although not strictly necessary, Boost is nice for cross platform stuff, and I feel it makes me more productive. However, you sacrifice compile times and binary sizes.
Hopefully the negatives will eventually disappear in the future as compilers get better.
# Download Boost on the official website, at the time this was written, it is 1.53.0 cd tar -xjvpf ~/Downloads/boost_1_53_0.tar.bz2 mv boost_1_53_0 boost # I chose to do this so I don't have to update directories every time in other projects # install the b2 / bjam to ~/boost.build, this is like make and cmake, but for boost cd boost/tools/build/v2 ./booststrap.sh mkdir ~/boost.build (NOTE that ~ doesn't work below to specify home) ./b2 install --prefix=/home/USERNAME/boost.build # make sure you are using the latest compilers, and they refer to the ones inside /Applications/Xcode.app # this is important if you have Xcode 3 and Xcode 4 simulataneously installed $ /usr/bin/g++ --version i686-apple-darwin11-llvm-g++-4.2 (GCC) 4.2.1 (Based on Apple Inc. build 5658) (LLVM build 2336.11.00) $ /usr/bin/clang --version Apple LLVM version 4.2 (clang-425.0.24) (based on LLVM 3.2svn) Target: x86_64-apple-darwin11.4.2 Thread model: posix # building Boost cd ~/boost ~/boost.build/bin/b2 --layout=versioned --build-type=minimal toolset=darwin link=static architecture=x86 address-model=32 stage
After following these steps, you have lots of *.a files in ~/boost/stage/lib . Since layout=version is specified, they have the suffix -xgcc42-mt-1_53
CMake
Pretty simple. Go to their website, download CMake, and install. Also install the command-line tools at the end.
In the terminal, do "cmake --version" to check that the version is at least 2.8.10.2
Install NVIDIA Cg
Also pretty simple. Just use the install inside the DMG.
NVIDIA Cg Download
Building OGRE Dependencies
Since we are building our own version of Boost, we might as well build the Ogre dependencies also.
# get ogredeps source cd hg clone https://bitbucket.org/cabalistic/ogredeps # make temp directory for build cd ogredeps mkdir build cd build cmake -D CMAKE_OSX_SYSROOT=/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs/MacOSX10.8.sdk -D CMAKE_OSX_ARCHITECTURES=i386 .. # this seems to always compile in Release mode by default (i.e. -O3 is used) make # this creates a directory ~/ogredeps/build/ogredeps , and this is where we will tell Ogre to look for dependencies make install