[SDL] SDL under Mac OS X
Ryan C. Gordon
icculus at clutteredmind.org
Sun Jan 16 11:21:41 PST 2005
> I want to build my game for OS X. SDL shouldn't be statically linked
> because my program isn't GPL. Should I use the "framework" or the
> UNIX-style shared lib system ?
> I'd like to be able to keep SDL in my game's directory, too.
> I googled and looked at the os x faq on libsdl.org but didn't find the
Here's how I did it for ut2004 (which may not be the best way, but it
was the cleanest in the long run, in my opinion):
Build SDL "the unix way"...unpack the source, and from a Terminal:
Let the thing compile for awhile. When it finishes, one of the last
things in there should be the link command line...it starts something
gcc -dynamiclib -o .libs/libSDL-188.8.131.52.1.dylib .libs/SDL.o
...and runs for 35 lines or so.
Cut and paste that command, making a small change:
Change that to:
Take the library (.libs/libSDL-184.108.40.206.1.dylib, on my system) and put it
into your project. Link against that file. Now the program when run will
look for "libSDL-1.2.0.dylib" in the same directory as the program.
This is a pain to set up, but is dead simple thereafter, in terms of
packaging and distribution. Real Mac programmers are probably cringing
right now and can offer a better solution, but this worked great for me.
More information about the SDL