Compiling using Xcode

From OdaWiki

Opening the project

Screenshot of the odamex Xcode project

You can open "odamex.xcodeproj" with Xcode (development environment distributed with Apple's OSX). In the project window (shown in screenshot), you can choose a target to attempt to build from the dropdown box in the upper-left corner. If you get build errors on a release version, please make sure you have the frameworks for SDL & SDL_mixer installed (described below).

Instructions for building the launcher on Mac OS X do not currently exist (to my knowledge) because there is a lack of a simple framework for wxwidgets on Mac OS X. wxWidgets needs to be built from source, and there's a good number of headaches that can go with that.

Side note: If you run the release builds from xcode, you have a good chance of causing a bus error that does not appear when you simply launch the program from finder (or however else).

Required frameworks

You will need to make sure the following frameworks are installed:

Cocoa.framework (comes with OSX)
Carbon.framework (comes with OSX)
SDL.framework
SDL_mixer.framework

Links to the SDL & SDL_mixer frameworks can be found on the Required Libraries page. You will want to grab the binary installation packages. The framework directories found in both disk images should be copied to /Library/Frameworks.

Alternatively, you can copy them to /Users/USER/Library/Frameworks, where USER is your username on your machine. In this case you will need to replace the frameworks in the Xcode project (Source->client->libraries). This is for users who want the frameworks to only be available locally or do not have access to install frameworks globally.

Building the client, server and master

Right-click on the appropriate item under the "Targets" list (in the workspace window), and select "Build" from the pop-up menu.

Building the Launcher on Mac OS X (SVN)

The OSX launcher is in a separate Xcode project, and can be found in the "osxlaunch" directory of the odamex SVN tree.

Building the Launcher on Mac OS X (v0.2)

This is a bit messy (at least for me), and requires some tinkering about in places that not all people like to deal with. It's so much easier when it's just "open project, choose target, click build"... Too bad we don't quite have that luxury (although I imagine it isn't that hard to actually make it work.

Anyway, I've managed to do this (and I think as a universal binary) by doing the following: (wiki's are not my strong part.. sorry)


download wxWidgets. unpack, and build wxWidgets as follows (using Terminal):

cd /path/to/wxwidgets-source
mkdir osx-build
cd osx-build
../configure --disable-shared --enable-universal-binary
make

And... go get lunch, this will take awhile.


Now, on to odalaunch: Because of a runtime crash involving list coloring, you need to edit src/dlg_main.cpp. comment out line 276:

//SERVER_LIST->ColourListItem(i);


In the odamex/odalaunch directory, edit the makefile: fix the following for OS X (and somewhat specific to your install):

WXBASE = /path/to/wxMac-2.8.0/osx-build
WXCONFIG = $(WXBASE)/wx-config
WXRC = $(WXBASE)/utils/wxrc/wxrc
CFLAGS = $(shell $(WXCONFIG) --cflags) -g -arch ppc -arch i386

adding the above -arch flags enables the thing to build a universal binary (hopefully) run: "make"


When all is done and said, you should now have a odalaunch.app. It's a bit unstable, but it appears to work. Your milage may vary.