DarkRadiant - Compilation Guide: Difference between revisions

From The DarkMod Wiki
Jump to navigationJump to search
No edit summary
 
(94 intermediate revisions by 4 users not shown)
Line 1: Line 1:
= Compiling under Windows =
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
This should hopefully cover the steps to prepare your machine to be able to compile the DarkRadiant Editor from source.


== Needed Software ==
* Windows: ''Visual Studio 2022 Community Edition'' (higher editions also possible: Professional, Ultimate, ...)
You'll need to download these pieces of software (these are all free, you don't need to pay for anything):
* Linux: gcc/g++ (Automake)
* [http://tortoisesvn.tigris.org '''TortoiseSVN'''] for obtaining the sources
* Mac OS X: Automake (after installing XCode and using MacPorts)
* [http://www.mingw.org/download.shtml '''MinGW'''] the actual compiler
* [http://www.activestate.com/store/activepython/download '''ActivePython'''] to run scons (other Python releases should work as well)
* [http://www.scons.org/download.php '''scons'''] to run the compilation scripts
* [http://gladewin32.sourceforge.net/modules/news/ '''The GTK+ Framework'''] (choose the latest stable version)
* [http://downloads.sourceforge.net/gtkglext/gtkglext-win32-1.0.6.exe '''GtkGLExt - OpenGL Extension to GTK+''']
* [http://downloads.sourceforge.net/glew/glew-1.3.6-win32.zip '''GLEW - OpenGL Extension Wrangler''']
== Step 1: Install the Tools ==
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).


Second, install the compiler '''MinGW'''. Launch the setup and choose the package '''Current''', then be sure to check the box of the '''g++''' compiler. Choose '''Download and Install''' in the next steps and let setup do the rest.
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.


Third, install the '''ActivePython''' interpreter, which is needed to run the SconScript. Nothing spectacular here as well. After Python has been installed, run the '''scons''' installer (version 0.96.1 and 0.97 work for sure, don't know about others).
= Compilation Guides =
There are separate articles for Windows and Linux, select one to learn more:


Fourth, install '''GTK+''' plus '''GtkGLExt''' (be sure to remember where you installed the GtkGLExt package, we will need that path below.
* [[DarkRadiant - Compiling in Windows|Compiling in Windows / Visual Studio]]
* [[DarkRadiant - Compiling in Linux|Compiling in Linux]]
* [[DarkRadiant - Compiling in macOS|Compiling in macOS]] (experimental)


Last, open the '''glew-1.x.y-win32.zip''' archive (version number masked by x.y) and copy the glew32.dll from the ZIP and paste it into your C:\Windows\system32 folder, so that the system can find it. Something similar is required for the GLExt binaries (libgdkglext-win32-1.0-0.dll and libgtkglext-win32-1.0-0.dll). You'll find them in the bin\ folders of the GtkGLExt folder. Copy the two DLLs into your C:\Windows\system32 folder so that they're found. Reboot the machine.
Note: The articles are always referring to the latest revision of the source code, not to a specific release.


''(Note: It's not mandatory to copy the DLLs into your system32 folder. You can also copy them into the folder containing the compiled darkradiant.exe, but we're not that far at this point, that's why I recommend copying it into your system32 directory.)''
{{coding}}
 
{{darkradiant|sort=Compilation}}
=== Set the Path to the MinGW Compiler ===
If scons complains about gcc and g++ missing, you will have to add the path to the compiler to your PATH environment variable:
* Press '''Win-Break''' or right-click on "My Computer" and choose "Properties". Go to advanced and seek the button for the Environment Variables. I'm not sure if it's called like this, because I'm running a German version of WinXP, but the Window should be something like this:
 
[http://img117.imageshack.us/img117/8184/drenvironmenthh3.jpg http://img117.imageshack.us/img117/8184/drenvironmenthh3.th.jpg]
 
Look to the variable named "Path" in the lower part of the dialog and double click the property. A small window will pop-up containing the name and the value of the environment variable. You'll have to add the path to the '''MinGW\bin''' folder to the end of the long string:
;C:\MinGW\bin;
Be sure that a semicolon divides the newly added path from the previous ones, as I indicated above. A double semicolon won't hurt either, so if the above folder is matching to your installation, you can as well copy & paste it into that window. Close the dialogs by hitting OK, you're done with that. The next time you'll open a console the path should be functional. If not, please double-check your path for typos and/or post in the forums.
 
== Step 2: Obtain the Sources ==
The complete codebase is available at SourceForge. To check out the sources, open up Explorer and create the folder you want to store them.
 
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:
https://darkradiant.svn.sourceforge.net/svnroot/darkradiant/trunk/darkradiant/
Click OK and prepare for a few minutes of downloading, the trunk repository is some ten megs large.
 
[http://img256.imageshack.us/img256/6370/drcheckoutuj0.jpg http://img256.imageshack.us/img256/6370/drcheckoutuj0.th.jpg]
== Step 3: Compile the Sources ==
If you're finished downloading the sources, open up the console by pressing '''Win-R''' or click '''Start''' > '''Run...''', then type '''cmd''' and confirm.
Once the DOS box is there, head to the according source folder by typing
cd C:\DarkRadiant
or whatever your path is where you downloaded them. Now type:
scons BUILD="release"
and the sources should start to compile (in release mode).
 
It's likely that I forgot something here and you might get scons complaining about a missing compiler or something. In that case, please tell greebo to update this tutorial accordingly.
 
The time neede to compile DarkRadiant strongly depends on your CPU power and may take up to ten minutes for a release build (a debug build may take much longer for whatever reasons).
 
== Step 4: Run DarkRadiant ==
The readily compiled sources can be found in the '''install/''' folder beneath the DarkRadiant root (the folder you downloaded your sources to).
C:\DarkRadiant\install\darkradiant.exe
Just create a shortcut by dragging the exe somewhere to your desktop with right mouse button and choose to create a link there. There is also an icon file located in the same folder you can use for this link to make it looking more pleasant.
 
If you get an error during startup, please contact greebo, perhaps there is something missing in this tutorial.
 
= Compiling under Linux =
 
== Install Libraries and Tools ==
 
=== Ubuntu 7.04 ===
 
You'll need a bunch of packages to get DarkRadiant to compile without glitches. I can't remember all from the top of my head, I will try to complete this list during my next Linux setup, but don't hold your breath. These are the names as found in Ubuntu 7.04 (Feisty Fawn):
 
* g++-4.1
* gcc-4.1
* scons 0.96.93 (or higher)
* libboost-dev
* libboost-serialization-dev
* libboost-filesystem-dev
* libboost-regex-dev
* libglew-dev
* libgtk2.0-dev
* libglib2.0-dev (maybe installed with libgtk2.0-dev)
* libgtkglext1-dev
* libxml2-dev
* libopenal-dev
* libalut-dev
* libvorbis-dev
 
Always download all the dependencies as well. Python should already be installed by Ubuntu at least, other distributions might require to install it separately.
 
=== Ubuntu 7.10 T5 ===
* g++
* scons 0.97
* libboost-dev
* libboost-regex-dev
* libgtk2.0-dev
* libglew1.4-dev
* libgtkglext1-dev
* libxml2-dev
* libboost-serialization-dev
* libboost-filesystem-dev
* libalut-dev
* libvorbis-dev
 
Always download all the dependencies as well. Python should already be installed by Ubuntu at least, other distributions might require to install it separately.
 
== Obtain the source ==
 
Change to the directory where you want the source code to be in and then check the current version out of SVN with:
 
svn checkout https://darkradiant.svn.sourceforge.net/svnroot/darkradiant/trunk/darkradiant/ darkradiant
 
== Compile ==
 
Change to the source directory and use <code>scons</code> to create a release build:
 
cd darkradiant
scons BUILD="release"
 
The compilation can take quite a few minutes, depending on your system.
 
If you use <code>scons</code> without arguments, a debugging build will be created, which can take even longer.
 
= See also =
* [[DarkRadiant - Compilation Problems]]
* [[DarkRadiant Linux Issues]]
 
[[Category:Coding]]
[[Category:DarkRadiant]]

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.