Getting the Ogre 1.8 Tutorials to compile and run on OS X using Xcode 4 can be difficult. This topic covers the complete list of steps used to get your own project (or the Tutorials) up and running quickly.
Install Ogre SDK prebuilt version with prebuilt dependencies
- Download and install Ogre SDK prebuilt binary from http://www.ogre3d.org/download/source. You can install the SDK anywhere on your computer.
- Download and install Ogre prebuilt dependencies from http://sourceforge.net/projects/ogre/files/ogre-dependencies-mac/1.8/.
- After extracting the dependencies, move the entire Dependencies folder from the archive into the root of the Ogre SDK.
- Download and install the NVIDIA CG framework from http://developer.nvidia.com/cg-toolkit-download. Follow the direction from NVIDIA to get everything installed correctly. Once it is installed you should be able to find Cg.framework in /Library/Frameworks.
- Download and install the Xcode 4 templates from http://sourceforge.net/projects/ogre/files/ogre-dependencies-mac/1.8/
- During the install, you can choose to skip the iOS SDK location if you want.
- Open Xcode and create a new project using the Ogre OS X template.
- On the left side in the navigator, select the project. You should be presented with project and target settings. Under either the project or target(it doesn't matter), select Build Settings near the top center of the window. Now down near the bottom you should see a button labeled Add Build Setting, click on it and choose User-Defined Setting. Name this new setting OGRE_SDK_ROOT and set the value to the path where you installed the Ogre SDK. For example: ~/OgreSDK
- Navigate to the project you created.
- Build and run the tutorial framework. You should see the Ogre head demonstration.
If you run into build errors you might need to try installing the dependencies to your system rather than using the pre-built dependencies. Here are the steps to do this...
Install Ogre dependencies to your system
- Install Dependencies via macports (option 2 at http://www.ogre3d.org/tikiwiki/Prerequisites?tikiversion=Mac+OS+X+%26+iOS)
- Download and install the NVIDIA CG framework from http://developer.nvidia.com/cg-toolkit-download. If you already completed this using the previous directions, there's no need to do it again.
- Download and install OIS from http://sourceforge.net/projects/wgois/files/Source%20Release/1.3/
- Patch OIS with the following 64 bit patch:
- Download the "Cocoa and 64 bit support" patch from http://sourceforge.net/tracker/?atid=775955&group_id=149835&func=browse
- Download the source for OIS from http://sourceforge.net/scm/?type=svn&group_id=149835
- In a terminal, cd into the OIS source you checked out and use the Unix patch tool to apply your patch (patch -p0 -i cocoa.diff)
- Build and run your Xcode template again.