To read the most recent compilation guide, please visit:
  http://wiki.thedarkmod.com/index.php?title=The_Dark_Mod_-_Compilation_Guide

Build process outputs TDM binaries to relative path "../darkmod", so you are strongly advised to have the following directory structure:
  [base_tdm_path]/darkmod       <-- darkmod game location (contains e.g. TheDarkMod.exe)
  [base_tdm_path]/darkmod_src   <-- source code location (contains e.g. TheDarkMod.sln)


== Compiling on Windows ==

Microsoft Visual Studio 2013 (VS2013) is used to build TDM on Windows.
Open solution file TheDarkMod.sln to start working.
Choose appropriate platform and configuration, then build solution.
All built executables will be put into "../darkmod" directory, potentially replacing the TDM executables already located there.

You can use VS2013 Community Edition, which can be downloaded from here:
  https://www.visualstudio.com/en-us/news/releasenotes/vs2013-community-vs#download-visual-studio-2013-community
During installation, make sure that "Microsoft Foundation Classes for C++" (MFC) will be installed.

You will also need the "Multibyte MFC Library for Visual Studio 2013", which is downloaded and installed separately:
  http://www.microsoft.com/en-us/download/details.aspx?id=40770

The code uses DirectInput, which is automatically installed with VS2013 as a part of Windows SDK.
In case of any trouble with DirectInput, you can download the deprecated "Microsoft DirectX SDK":
  http://www.microsoft.com/en-us/download/details.aspx?id=6812
In such case you will have to manually add paths to DirectX SDK to the property sheets.


== Compiling on Linux ==

You need GCC 5 or newer to build TDM on Linux.
Anything older than GCC 4.7 surely won't work.
Just as the original Doom 3, TDM is built using Scons build system.

Being in the source code root directory ("darkmod_src"), you can build TDM with a command like this:
  scons BUILD="release" TARGET_ARCH="x64" -j6 ..
If you omit some parameters, Scons will either use the previously defined values or the default ones.

Here is the explanation of parameters:
* BUILD="release": build release (i.e. optimized) executable
* TARGET_ARCH="x64": build for 64-bit platform (pass "x86" or "x32" for 32-bit build)
* -j6: run six instances of compiler in parallel for faster build (better specify the number of cores in your CPU)
* ..: put executables with debug information to "../darkmod" (scons cannot access parent directory without it)
Run "scons --help" for more information about arguments.

Note: by default the deploy-ready executables are put into the current directory (which is source code root directory).
They are stripped of debug information, so you won't be able to debug them.
If you need debug information, make sure to specify ".." argument: then debuggable executables will be put into "../darkmod".


=== Ubuntu 16.04: native ===

The best approach is to build binaries for the platform you have, i.e.: build 32-bit TDM on 32-bit OS, or 64-bit TDM on 64-bit OS.
Here is the list of packages you need to install (on a clean Ubuntu installation):

  sudo apt-get install scons                    //'scons' is currently not installed
  sudo apt-get install m4                       //'SCons Environment' object has no attribute 'M4'
  sudo apt-get install subversion               //svnversion: not found
  sudo apt-get install mesa-common-dev          //no such file: "Gl/gl.h"
  sudo apt-get install libxxf86vm-dev           //no such file: "X11/extensions/xf86vmode.h"
  sudo apt-get install libopenal-dev            //no such file: "AL/al.h"
  sudo apt-get install libxext-dev              //no such file: "X11/extensions/Xext.h"

Now run scons build with one of the commands:

  scons BUILD="release" TARGET_ARCH="x86" ..    //on 32-bit OS
  scons BUILD="release" TARGET_ARCH="x64" ..    //on 64-bit OS


=== Ubuntu 16.04: 32-bit version on 64-bit OS ===

If you have 64-bit Linux, you can also build and run 32-bit TDM.
Note that this approach is slightly more complicated.

You have to install the following packages in addition to the ones listed above:

  sudo apt-get install g++-multilib             //no such file: 'sys/cdefs.h'
  sudo apt-get install libx11-dev:i386          //cannot find "-lX11"
  sudo apt-get install libxxf86vm-dev:i386      //cannot find "-lXxf86vm"
  sudo apt-get install libopenal-dev:i386       //cannot find "-lopenal"
  sudo apt-get install libxext-dev:i386         //cannot find "-lXext"

Then run build as usual:

  scons BUILD="release" TARGET_ARCH="x86" ..

The 64-bit and 32-bit versions can be built independently on a single 64-bit Linux.


== Details ==

If you work with SVN, please make sure that "svnversion" command works properly in OS console.
In case of Windows, install TortoiseSVN with "command line client tools" included.
In case of Linux, it is included in "subversion" package.
If you build TDM yourself, run it, and then open TDM console, you should see the correct SVN revision number in the lower-right corner.
