DarkRadiant - Compiling in Windows

From The DarkMod Wiki
Jump to navigationJump to search
The printable version is no longer supported and may have rendering errors. Please update your browser bookmarks and please use the default browser print function instead.

To compile the sources in Windows you will need Visual Studio 2022 Community Edition or higher. The Community Edition can be acquired for free and is able to produce 64 Bit builds.

You will need a Git client to clone the sources to your machine and install the Windows dependencies package. Then you're set up to compile DarkRadiant in Visual Studio.

Install a Git Client

The main codebase is stored and maintained on github, therefore you'll need a Git client like

Download and install the git client into any folder of your preference. After installation it might ask to reboot your machine, as Tortoise integrates into the Explorer shell.

Download Sources and Dependencies

Using Github Desktop

Create your github-login, configure github desktop as desired, especially the default clone path in the options dialog. Browse to the github page of DarkRadiant and click on Clone in Windows. That's it!

Using TortoiseGit

To prepare the source download, open Windows Explorer and create the folder you want to clone (i.e. download) the sources into. Make sure the folder does not contain spaces. Use your Git client to clone the DarkRadiant repository from github:

Make sure the recursive flag is checked in the dialog.

Dr git clone.png

Cloning takes a minute or two - after the process is finished your folder should be looking like this:

Dr bare repo.png

Compile

Start Visual Studio and open the DarkRadiant solution file (.sln) which is ready for you in the root of the repository.

Select release build (unless you want to debug a problem) and hit Ctrl-Shift-B in VC++ to start building the sources or select "Build > Build Solution" from the menus.

Note

If you cloned the sources to C:\Games\DarkRadiant, the application binary will be placed in C:\Games\DarkRadiant\install\DarkRadiant.exe

The project output files are set up in a way to automatically install the binaries in the install/, install/modules/ and install/plugins/ folders. Also, all dependencies from the w32deps/ folder (see previous section) are automatically copied to the install/ folder during the post-build event. If anything goes wrong during compilation, please seek help in the forums.

The build expects the windeps folder to be stored in the root of the source tree, it should be created automatically the first time a build is started. See below for how to set up the folders in case that step went wrong.

Manual Download of the Dependencies Package

For Windows builds additional dependencies are automatically downloaded and copied into the source tree by the build steps in Visual Studio. If this fails for any reason, you'll have to download and extract the package yourself, either by executing the script in

tools/scripts/download_windeps.ps1

or by downloading the 7-zipped packages from the following URL (you can get 7-zip here):

https://github.com/codereader/DarkRadiant_WinDeps/releases/latest

Download and extract it directly to the directory you cloned the sources to. The resulting folder structure should look like this.

Dr windeps repo.png

Important: The windeps/ folder must be in the same folder as the radiant/ or include/ folder.

(Optional) Compiling the Windows Dependencies

This step is optional and more advanced. You won't need to do this if you just want to compile and run DarkRadiant using the currently maintained version of Visual Studio.

Note: in the past DarkRadiant was linking against a few boost libraries requiring static libraries, this is no longer the case since August 2017.

Compile the support libraries

DarkRadiant is using a lot of third-party libraries like libxml2, libiconv, vorbis, etc.

For Windows I set up custom VC++ solutions to compile most of the libraries directly from the source (as many of those third-party projects don't offer Windows x64 binaries), these projects can be found in the winbuild folder in Git. The winbuild folder contains all the sources needed to build the x64 dependency binaries.

The VC++ project files can be found in the winbuild/msvc folder. To check out the repo, go ahead like this:

  1. Right-click your C:\Games folder >> Git Clone...
  2. Select https://github.com/codereader/DarkRadiant_WinDeps.git to C:\Games\DarkRadiant_WinDeps

or by using the git command line

  1. git clone https://github.com/codereader/DarkRadiant_WinDeps.git C:\Games\DarkRadiant_WinDeps

Program Database Files (.pdb)

When debugging a DarkRadiant crashdump, you'll need the program database files to get substantial information out of it, so it's vital to save the .pdb files right after compilation, otherwise they won't match against the signatures in the crashdump.

As far as the windeps dependencies are concerned, I've zipped up all the .pdb files and stored them on the GitHub release page:

See also / Links