Jump to content

HOWTO : easy way to build GemRB on windows


Recommended Posts




This topic is the result of my work to compile GemRB on windows.

It uses the CMake and MinGW tools.


NOTE : The CMake configuration files I made were tested with MinGW and only MinGW. Although CMake is a very powerful cross-platform tool, I do not provide any warranty about its behaviour with UNIX, visual studio, cygwin ... If avenger is OK with that, I could expand it to use other platforms in replacement of the (ugly) autotools toolchain.


So get some coffee... here we go.


1) Installing the needed tools


First thing you will need is the Cmake executable. Get it here :

CMake download page

Download the Cmake win32 installer and install it.

During Installation, it will ask if you want to add the cmake executable into the PATH. Answer yes !


Then get the MinGW compiler toolchain from MinGW download Page


You will need :


the mingw automated installer : run it and choose MinGW base tools, g++ compiler and MinGW make.

Install it wherever you want in a directory without ANY spaces in its name. From here, I guess you've installed it in c:\mingw.


MinGW utilities : These are some utilities we will use later. Download the package terminating with .tar.gz (Do NOT download the one with src.tar.gz : you probably don't need the source of those tools ). Uncompress it into c:\mingw.


OPTIONAL (but you probably do want this) :

Get a Subversion client for windows.

TortoiseSVN TortoiseSVN homepage for those who prefer a graphical frontend.

The original SVN Subversion homepage for you, command-line crazy guys.


You will need a subversion client if you want to compile the most up-to-date sources. I would recommand this : lots of features have been added to the current trunk.



2) Installing the needed libraries


Libraries needed by GemRB are SDL, python, libPNG, Zlib and openAL.


The easiest to get is Python : go there Python download page and choose the Win32 Installer. Install it, you're done.


Other development libraries are there :


Download the "GemRB dependencies for MinGW (libs)" package. All that you need is in thie zip.


3)Getting the GemRB source code


You have two choices :


Get the (old) source archive from the gemrb sourceforge page. This is not recommanded : you will encounter bugs/missing features which are already fixed into the current trunk.


Get the latest trunk from the subversion repository. You will have the most up-to-date version and your bug reports will be relevant.


First choice : decompress the source archive where you want the source code to be.


Second choice :

Using tortoiseSVN (graphical svn client) : create a new directory, enter it, right click in this empty new folder and choose "SVN checkout". Under "URL of repository", put


That's it, you now have the source code.


Using command line SVN : open the windows terminal, go to a new empty directory, and type

svn co https://gemrb.svn.sourceforge.net/svnroot/gemrb/gemrb/trunk



4) Last tweakings


This nice title is almost a lie. There is still work to be done.


Open the notepad (start/programs/accessories/notepad).

Copy/paste this :

set PATH=%PATH%;c:\mingw\bin;c:\mingw\include;c:\mingw\lib;c:\mingw\include\SDL;c:\mingw\include\AL;

cd "Where you put the gemrb source code"

start cmd

Don't forget to change any relevant piece of information.


Save this to something like "gemrb-build.bat" (delete the .txt suffix notepad gives you when saving file), wherever you like.


Download the file gemrb-cmake.zip from here : Patch page

TortoiseSVN : Right click your gemRB source directory, choose "tortoiseSVN/apply patch". You get a small window with a list of files : right click on it and select "patch all". You're done.


Command line SVN :

Don't know how to do this with command-line svn. I use the patch utility on linux, but there is nothing like that on windows. I welcome any suggestion.

All this is not needed anymore, patches have been included to trunk.


Here we are ...


5) Where the magic happens


Double click gemrb-build.bat.

It opens a command line : you are in the source directory. First, we will create a build directory :

mkdir build

Go into this one :

cd build

And type :

cmake .. -G "MinGW Makefiles"

Let it configure. If you get an error message, then you did something wrong somewhere, or I forgot something.


Build GemRB :



Install GemRB :

mingw32-make install



Here you are : you have a complete gemrb install. The gemrb executable is placed in c:\Program Files\GemRB


Here, open the gemrb.cfg.sample file with wordpad. Tweak it according to the comments in this file.


6) Running GemRB


If you try to double-click gemrb.exe, you will have an error : some libraries are missing.

Download them at http://gemrb.sourceforge.net/download/

pick the latest gemrb_deps_dlls_yyyymmdd.zip and extract it into c:\windows\system32 or into the gemrb installation directory. I don't have any opinion about this.


The OpenAL library is not in this archive, since some manufacturers provide an accelerated version with their drivers. If this is not your case, dowload the windows iinstaller at www.openal.org


Here you are : double-click gemrb.exe and enjoy !


Some Comments

The installation directory is arbitrarily set by cmake. You can overwrite it using "-DCMAKE_INSTALL_PREFIX=Your\directory" when running cmake.


On my notebook, GemRB hangs when launching it with the latest SDL version. This bug is corrected in the SDL trunk. That's why the one shipped in the zip file is 1.2.11. You can try an older version if you want to.


Staying up-to-date : simply right click on your source folder and choose "SVN update", or for command-line lovers, go to this directory and type "svn update". Recompile, play gemrb and see what's new.

Link to comment

Nice job! :band:


Please add this to the wiki at gemrb.sf.net. I can help with the formatting and restructuration (there is no need to repeat the generic stuff).


By using plugins-prepare.sh and playing with the paths in the config, the installation step is not needed and gemrb can be ran from the source dir.

Link to comment
Nice job! :band:


Thank you. That is the only way I found to build GemRB on windows simply, without having to install msys/cygwin. Cmake is a great tool for quick configurations. I maybe will try to get it work with unix. (don't try it, it simply won't work)


By using plugins-prepare.sh and playing with the paths in the config, the installation step is not needed and gemrb can be ran from the source dir.


The fact is that windows does not have any support for sh scripts, except the ones provided with cygwin/msys, which both emulates an unix environment (especially about paths), and you probably don't want that.


Maybe tweaking some options in CMake configuration files would be helpful.

Link to comment
btw, doesn't cmake support specifying files with glob patterns? It is tedious to update the build system after every file addition.


Of course it does. It's the way used to install every file of the override / GUIScripts direcories; It could be extended to other directories, but I preferred to follow the way it was made in Makefile.am.


Adding a source file is not so frequent. Adding it to CMakeLists.txt is not a big amount of work. I could do it anyway, that would not be so difficult.


Oh, BTW, are you interested in an UNIX-friendly set of files ?

Link to comment
Is there any way to get the libopenal.a file directly ? Maybe openal license forbids it ? The pexports step is actually crashing under vista64.


I can provide you libopenal.a if you need it, I think its license permits it (might be LGPL). I don't have it there, you should wait monday...


Your experience interests me since I don't know what is the behaviour of windows Vista with this way to compile. I hope it is not so different as with winXP...

Link to comment

After a quick look at the openal site, I found that I can redistribute it without any problem. I'm just looking for a safe place for where to put it.


Maybe I'll send this to the gnuwin32 project....


EDIT : Mingw and its tools are only compiled for 32 bits. Make sure you use the file in OPenAL SDK\libs\win32 :)

Link to comment
Guest Guest
being totally inept to any of this stuff, can someone explain what command line SVN is and what the windows terminal is, in short would it be a bother for step-by step for this bit for me, by PM or something? Thanks in advance.


whoops, not logged in, send a PM to Lord Of Al, thanks

Link to comment


This topic is now archived and is closed to further replies.

  • Create New...