Building Allegro 5.1 with cmake for MSVC 2008

Hi I try make a allegro5.1 project for Visual c++ 2008, by cmake.

1Guessed MSVC directory: cl 2Allowing MSVC to use SSE instructions 3Could NOT find GDIPLUS (missing: GDIPLUS_INCLUDE_DIR GDIPLUS_LIBRARY) 4WARNING: cannot use GDI+. Will try other libraries. 5Could NOT find PNG (missing: PNG_LIBRARY) 6WARNING: libpng not found, disabling support 7Could NOT find JPEG (missing: JPEG_LIBRARY JPEG_INCLUDE_DIR) 8WARNING: libjpeg not found, disabling support 9Could NOT find OpenAL (missing: OPENAL_LIBRARY OPENAL_INCLUDE_DIR) 10Could NOT find FLAC (missing: FLAC_INCLUDE_DIR OGG_LIBRARY FLAC_LIBRARY) 11WARNING: libFLAC not found or compile test failed, disabling support. 12Could NOT find DUMB (missing: DUMB_INCLUDE_DIR DUMB_LIBRARY) 13WARNING: libdumb not found or compile test failed, disabling support. <> 14Could NOT find VORBIS (missing: OGG_INCLUDE_DIR VORBIS_INCLUDE_DIR OGG_LIBRARY VORBIS_LIBRARY VORBISFILE_LIBRARY) 15WARNING: libvorbis not found or compile test failed, disabling support. 16Could NOT find Freetype (missing: FREETYPE_LIBRARY FREETYPE_INCLUDE_DIRS) 17WARNING: FreeType not found, disabling support. 18Could NOT find PhysFS (missing: PHYSFS_LIBRARY PHYSFS_INCLUDE_DIR) 19Could NOT find PHYSFS (missing: PHYSFS_LIBRARY PHYSFS_INCLUDE_DIR) 20Not building ex_color 21Not building ex_physfs 22Not building ex_font_justify 23Not building ex_logo 24Not building ex_ttf 25Not building ex_audio_chain 26Not building ex_synth 27Configuring done

It can't find libraries that I downloaded and I put in folders.

First I downloaded setup from, for example from here (libpng):
This file: Complete package except sources. And I installed it. Result?

1Could NOT find PNG (missing: PNG_LIBRARY PNG_PNG_INCLUDE_DIR) 2WARNING: libpng not found, disabling support

Okey, second try. I downloaded Developer files from same website and I put it in Visual include and lib folders.
Result? The same.

So, third half-lucky try: I found a path in cmake files for png headers: \usr\local\include\libpng
I put there png headers and it work, but just for headers. For libs I don't know what I should do. Anyway, result:

1Could NOT find PNG (missing: PNG_LIBRARY) 2WARNING: libpng not found, disabling support

Shows that headers are.

Edgar Reynaldo

I believe the suggested method to compile this way is to put all of your include and lib folder contents inside a folder named 'deps' that you create in your allegro folder that you are building.

So you have :


usr/local is for *NIX systems, I don't know why cmake would look there when generating an MSVC project. :-/


Thanks, it work. But I have some problem with the compiled allegro.

When I run my program, MSVC shows error:

1bool al_install_keyboard(void) 2{ 3 if (new_keyboard_driver) 4 return true; 5 6 //FIXME: seems A4/A5 driver list stuff doesn't quite agree right now 7 if (al_get_system_driver()->vt->get_keyboard_driver) { 8 new_keyboard_driver = al_get_system_driver()->vt->get_keyboard_driver(); 9 if (!new_keyboard_driver->init_keyboard()) { 10 new_keyboard_driver = NULL; 11 return false; 12 } 13 _al_add_exit_func(al_uninstall_keyboard, "al_uninstall_keyboard"); 14 return true; 15 }

in this line:

1if (al_get_system_driver()->vt->get_keyboard_driver) {

Allegro5.1 are compiled with 0 errors. But I downloaded dependences pack for allegro 4.9.8 from forum:

Maybe it's a reason?

Edgar Reynaldo

Did you call al_init before you called al_install_keyboard?

The dependent libraries you downloaded should still work, and you only have to link with them if you are static linking, or you use functionality from them. That's because the Allegro dll's have already been linked to them.


Did you call al_init before you called al_install_keyboard?

Yes. It's my program which work with allegro 5.0.3 binaries, but with 5.1 not.
I link new libs to project, and exclude 5.0.3.


I make project with new deps, that are downloaded by me, and still same problem with keyboard.

Edgar Reynaldo

Is your program using the right dll's? The init functions may be failing due to incompatible dll's.


In MSVC bin folder I have only 5.1 dll's, that I compiled. And not work.

I'm not sure, but maybe it's because I compiled allegro with using WindowsJG it's a mod for XP. So maybe keyboard driver are - I don't know - avaliable by another way ???

Edgar Reynaldo

The line it is crashing on indicates that the allegro system driver is probably NULL. That probably means al_init is failing to begin with. Build the debugging version of Allegro and link with that instead. That will give you an allegro.log file that may tell what is failing.

cd allegro\build
cmake -DCMAKE_BUILD_TYPE=Debug -G "Visual Studio 9 2008" ..


Nevermind, at now allegro5.1 work for me exclude al_uninstall_system(); I just removed it from my code :O
When new official binary come out I start to use this function.

Anyway, thanks.

Now I'm trying to understand shader addon.

Thread #607763. Printed from