Compile ZDoom on Windows

From ZDoom Wiki

Jump to: navigation, search

Contents

To build ZDoom on Windows, you have two options:

If you have Windows 2000 or better, you should use Visual C++ 2005, because this is the compiler the release versions of ZDoom are built with. If you choose, you can still use MinGW.

Note: if you have Visual C++ 2008, you can of course use it. However, this article keeps the 2005 version because the newer 2008 version requires users to register on Microsoft Live, and always produces executables that cannot be run on older versions of Windows. The steps for compiling with VC++ 2008 should be mostly the same as those listed for VC++ 2005.

If you only have Windows 95/98/ME, then you must use MinGW.

Required downloads for both Visual C++ and MinGW

  • NASM -- Note: in order to compile the latest code, you need to use v2.00 and above.
  • FMOD
  • The ZDoom source code, either from an official release or from the Subversion repository.
  • Subversion client -- This is only needed during the compilation process to update the revision number in the version string. The revision number will be set to 0 if you don't have these tools.
Note: If compiling GZDoom, you will need to download glext.h and wglext.h in a directory which will be included during compilation.

Visual C++ 2005

Compiling ZDoom on Windows is essentially easier then compiling it on Linux. All it takes is a few simple downloads and changing settings on Visual C++ 2005. Remember, this is directed to someone who never used Visual C++ 2005 before.

Downloads for Visual C++ 2005

First off, you must download some utilities to get started. These utilities are all free.

  • Visual C++ 2005 Express Edition -- This is the ISO download for Visual C++ Express Edition, and offers many of the same features as the paid version.
  • Windows Platform SDK -- The Express Edition of Visual C++ does not come with support for building native Windows applications out-of-the-box. As such, you must also download and install the Platform SDK before you can build ZDoom with it.
  • DirectX SDK -- You will need the latest Microsoft DirectX SDK package as well.

After the downloads

After you've downloaded everything, you must install all of them. You must remember the directories you've installed NASM and the Subversion tools into. DirectX and FMOD Ex installs by default in the Program Files directory.

Set up directories

When you're done installing, open Visual C++ 2005. (Start -> All Programs -> Visual C++ 2005 Express Edition -> Microsoft Visual C++ 2005 Express Edition)

When opened, go to Tools -> Options in the menu bar, you should get a dialog box that says "Options" in the title bar. Click the plus sign that's next to "Projects and Solutions" and click "VC++ Directories".

If the drop-down box under the label that says "Show Directories For" says "Executable Files", you have to set up NASM here (if not, select it now). Click the button that has a picture of a folder on it and select the new line it creates, and press the button that says "..." on it. In the Open Folder Dialog, select the directory where you unzipped NASM (such as, perhaps, C:\nasm-2.00), and another entry for the Subversion tools (in case you installed them). Make sure it points to the location of the executables (i.e. 'nasm.exe', 'svnversion.exe'), and not the root directory (unless the executables are there).

Then select drop-down box under the label that says "Show Directories For" and select "Include Files". Check to see that "$(DXSDK_DIR)Include" and "C:\Program Files\FMOD SoundSystem\FMOD Programmers API Win32\api\inc" are there. If they aren't, add them. Next, go to "Library Files" in the drop-down box and make two more new lines. Enter "$(DXSDK_DIR)Lib\x86" for one and "C:\Program Files\FMOD SoundSystem\FMOD Programmers API Win32\api\lib" for the other.

If you installed the FMOD SDK somewhere else, change "C:\Program Files\FMOD SoundSystem\FMOD Programmers API Win32" for the include and library files lists to the appropriate directory. %DXSDK_DIR% is an environment variable that is created when you install the DirectX SDK that points to the directory where you installed it. By using this variable (you must type it in by hand; you cannot use the open folder dialog), you can easily upgrade your DirectX SDK at anytime without having to change these directories again.

Select "OK" on the dialog box, then try to compile ZDoom (Build -> Build Solution or F7). If successful, it should compile error-less.

MinGW

Downloads for MinGW

Installing everything

  • Run the MinGW installer. When it asks which MinGW package you wish to install, you can choose either "Current" or "Candidate". "Candidate" is recommended because it is newer. When you need to choose the components, you must install at least the "MinGW base tools" and "g++ compiler." If you are not using MSYS, then you must also install "MinGW Make." Then unpack the 4.3.0 alpha binaries on top of your MinGW directory.
  • If you downloaded the MSYS installer, run it now.
  • Unpack the win32api files on top of your MinGW directory. If you didn't change it when you installed, this will be c:\mingw. The win32api headers are missing some definitions that ZDoom needs. Open mingw\include\commctrl.h and search for PBS_VERTICAL. Add these lines just underneath its definition:
#if (_WIN32_WINNT >= 0x0501)
#define PBS_MARQUEE     0x08
#define PBM_SETMARQUEE  (WM_USER+10)
#endif
  • Unzip the DirectX 8 headers on top of your MinGW directory as well.
  • You can unzip NASM anywhere you want. To keep everything in one place, a good place to put nasmw.exe and ndisasmw.exe is inside your MinGW directory at c:\mingw\bin.

Preparing the ZDoom source

  • Unpack the ZDoom source code wherever you like.
  • Open Makefile.mingw with a text editor and change the FMODDIR line to point to the directory where you extracted the FMOD Ex API.

Compiling with MSYS

If you are using Windows 95/98/ME, then you must use MSYS to build. There are limitations in the normal MS-DOS Window that will prevent ZDoom from successfully building on these operating systems without MSYS. If you have Windows 2000 or better, you don't need to use MSYS.

  • Run MSYS. The installer should have created a start menu shortcut for you.
  • Under Windows 95/98/ME, you must instruct the Makefiles that you are building under Windows and not Linux with this command:
    export OS=Windows_NT
    This variable is already set for you on Windows NT-based systems such as Windows XP.
  • CD to the directory where you extracted the ZDoom source code.
  • Build everything by typing
    make
  • This will produce zdoomgcc.exe in the current directory and zdoom.pk3 in the wadsrc directory.

Compiling without MSYS

  • Open a Command Prompt window. You can either use Start -> Run... and type "cmd" or you can find it in Start -> All Programs -> Accessories -> Command Prompt.
  • C:\mingw\bin should be in your path. To set this for just the current command prompt, use the command
    set PATH=c:\mingw\bin;%PATH%
    To make this automatic for all command prompts, you need to edit the Environment Variables on the Advanced tab of the System Properties control panel.
  • Build everything by typing
    mingw32-make
  • As with the MSYS build, zdoomgcc.exe will be in the current directory and zdoom.pk3 will be in the wadsrc directory.
Personal tools