Building Zandronum from source on Windows XP/Vista/Seven

Many may find this interesting, because currently there are no daily build hosts. In this mini “how to” I'll try to tell how to build Zandronum from scratch for Windows x86. There are several problems in source code that prevent it to compile for Windows x64, so we'll build only 32-bit version for now. For this article I’ve used my home machine with Windows 7 x64 and built the latest Zandronum revision.

Let's split the process by 4 stages:
1) Downloading development environments and libraries
2) Installing and configuring the environment
3) Getting the sources
4) Compiling and harvesting obtained binaries

If you do this not for the first time – you may proceed directly to step 3.

1. Downloads

1. Microsoft Visual Studio 2005 Professional - you can get it anywhere you want. Express edition is free but it doesn't have 64-bit compiler.
2. Microsoft Platform SDK 2008 - mount the image or extract using an archive program (like WinRAR).
3. Visual Studio Libraries for Doom Ports - Includes DirectX SDK (Feb 2010), Logitech LCD SDK, SDL libraries
4. FMOD API Collection for Doom Ports - Includes various FMOD versions for all ZDoom based ports
5. NASM 2.08.02 - 32-bit assembler.
6. glext.h and wglext.h - OpenGL headers
7. Mercurial 2.4 - program for grabbing the sources.


2. Installing programs
1. Install VS2005 in "Full" variant to support 64-bit compilers. Upon the first launch select "Visual C++ Development Layout" in popup window.
2. Close VS and open file "C:\Program Files (x86)\Microsoft Visual Studio 8\VC\VCWizards\AppWiz\Generic\Application\html\1033\AppSettings.htm". Comment out lines 357-359 like this:
// WIN_APP.disabled = true;
// DLL_APP.disabled = true;
// LIB_APP.disabled = true;
3. Comment out lines 912,913,918,919 in file "C:\Program Files\Microsoft Visual Studio 8\VC\include\intrin.h". First should be
"__MACHINEI(unsigned char _interlockedbittestandset(long *a, long b))"
4. Comment out lines 944,945 in file "C:\Program Files (x86)\Microsoft Visual Studio 8\VC\include\intrin.h". First should be
"__MACHINEI(unsigned char _interlockedbittestandset(long *a, long b))"
5. Install Platform SDK into default directory selecting variants shown in this screenshot.
6. Extract Doom libraries to C:\ (will be C:\libs), extract FMOD collection to C:\libs.
7. Extract NASM archive into "C:\Program Files (x86)\Microsoft Visual Studio 8\VC\PlatformSDK\Bin" and copy nasm.exe to nasmw.exe.
8. Place OpenGL headers to "C:\Program Files\Microsoft SDKs\Windows\v6.1\Include\gl".
9. Install Mercurial into default directory. Don't uncheck "Add the installation path to the search path" in last step of wizard!
10. Open Visual Studio and select in menu Tools - Options. Go to Projects and Solutions - VC++ Directories.
11. In "Platform" dropdown select Win32, then Show directories for - Include files. Add paths:
C:\libs\include - should be on top of the list
C:\Program Files\Microsoft SDKs\Windows\v6.1\Include
C:\libs\fmod424\api\inc
Delete path:
$(VCInstallDir)PlatformSDK\include
12. In "Show directories for" dropdown select "Library files". Add paths:
C:\libs\lib\x86 - should be on top of the list
C:\Program Files\Microsoft SDKs\Windows\v6.1\Lib
C:\libs\fmod424\api\lib
Delete path:
$(VCInstallDir)PlatformSDK\lib
13. Done configuring the environment.

3. Obtaining source code
1) Let's download the latest sources. Open a console (cmd.exe) and go to folder you need. Execute a command:
hg clone https://bitbucket.org/Torr_Samaho/zandronum
Sources will be downloaded to zandronum subfolder. If you see corrupted fonts of hg program, delete the folder "C:\Program Files\Mercurial\locale".
2) If you want you may download a stable version. Go to "Tags" tab, find the version you want, and download is as zip. Extract the downloaded archive to a folder you need.
3) To update the existing source code, execute that command again:
hg clone https://bitbucket.org/Torr_Samaho/zandronum

4. Compiling the source
1) Open Visual Studio and load file zandronum.sln.
2) In first dropdown on toolbar (Solution Configurations) select "Release", but in second (Solution Platforms) select your platform.
3) Launch compilation process by selecting Menu Build - Build Solution (don't pay attention to "Updating IntelliSense" in status bar).
4) If some projects fail to compile try to launch the Build once again, you will see which errors exactly happened.
5) For Zandronum to work properly following files are required:
1. zandronum.exe and zandronum.pk3 from the folder where it was compiled.
2. fmodex.dll from C:\libs\fmod424\api
3. skulltag_actors.pk3 (optional) contains latest DECORATE definitions for Skulltag stuff

zandronum.exe is native for Windows XP. It can be run in Windows 98 or higher.

You will see version number in window title, in console or by "gameversion" command. If your windows is installed not in C:, use your letter everywhere in this "how to". If you have 32-bit Windows, use "Program Files" folder instead of "Program Files (x86)".