https://wiki.unvanquished.net/api.php?action=feedcontributions&user=Gfx0&feedformat=atomUnvanquished - User contributions [en-gb]2024-03-29T04:43:45ZUser contributionsMediaWiki 1.25.3https://wiki.unvanquished.net/index.php?title=Compiling_the_source&diff=119Compiling the source2012-03-27T21:00:46Z<p>Gfx0: /* Windows */</p>
<hr />
<div>==Overview==<br />
<br />
==Mac OS X==<br />
<br />
The preferred way of building Unvanquished on Mac OS X is to use Apple's [https://developer.apple.com/xcode/ XCode] along with [http://www.cmake.org/cmake/resources/software.html CMake]; CMake is used to generate an XCode project file that is then used to compile the code. <!-- TODO: is it possible to build using gcc? --><br />
<br />
First, follow the instructions on [[Getting_the_source##Mac_OS_X_2|this page]] to acquire the source code.<br />
<br />
Next, perform the following:<br />
<br />
# Run CMake.<br />
# Enter the location of the source code.<br />
# Enter the location in which you would like to build the source code. This may be the same directory.<br />
# Click "Configure". You will be prompted as to which generator you would like to use. If you have Xcode installed, choose that.<br />
# Wait while the configuration process runs.<br />
# '''''TODO: explain which libraries will likely have to be set'''''<br />
# Click "Generate".<br />
# Close CMake and open Xcode.<br />
# Open the project file created by CMake, which should be in the build directory you specified.<br />
# Click the build button.<br />
<br />
==Windows==<br />
<br />
The preferred way of building Unvanquished on Windows is to use Microsoft Visual Studio 2010.<br />
The free Express version of the software works fine.<br />
<br />
Steps:<br />
# Open src/engine/Daemon.sln in Visual Studio 2010.<br />
# In the two text boxes in the toolbar, select "Release" in the first one and Win32 or Win64 in the second one<br />
# Press F5 to build solution and run application, or just use Build &rarr; Build Solution to compile the code.<br />
<br />
==Linux==<br />
<br />
===Dependencies===<br />
<br />
<!-- TODO: this may be incomplete --><br />
Debian/Ubuntu:<br />
<br />
$ sudo apt-get install libcurl4-gnutls-dev libfreetype6-dev libglew1.5-dev \<br />
libgmp-dev libjpeg8-dev libncurses5-dev libogg-dev libopenal-dev \<br />
libpng12-dev libsdl1.2-dev libvorbis-dev zlib1g-dev<br />
<br />
Gentoo:<br />
<br />
$ emerge curl freetype glew gmp jpeg ncurses libogg openal libpng libsdl libvorbis zlib<br />
<br />
===Configuring the code with CMake===<br />
<br />
After you have [[Getting the source|acquired the source code]], you can proceed to compile. Unvanquished uses CMake, so you must have that installed. <br />
<br />
====Using ccmake (curses-based front-end)====<br />
<br />
Debian/Ubuntu:<br />
<br />
$ sudo apt-get install cmake-curses-gui<br />
<br />
On Gentoo you should set the '''ncurses''' USE flag either globally or individually, just for cmake.<br />
To add the USE flag globally, edit the USE array in /etc/make.conf for it to include '''ncurses'''.<br />
To only install cmake with ncurses functionality, you could do the following:<br />
<br />
$ echo 'dev-util/cmake ncurses' >> /etc/portage/package.use && emerge cmake<br />
<br />
Note that in Ubuntu, <code>cmake-curses-gui</code> is in Universe, which you may have to enable with <code>software-properties-gtk</code>. Make sure to reload the software sources with <code>sudo apt-get update</code> afterwards.<br />
<br />
Next, configure the codebase.<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ mkdir build<br />
$ cd build<br />
$ ccmake ..<br />
<br />
Alternatively, you may want to build the engine in the same directory.<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ ccmake .<br />
<br />
Once in <code>ccmake</code>, use the following keys:<br />
<br />
* Press <span class="hotkey">c</span> to configure. If an error occurs during this phase, make note of it and press <span class="hotkey">e</span> to dismiss it.<br />
* Use the up and down arrow keys to navigate the compilation options.<br />
* Press <span class="hotkey">Enter</span> to enable or disable boolean options (i.e., on/off) or to edit textual options.<br />
** Press <span class="hotkey">Esc</span> when editing a textual option to cancel the change.<br />
<br />
Once you have finished the configuration process, press <span class="hotkey">C</span> again, then <span class="hotkey">G</span> to generate the makefile.<br />
<br />
====Using cmake-qt-gui (graphical front-end)====<br />
<br />
This graphical front end for cmake has its own package you must install:<br />
<br />
Debian/Ubuntu:<br />
<br />
$ sudo apt-get install cmake-qt-gui<br />
<br />
Gentoo (with the '''qt4''' USE flag enabled):<br />
<br />
$ emerge cmake<br />
<br />
Once installed, run with <code>cmake-gui</code>.<br />
<br />
[[Image:Cmake-qt-gui.png|thumb]]<br />
<br />
# Set the path where you have the source code downloaded.<br />
# Set the path where you would like to build the engine. This may be the same directory if you wish.<br />
# Click 'Configure'.<br />
# Click 'Generate'.<br />
<br />
====Unnecessary libraries====<br />
<br />
Regardless of which front-end to cmake you use, you may want to disable some libraries that are not strictly necessary:<br />
<br />
* <code>USE_WEBP</code> &mdash; Some maps use WebP to store their textures. Currently this should have little impact on gameplay but more maps will likely use this format in the future.<br />
* <code>USE_OPENAL</code> &mdash; If this is disabled, SDL is used instead for sound.<br />
* <code>USE_CODEC_VORBIS</code> &mdash; Disabling this will cause certain sound effects (those using the <code>.ogg</code> format) not to play. At present, this has only a minor impact on gameplay, but more and more sounds will likely use the format in the future.<br />
* <code>USE_CURSES</code> &mdash; Disabling this will cause the external (not in-game) console to not use curses; it will not be scrollable and will be similar to the console in the original Tremulous. This does in no way affect gameplay.<br />
<br />
===Compiling===<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ make -j4<br />
<br />
The <code>-j</code> switch to make allows you to speed up the compilation process by running it in multiple threads; set the number following this to the number of cores your processor(s) have.<br />
<br />
===Acquiring the Game Files===<br />
<br />
The game files are not in the Git repository, and must be downloaded separately.<br />
<br />
$ cd <var>path/to/Unvanquished</var><br />
$ cd main<br />
$ wget http://sourceforge.net/projects/unvanquished/files/Assets/pak0.pk3/download<br />
$ wget http://sourceforge.net/projects/unvanquished/files/Assets/pak1.pk3/download<br />
$ wget http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z/download<br />
<br />
You can also get the pak files in this way (requires curl):<br />
<br />
$ cd <var>path/to/Unvanquished</var><br />
$ ./download-pk3.sh main<br />
<br />
The maps archive file isn't strictly necessary: if you don't have a particular map, the game will normally download it for you.<br />
<br />
Now you can proceed to [[running the game]].</div>Gfx0