DarkRadiant - Compilation Guide: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
No edit summary
No edit summary
 
(37 intermediate revisions by 2 users not shown)
Line 1: Line 1:
DarkRadiant's codebase is open source. To compile the sources you can either use  
DarkRadiant's codebase is open source, the main part of the source code is hosted on github. To compile the sources you can either use  


* Windows: ''Visual Studio 2012 Express for Windows Desktop'' (or higher)
* Windows: ''Visual Studio 2022 Community Edition'' (higher editions also possible: Professional, Ultimate, ...)
* Windows: ''Visual C++ 2010 Express'' (or higher)
* Linux: gcc/g++ (Automake)
* Linux: gcc/g++.
* Mac OS X: Automake (after installing XCode and using MacPorts)


All compilers can be acquired for free and should be able to produce 32 Bit and 64 Bit builds.
All compilers can be acquired for free. In any case, since DarkRadiant is using part of the C++17 feature set, a compiler supporting the C++17 standard is required.


= Use Git =
= Compilation Guides =
The main codebase is stored and maintained on github<sup>[[#windeps_svn_note|[1]]]</sup>, you'll therefore need [http://code.google.com/p/msysgit/downloads/list?q=full+installer+official+git '''TortoiseGit'''] (or a similar Git client).
There are separate articles for Windows and Linux, select one to learn more:


Windows users: 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.
* [[DarkRadiant - Compiling in Windows|Compiling in Windows / Visual Studio]]
 
= Clone the Sources =
Windows users: To prepare the source download, open Windows Explorer and create the folder you want to clone (i.e. download) the sources into. Use your Git client to clone the DarkRadiant repository from github:
 
[[Image:Dr_clone_git.png|200px]]
 
Linux users: The git command line equivalent would be this:
 
git clone git://github.com/orbweaver/DarkRadiant.git
 
Cloning takes a minute or two - after the process is finished your folder should be looking like this:
 
[[Image:Dr_bare_repo.png|200px]]
 
Windows users: this is not yet enough to compile DarkRadiant in Windows, you still need to download and extract the dependencies, see the next step.
Linux people: proceed directly to the [[DarkRadiant - Compiling in Linux|Linux compilation article]].
 
== Windows: Download the Dependencies ==
For Windows builds additional dependencies must be downloaded and copied into the source tree. To keep the github source repository small, the dependencies can be downloaded as 7-zipped packages (you can [http://www.7-zip.org get 7-zip here]):
 
https://github.com/downloads/orbweaver/DarkRadiant/w32deps.7z
https://github.com/downloads/orbweaver/DarkRadiant/w64deps.7z (needed for x64 builds)
 
If you're in Windows 7 x64 (or any higher 64 bit Windows version) you need to download both packages. Download and extract them directly to the directory you cloned the sources to. The resulting folder structure should look like this.
 
[[Image:Dr_windeps_repo.png|200px]]
 
'''Important:''' The w32deps/ (or w64deps/) folder must be in the same folder as the radiant/ or include/ folder.
 
= Compilation =
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++ 2012|Compiling in Visual C++ 2012]]
* [[DarkRadiant - Compiling in Visual C++ 2010|Compiling in Visual C++ 2010]]
* [[DarkRadiant - Compiling in Linux|Compiling in Linux]]
* [[DarkRadiant - Compiling in Linux|Compiling in Linux]]
* [[DarkRadiant - Compiling in macOS|Compiling in macOS]] (experimental)


= Advanced Users: Compiling the Windows Dependencies =
Note: The articles are always referring to the latest revision of the source code, not to a specific release.
 
== Boost static libraries ==
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 <tt>bjam.exe</tt> 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. <tt>c:\games\darkradiant\tools\scripts\build_boost_libs</tt>, 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 <tt>w32deps/boost/libs</tt> folder.
* [64 Bit Build]: Use the <tt>build_boost_libs.x64</tt> 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 ===
See main article: [[Compile the static Boost Libraries in Windows]]
 
The *.lib files from the stage/ folder should be copied into your '''w32deps/boost/lib''' folder (or the '''w64deps/boost/lib''' for Win64 targets) in your darkradiant directory and the linking should succeed.
 
== Compile the GTK+ toolchain et al ==
DarkRadiant is using a lot of third-party libraries like GTK+, gtkmm, libxml2, libiconv, gtkglext, 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 <tt>trunk/winbuild</tt> branch in SVN. The winbuild folder contains all the sources needed to build the Win32/Win64 dependency binaries, including gtkmm et al., gtkglextmm and gtksourceviewmm. Note that the headers are stored in w32deps, as the main DarkRadiant project needs them there, so w32deps is the place to look for most of the shared headers.
 
There are VC++ project files in each of the subdirectories (e.g. MSVC_Net2010), which work best when the winbuild folder is checked out as subfolder to the trunk/darkradiant working copy, next to your w32deps/w64deps directories, as indicated above. To check out the winbuild folder:
 
# Right-click your C:\Games folder >> SVN Checkout...
# Select https://darkradiant.svn.sourceforge.net/svnroot/darkradiant/trunk/winbuild to C:\Games\DarkRadiant\winbuild
 
The folder structure should then look like this:
 
C:\Games\DarkRadiant
C:\Games\DarkRadiant\w32deps
C:\Games\DarkRadiant\w64deps [optional for x64 builds]
C:\Games\DarkRadiant\winbuild
 
This way, the VC++ projects place their binaries in the correct location in the w32deps/w64deps folder and you can compile DarkRadiant right off the bat.
 
== Compile Scripts (VC++ 2010) ==
 
For VC++ 2010 you can use the shell script in the winbuild folder. Open a VC++ 2010 Command Prompt and head to the winbuild directory, then call the batch file corresponding to your compiler version.
 
* build_all.x86.cmd => Compiles all 32 bit gtkmm libraries, including gtksourceviewmm and gtkglextmm (Debug & Release versions).
* build_all.x64.cmd => Compiles all 64 bit gtkmm libraries, including gtksourceviewmm and gtkglextmm (Debug & Release versions).
* build_c_libs.x86.cmd => Compiles all 32 bit C-libraries like win_iconv, libxml2, gtkglext and gtksourceview (Debug & Release versions).
* build_c_libs.x64.cmd => Compiles all 64 bit C-libraries like win_iconv, libxml2, gtkglext and gtksourceview (Debug & Release versions).
 
The 32 bit shell scripts will place the *.lib files directly into your w32deps folder, the 64 bit ones put their files into w64deps.
 
== 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 w32deps/w64deps dependencies are concerned, I've zipped up all the .pdb files and stored them on the FTP:
 
* VC++ 2012 - x86: http://www.dramthethief.com/darkmod/files/darkradiant/w32deps.pdbs.msvc2012.7z
* VC++ 2012 - x64:  http://www.dramthethief.com/darkmod/files/darkradiant/w64deps.pdbs.msvc2012.7z
 
== Notes ==
#  <span id="windeps_svn_note">The win32 and win64 dependencies are maintained in SVN at SourceForge, but you won't need to check out those unless you're a Windows developer and want to work on the Windows dependencies. If anything substantial changes within these they are zipped and uploaded to [https://github.com/orbweaver/DarkRadiant/downloads github's download area]. Linux folks don't need these at all.</span>
# This is the original guide I was modeling the winbuild VC++ projects after: https://live.gnome.org/GTK+/Win32/MSVCCompilationOfGTKStack#Now.2C_onto_the_GTK.2B-_stack.21 Since I implemened the VC++ 2010 solution some modules of the GTK+ stack have made some advances towards Visual Studio 2010 support, but you still have to search for the puzzle pieces on your own.


{{coding}}
{{coding}}
{{darkradiant|sort=Compilation}}
{{darkradiant|sort=Compilation}}

Latest revision as of 19:34, 1 April 2022

DarkRadiant's codebase is open source, the main part of the source code is hosted on github. To compile the sources you can either use

  • Windows: Visual Studio 2022 Community Edition (higher editions also possible: Professional, Ultimate, ...)
  • Linux: gcc/g++ (Automake)
  • Mac OS X: Automake (after installing XCode and using MacPorts)

All compilers can be acquired for free. In any case, since DarkRadiant is using part of the C++17 feature set, a compiler supporting the C++17 standard is required.

Compilation Guides

There are separate articles for Windows and Linux, select one to learn more:

Note: The articles are always referring to the latest revision of the source code, not to a specific release.