Mac Development Guide
This page provides background and instructions to setup the Apple Xcode development environment in order to compile FreeSpace 2 Open SCP. After following these instructions you will have a working Xcode build environment, a checked out copy of the latest FS2_Open source code, and compiled binaries of the latest revision of the FS2_Open engine.
Contents
Getting Apple Xcode
Xcode is the integrated development environment (IDE) that Apple provides free of charge for the Mac OS platform. It is the Mac equivalent to Microsoft Visual Studio. In practice, Xcode provides a graphical interface to an underlying GCC or LLVM compiler; with the addition of platform libraries (Frameworks), code completion, project management and the other features you would expect of a modern IDE.
Xcode is free, and comes on a second disk provided alongside your operating installation disks with your Mac. However, the latest version of Xcode is available free from the Apple Developer Center (you do not have the enrol in the $99/year Mac Developer Program to access this download).
It is strongly recommended that you downloaded the latest version of Xcode compatible with your Mac OS version, as prior versions have bugs which prevent FS2_Open from compiling properly.
Mac OS X 10.6.4 | Mac OS X 10.5.8 | Mac OS X 10.4.11 | |
---|---|---|---|
Xcode 3.2.2 | Yes | n/a | n/a |
Xcode 3.1.4 | Unknown | Unknown | Unknown |
Xcode 3.0.0 | Unknown | Yes | Unknown |
Xcode 2.5 | Unknown | Unknown | Unknown |
Steps
- Access the latest Xcode release. You can just select the Mac Dev Center as the iPhone specific SDK is not required.
- If you are not already, register as an Apple Developer (free).
- Download the Xcode DMG to your computer, and open it.
Installing Apple Xcode
It is now time to install the Xcode IDE and the accompanying Frameworks and tools.
Steps
- Open the Xcode DMG or inserted DVD by double clicking on the icon.
- As you run through the installation you will eventually be greeted with the options to install different parts of Xcode.
- The essential package is always needed, however system tools, UNIX support, documentation and Mac OS X 10.4 support is optional.
- I recommend you install the documentation and system tools, both of these are quite useful especially the system tools option.
- The UNIX dev support is only need if you want to play around with some high level stuff.
- For more information read the little description box. If you ever find your need some of the products in the list you can always insert your DVD/DMG again and reinstall the missing apps.
- Once the installation is complete you can unmount the DMG or eject the DVD.
Xcode will now be available in Spotlight. If you followed the default settings, Xcode.app was installed at /Developer/Applications/Xcode.app. It may be useful to open Xcode.app, then right click on the icon in the Dock, go to 'Options' and set 'Keep in Dock'
You can open Xcode and take a look around if you'd like now. It will pop up with the new project wizard, and appear pretty spartan at the moment, so let's get the FreeSpace 2 Open SCP source code and the prepared Xcode project file for FS2_Open so that the engine can be compiled.
Getting the Freespace 2 Open SCP source code
Open Terminal.app through Spotlight, or it can be found in /Applications/Utilities/Terminal.app. This is the console command line for Mac OS. You will need a location to save the checked out source code. The following commands will create a new folder in your personal Documents called 'coding' and then within a subfolder specific for FS2_Open called 'fs2_open' checkout the latest Subversion revision.
cd Documents mkdir coding cd coding svn checkout svn://svn.icculus.org/fs2open/trunk/fs2_open fs2_open
Open Finder and browse to ~/Documents/coding/fs2_open/ to see the new files that have been downloaded from the FS2_Open Subversion source code repository.
FS2_Open currently uses some precompiled third party Frameworks to handle music and video on Mac OS, which are stored in compressed form within Subversion. Open the 'projects' folder and then 'Xcode'. This is the location of all Apple Xcode specific project files and settings. For now, double click on Frameworks.tgz to uncompress these Frameworks to a new folder called Frameworks.
Your local SVN checkout of the FreeSpace 2 Open SCP code can be keep up to date with the latest changes by opening Terminal.app again, and running the following commands
cd Documents/coding/fs2_open svn up
Xcode and the FreeSpace 2 Open SCP source code is now setup, so let's start our first compilation by double clicking on the FS2_Open.xcodeproj Xcode project file.
Compiling the FreeSpace 2 Open SCP source code
To compile a FS2_Open build without making any changes is straightforward. In the top left of Xcode 3.2.2 you will see a dropdown box with text similar to "10.4 | [Build Type] | FS2_Open | ppc". You can select the type of build with the [Build Type] section.
Once picked, click the 'Build' button. For the first time, this will take some time (dependent upon the speed of your hardware). This should complete successfully, and once done the binary application can be found within 'projects/Xcode/build/'. Open the folder with the same name as the build type you selected previously to find the compiled FS2_Open application.