Allegro.cc - Online Community

Allegro.cc Forums » Installation, Setup & Configuration » Allegro 5.1.XXX Compile Article

This thread is locked; no one can reply to it. rss feed Print
Allegro 5.1.XXX Compile Article
Ivan Zhukov
Member #15,858
January 2015

Hi!

I have tried to complile latest version of allegro. And I had realised that it is not easy as any other libraries like SDL or SFML.

Maybe some articles already exists, but my search was fail :(

I think that is not a real problem to describe us how to comple this library (with detail step by step). It will be not shor/not big article, but it will get new users for this lib. Becouse, a lot of users go away due to hard to comppile lib from first or second trying.

Can anybody post some article, how to comple allegro from scratch. For example for vs2013. How to obtain files that equals to published at http://cdn.allegro.cc/file/library/allegro/5.0.10/allegro-5.0.10-msvc-11.0.zip

Sorry for my english

SiegeLord
Member #7,827
October 2006
avatar

It's relatively straightforward to compile Allegro with MinGW or MinGW-w64/MSYS2. MSVC isn't as nice, so generally you have to rely on pre-built libraries.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

You need cmake installed and then you can build like this :

cd allegro
mkdir build
cd build
cmake -G "Visual Studio 12" -DCMAKE_BUILD_TYPE=Release -DSHARED=On -DWANT_MONOLITH=On ..

Then open the solution it creates and build it with MSVC.

That's the basics of it. Where it gets hard is compiling the rest of the dependency libraries with MSVC. Build support is spotty. Some of the dependencies can be built with cmake as well, like zlib, libpng, physfs, and freetype. Others need to be built with configure, which is only available through Cygwin, MSYS, or Unix, but luckily these all support msvc projects in a win32 folder (though the version may be out of date, so get latest sources) like ogg, vorbis, and theora.

See README_msvc.txt in the source distribution for additional build notes.

SiegeLord
Member #7,827
October 2006
avatar

Yeah... I just tried going through the process and everything is super easy for the CMake-enabled libraries, but getting libogg/libvorbis compiled is proving to be basically impossible. I wish they'd get a CMakeLists.txt in their libraries :P.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

LennyLen
Member #5,313
December 2004
avatar

SiegeLord said:

but getting libogg/libvorbis compiled is proving to be basically impossible

I think I had problems with libogg last time I tried building Allegro as well. It wanted a header file that wasn't included with MinGW.

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

SiegeLord
Member #7,827
October 2006
avatar

That wasn't the issue (indeed, it managed to open and convert the project/solution files). It took a bit of time to get libvorbisfile to find libvorbis though... I ended up just creating directories where the stupid project was trying to find the lib files. I did discover that I broke A5 building without the D3D SDK :D.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Edgar Reynaldo
Major Reynaldo
May 2007
avatar

Thomas Fjellstrom
Member #476
June 2000
avatar

Newer Mingws or MSYSs may not even need dx9mgw.zip at all :o

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

pkrcel
Member #14,001
February 2012

Mingw-w64 doesn't, since it provides up-to-date directx headers from winelib.

MSVC doesn't need the DXSDK itself since it ALSO provides all the needed headers (but not ABSOLUTELY ALL of them IIRC, anyway not anything Allegro needs).

SO far, I couldn't find ANY reason not to switch to Mingw-w64 over the old Mingw (which is stale).

Mingw-w64 IS available also for 32-bit systems, and provides a TON of toolchain and libraries through the MSYS2 project.

EDIT: by the way, I did build Allegro the very first time with MSVC, and all of the dependencies myself or got the binary for windows when available...O honesly don't remeber being THIS big hassle.

I'll fire up again MSVC and try to build allegro from git in the next days to see what changed in the ecosystem.

It is unlikely that Google shares your distaste for capitalism. - Derezo
If one had the eternity of time, one would do things later. - Johan Halmén

Thomas Fjellstrom
Member #476
June 2000
avatar

Now that I'm back home, I'll attempt to get the build shit working that I promised. I have a busy schedule though, so I can't give a date as to when it'll get done. But I am hoping [1] to have automatic Mingw64/MSYS2, debian, and MSVC binaries for both stable, wip, and git.

References

  1. no guarantees, msvc may prove to be neigh impossible

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

pkrcel
Member #14,001
February 2012

Isnt' there a way to produce MSVC "compatible" C DLLs cross compiling with mingw?

I know a couple FOSS projects out there proved something like that

EDIT: nevermind, you indeed CAN produce a suitable import file with which MSVC can correctly link a C DLL with MinGW but this precludes the possiblity to statically link.

It is unlikely that Google shares your distaste for capitalism. - Derezo
If one had the eternity of time, one would do things later. - Johan Halmén

SiegeLord
Member #7,827
October 2006
avatar

pkrcel said:

MSVC doesn't need the DXSDK itself since it ALSO provides all the needed headers (but not ABSOLUTELY ALL of them IIRC, anyway not anything Allegro needs).

It doesn't provide D3DX9 headers, which Allegro uses for some advanced features.

Quote:

O honesly don't remeber being THIS big hassle.

Well, it did only take a few hours... it's not a show stopper, but mildly annoying :P. The worst part for me, was finding a computer with enough free space on the C drive to install MSVC, as it refuses to be installed on a different drive in a meaningful way.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

pkrcel
Member #14,001
February 2012

SiegeLord said:

It doesn't provide D3DX9 headers, which Allegro uses for some advanced features.

Right, now I remember...I should have mentioned that I was focused in using Opengl also on Windows so I just let things be in cmake (alas WANT_D3D9EX off as default IIRC).

Quote:

Well, it did only take a few hours... it's not a show stopper, but mildly annoying :P. The worst part for me, was finding a computer with enough free space on the C drive to install MSVC, as it refuses to be installed on a different drive in a meaningful way.

Let's not get into Visual Studio wonkyness, that is a separate problem, don't you think? ;D

Kidding aside, I'll have to try again MSVC just to taste the problem.

It is unlikely that Google shares your distaste for capitalism. - Derezo
If one had the eternity of time, one would do things later. - Johan Halmén

SiegeLord
Member #7,827
October 2006
avatar

pkrcel said:

(alas WANT_D3D9EX off as default IIRC).

D3D9EX is different from D3DX9. The former is some weird Vista extension, while the latter is what makes shaders work.

"For in much wisdom is much grief: and he that increases knowledge increases sorrow."-Ecclesiastes 1:18
[SiegeLord's Abode][Codes]:[DAllegro5]:[RustAllegro]

Ivan Zhukov
Member #15,858
January 2015

>>Right, now I remember...I should have mentioned that I was focused in using Opengl also on Windows so I just let things be in cmake (alas WANT_D3D9EX off as default IIRC).

I think directx in allegro is a neccesary future! Becouse some users, that download shareware games have old computers where DirectX is working perfectrly, but not opengl.

I have choosed Allegro instead of (cocos2d-x, SDL and many other) due to DirectX support.

pkrcel
Member #14,001
February 2012

SiegeLord said:

D3D9EX is different from D3DX9. The former is some weird Vista extension, while the latter is what makes shaders work.

Curious, I'm fairly sure I haven't had the need to install the DX SDK when at first using MSVC. But I might be wrong of course.

I think directx in allegro is a neccesary future! Becouse some users, that download shareware games have old computers where DirectX is working perfectrly, but not opengl.

Might be as you say, but Allegro Directx support its already quite advanced.

It is unlikely that Google shares your distaste for capitalism. - Derezo
If one had the eternity of time, one would do things later. - Johan Halmén

Thomas Fjellstrom
Member #476
June 2000
avatar

The directx those old games use, is really DirectDraw, not Direct3d. Allegro 5 only uses Direct3d, but it does use a sufficiently "compatible" (read: old) subset of the api for most of what it needs.

--
Thomas Fjellstrom - [website] - [email] - [Allegro Wiki] - [Allegro TODO]
"If you can't think of a better solution, don't try to make a better solution." -- weapon_S
"The less evidence we have for what we believe is certain, the more violently we defend beliefs against those who don't agree" -- https://twitter.com/neiltyson/status/592870205409353730

Ivan Zhukov
Member #15,858
January 2015

I mean that directx is more simplest software to install than drivers for video cards. And users can install it. Driver for Video Card (for normal support OpenGL) it is usualy problematic software even for pro-users.

So my opinion that games, that use DirectX are more easy to install.

Go to: