[SDL] OSX port

Mike Shal marfey at gmail.com
Sun Jul 1 05:44:18 PDT 2007


On 7/1/07, Chris Dobbs <chris_dobbs at dobbscr.karoo.co.uk> wrote:
>
>
> All,
> I am about to port an SDL app. from linux to OSX. I have never developed on
> OSX before but just wondered if there any gotchas I should know about. As
> it's BSD under the hood, allbeit the Darwin flavour  (which I believe uses
> the mach micro-kernel...) it should be straight forward...yeah right !!
>
> I am using wxWidgets for the GUI portion of the app and SDL for the sound
> and video abstraction.

I don't know anything about wxWidgets, but the SDL portion worked out
of the box for me when I ported marfitude. The only major issues I had
in porting (as I recall...it's been a while :) were:

1) There was no simple dlopen()/dlsym()/dclose() functionality that
you would expect in a Linux or BSD environment. I was eventually able
to wrap it with a few macros that call
CFReallyLongFunkyNameFunctions(). Point is if you dynamically load
stuff at run time you should check to see if OSX now supports those
functions (I last checked 10.4, I think...), or just copy the macros
from util/dl.h in the marfitude source.

2) The other issue I had was providing the .dmg file (bundle?) so you
can move the entire game using the one icon, double click to run, etc.
It just took me a while to figure out the directory structure, which
files were actually necessary, etc. Also there was some weird caching
issue where OSX caches bundle data, so I just had to log out and log
back in every time I changed that stuff (like Info.plist and friends).
Maybe there's an easier way - I'm clearly not a Mac guru :). If it
helps, you could again look at the marfitude source (in
marfitude/macosx/, and mk/arch/darwin.mk) as a fairly basic example.
That directory contains all the stuff that forms the bundle info, and
the darwin.mk file has the commands to build the bundle. You might
want to check out a tutorial online first though so you have some idea
of what's going on.

If you don't use dlfoo() and don't want to build a bundle, you might
have an easy time with it ;)

Hope that helps,
-Mike


More information about the SDL mailing list