I have Macbook with Snow Leopard 10.6.2 installed and Allegro 4.4.1.1. I did have some hiccups with Allegro 4.4.0.1. Not sure if this was my fault or the distro as I'm still newish to the Mac and the Allegro Mac instructions are a bit dated.
I first tried building Allegro as a framework, but this doesn't work as I think it should. If you include a framework using: #include "Allegro/allegro.h", the internal Allegro files don't prefix with the framework name "Allegro". So, you end up adding the framework path, which is pointless, so you may as well just compile Allegro in /usr/local and link it from there.
Get Allegro (I used 4.4.1.1). Unzip. I have cmake 2.8. In the Allegro directory :-
- mkdir build
- cd build
- cmake ..
- sudo make install
- make clean
- OpenGL - included in OS.
- libpng, zlib and vorbis - These can be downloaded and installed as standard libs in /usr/local. I don't bother with fink or Macports as I don't want the clutter. I want everything to work "natively". There are some details under the pygame build instructions.
From the mailing list it appears that you can only compile Allegro as a 32 bit library, there is no 64 bit support so any libraries or frameworks and the dependent libraries will have to be 32 bit. Leopard default is 32 bit. Snow Leopard default is 64 bit.
Creating project in Xcode
- Create a new command-line C++ tool project.
- Paste in the GL example.
- Add /usr/local/include to the header search paths in project settings.
- Add the following frameworks to "Link with Binary Libraries" :
- Cocoa.
- OpenGL.
- Carbon. (Ideally you shouldn't need this, but there is some reference to ShowMenuBar and HideMenuBar, which doesn't appear when you build Allegro as a framework.)
- Add the following libraries from /usr/local/lib :
- liballeg.4.4.dylib
- liballeggl.a
- liballeg-main.a (This is a stub for "main" that glues Cocoa to Allegro.)
- Build the target and it should compile and link.
- You are now good to go at writing OpenGL games using Allegro.
[8-Apr-10] Changed because building as framework just doesn't work properly.
2 comments:
Unfortunately it's true, you can't use any library that was compiled as 64bit, so we can't even use libpng if it was installed using macports. This is really sad :/
According to this: http://wiki.allegro.cc/index.php?title=Install_Allegro5_From_SVN/OSX
You can compile libpng in "universal" mode, which includes a 32 bit version:
sudo port upgrade --enforce-variants libpng +universal
Post a Comment