Using libsdl-framework

Anders F Björklund afb at macports.org
Mon Dec 1 00:32:26 PST 2008


Braden McDaniel:

>> Normally this is handled by `sdl-config`, not so with Xcode.
>
> Ah, you mean if I'm using libsdl (i.e., not the framework variant).

Yup. (gcc -o foo `sdl-config --cflags --libs` foo.c)

Using frameworks outside of Xcode.app usually lands in "unsupported",
i.e. most setups are using frameworks with GUI or libraries with CLI...

Note that the include style varies between frameworks and libraries too.
As in <SDL/SDL.h> is for frameworks, while "SDL.h" is for libraries.
For SDL it usually leads to the same place, but for other frameworks
such as SDL_image or OpenGL the install location varies between the two.

>>>   gcc -o foo -framework SDL foo.c
>> You are missing a "-F/opt/local/Library/Frameworks", as well ?
>> (so that it can find it in the ${prefix}, like with -I or -L)
>
> libsdl-framework appears to get installed to /Library/Frameworks,  
> so this is not required.

Consider that a bug ;-)

Seriously, you don't need any -I or -F when using /usr/local or
/Library/Frameworks but MacPorts *should* install to /opt/local...

>> libSDLmain.a is only included with the library (non-framework)
>> version of SDL, with the framework you need to compile SDLMain.m
>
> Okay; thanks for the confirmation.

It's the same thing really (i.e. libSDLmain.a is built from SDLMain.m)
just that the framework download/install doesn't include a binary...

Normally you would use the Xcode template to set up a new Xcode project,
and that would include the SDLMain.m source. Outside MacPorts, that is.

--anders



More information about the macports-users mailing list