Author Topic: Mac OS X Framework support  (Read 7427 times)

Offline afb

  • Developer
  • Lives here!
  • *****
  • Posts: 884
Mac OS X Framework support
« on: December 05, 2006, 12:03:52 am »
To support wxMac, we need to add support for system frameworks...
(Extension *.bundle was added by mistake, should be *.framework ?)

These are added like: /System/Library/Frameworks/OpenGL.framework,
which would result in the following compiler flags (for GCC/G++/GDC):
  • -F/System/Library/Frameworks
  • -framework OpenGL
The first GCC param is optional, since /System/Library/Frameworks is
already in the default search path (compare with -I/usr/lib for UNIX)
Default framework search path:
  • ~/Library/Frameworks
  • /Library/Frameworks (comparable with /usr/local)
  • /Network/Library/Frameworks
  • /System/Library/Frameworks (comparable with /usr)

Then one needs to modify the sources as well, to change <GL/gl.h> into
<OpenGL/gl.h> but that can be made conditionally with #ifdefs if wanted.
(An include like <Framework/header.h> tells the Apple GCC compiler to
search in the current framework path, and include a file from "Headers")
#include <OpenGL/gl.h>
// looks in /System/Library/Frameworks/OpenGL.framework/Headers/gl.h
#include <GLUT/glut.h>
// looks in /System/Library/Frameworks/GLUT.framework/Headers/glut.h
There are no GL directories in /usr, except for the non-Mac files for
(i.e. wxGTK can link with /usr/X11R6/include/GL/gl.h, but wxMac should not)

Non-system libraries might be frameworks, or they might be dynamic libraries.
(e.g. SDL is available in both variants, both of SDL.framework / libSDL.dylib)
  • /Library/Frameworks/SDL.framework/SDL
  • /usr/local/lib/libSDL.dylib
Note that both of these carry the same code, just as our Code::Blocks can exist
both in /usr/local/bin/codeblocks or in /Developer/Applications/

So, how do we add these to Code::Blocks ? I'm thinking they should be new fields...
And the compiler code can then use that field for both header searching and linking ?

This will probably be a 1.5 feature, though, since 1.0 will only have the regular libs.
(i.e. until there is builtin support, one adds the Frameworks as "extra linker flags"...)