DarkRadiant - Compilation Guide: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
Line 45: Line 45:
= Compiling =
= Compiling =
Once you've downloaded the sources, the steps for compiling DarkRadiant depend on your toolset/compiler. Choose one of the links below:
Once you've downloaded the sources, the steps for compiling DarkRadiant depend on your toolset/compiler. Choose one of the links below:
* [[DarkRadiant - Compiling in Visual C++ 2010|Compiling in Visual C++ 2010]]
* [[DarkRadiant - Compiling in Visual C++ 2008|Compiling in Visual C++ 2008]]
* [[DarkRadiant - Compiling in Visual C++ 2008|Compiling in Visual C++ 2008]]
* [[DarkRadiant - Compiling in Visual C++ 2005|<del>Compiling in Visual C++ 2005</del>]] (Note: the VC++ 2005 project files have been removed in favour of the VS 2008 ones)
* [[DarkRadiant - Compiling in Visual C++ 2005|<del>Compiling in Visual C++ 2005</del>]] (Note: the VC++ 2005 project files have been removed in favour of the VS 2008 ones)

Revision as of 18:55, 4 December 2010

Obtain the Sources

The complete codebase plus all win32 dependencies are available at SourceForge. To check out the sources, open up Explorer and create the folder you want to store them.

First, download and install TortoiseSVN. Nothing special here, just install it into any folder of your preference. After installation it probably will ask to reboot your machine, as Tortoise integrates into the Explorer shell. (You can do that later, when all the other components have been installed).

Right-click somewhere in the white space and choose SVN Checkout. A new dialog appears asing you for the repository URL and the checkout folder. You can copy and paste the URL from here into the dialog window and click ok:

https://darkradiant.svn.sourceforge.net/svnroot/darkradiant/trunk/darkradiant/

Check out the Dependencies (Win32)

For Windows builds, the dependencies must be checked out along with the sources. To keep the main source repository small, the dependencies are stored in a different folder next to the trunk:

https://darkradiant.svn.sourceforge.net/svnroot/darkradiant/trunk/w32deps/

To check them out in the correct folder, proceed like this: Go to the parent folder of the one you checked out the sources to. Given you checked them out in C:\DarkRadiant, go to the C:\ folder. Right-click somewhere in the white area of the explorer window and choose SVN > Checkout. (Note: it is necessary to right-click a folder which is not under version control, otherwise Tortoise won't provide the "Checkout" option). Make sure that the w32deps/ folder is created under the C:\DarkRadiant folder, like this:

The resulting folder structure should look like this. The w32deps/ folder must be in the same folder as the radiant/ or include/ folder.

C:\
C:\DarkRadiant
C:\DarkRadiant\include\
C:\DarkRadiant\libs\
C:\DarkRadiant\plugins\
C:\DarkRadiant\radiant\
C:\DarkRadiant\w32deps\    <<----- w32deps/ is next to the radiant/ folder

[optional] Check out the Dependencies (Win64)

Users aiming to build for the Windows x64 target need to check out one additional folder to retrieve the binaries needed during the compilation process. Important: you need to check out both the w32deps as well as the w64deps folder.

https://darkradiant.svn.sourceforge.net/svnroot/darkradiant/trunk/w64deps/

Go to the parent directory of the one you checked out the sources to, like described in the guide for checking out the w32deps. Given you checked them out in C:\DarkRadiant, go to the C:\ folder. Right-click somewhere in the white area of the explorer window and choose SVN > Checkout. (Note: it is necessary to right-click a folder which is not under version control, otherwise Tortoise won't provide the "Checkout" option). Make sure that the w64deps/ folder is created under the C:\DarkRadiant folder, like this:

The resulting folder structure should look like this. The w64deps/ folder must be in the same folder as the radiant/ or include/ folder, next to the w32deps/ one.

C:\DarkRadiant
C:\DarkRadiant\include\
C:\DarkRadiant\libs\
C:\DarkRadiant\..\
C:\DarkRadiant\radiant\
C:\DarkRadiant\w32deps\    <<----- w32deps/ is needed as well
C:\DarkRadiant\w64deps\    <<----- w64deps/ checked out at the same level as w32deps!

Compiling

Once you've downloaded the sources, the steps for compiling DarkRadiant depend on your toolset/compiler. Choose one of the links below:

How to compile the boost static libraries in Windows

Any VC++ compiler version other than the ones mentioned above will require a recompile of the boost static libraries which DarkRadiant links against. At the time of writing, DarkRadiant is using the following boost libraries:

  • boost.regex
  • boost.filesystem
  • boost.system
  • boost.python

To build these static libraries, boost provides the jam tool (bjam.exe), which can be used to build the statics for you. Go get the boost sources from their website (http://www.boost.org) and extract them into a new folder. Then get bjam (can also be downloaded from their website, but you can also build it from scratch)

Use DarkRadiant's build scripts

I prepared some batch files which do most of the dirty work for you. As prerequisite make sure that the path to bjam.exe is added to your PATH before invoking the scripts.

  • Open a console (Win-R ==> "cmd")
  • Change directories to the folder where you extracted the downloaded boost package to, e.g. c:\downloads\boost_1_42_0
  • Run the build scripts from there, e.g. c:\games\darkradiant\tools\scripts\build_boost_libs, assuming that the DarkRadiant SVN trunk has been checked out to c:\games\darkradiant.
  • Copy the files from the stage/ folder (which just popped up as a new Explorer window) to your w32deps/boost/libs folder.
  • [64 Bit Build]: Use the build_boost_libs.x64 batch file to build the x64 libraries, but beware that this will overwrite the current contents of the stage/ folder.

Build a boost library manually

Open a console (Win-R ==> "cmd" => Enter) and head to:

cd <YOUR BOOST FOLDER HERE>
cd libs
cd filesystem
cd build
path\to\bjam --toolset=msvc link=static release stage
path\to\bjam --toolset=msvc link=static debug stage

After these commands, the libboost_filesystem_vc*.lib files (both debug and release variants) are in the stage/ directory below your boost folder. You'll need to repeat the above steps and replace filesystem with the names of the other libraries regex and system.

Note for x64 users: Add the address-model=64 option to bjam in order to build static libs with the 64-bit compiler.

Now take the *.lib files from the stage/ folder and copy them into your w32deps/boost/lib folder (or the w64deps/boost/lib for Win64 targets) in your darkradiant directory and the linking should succeed.

See also