https://wiki.unvanquished.net/api.php?action=feedcontributions&user=Velociostrich&feedformat=atomUnvanquished - User contributions [en-gb]2024-03-28T12:54:55ZUser contributionsMediaWiki 1.25.3https://wiki.unvanquished.net/index.php?title=User_talk:Veyrdite&diff=2318User talk:Veyrdite2013-12-01T15:19:01Z<p>Velociostrich: /* Some things */ new section</p>
<hr />
<div>== Some things ==<br />
<br />
Hi there! I'm velociostrich, the one who used to do most of the wiki editing. I also used to be the art lead for a period of time, and did some other things. Anyway, I'm glad to see that someone is taking care of the wiki now, although I have a few suggestions:<br />
<br />
<ul><br />
<li>Use em dashes (&amp;mdash;) in sentences instead of '--'; for example, like&mdash;this.</li><br />
<li>Try very hard to avoid putting your name on any page. Don't use "I" or anything like that, either. I've noticed on other wikis that this tends to associate an individuals' identity with a given page, and seems to either slow or completely stall contribution by others. (You'll notice that I haven't put my name anywhere as far as I remember. The compiling page has been a shining example of contributions from a ton of people, probably partially thanks to this.)</li><br />
<li>Please keep a separation between dull reference and guidance pages. I see you've started to work on rewriting the mapping page, and that's fine, but I think it would be better to leave one page as the big, ugly, exhaustive "here's everything to know about everything" page, and another page that's a "want to make a map? new to this stuff? here's what to do" type of a thing. (The writing style can vary between the two).</li><br />
<li>Take advantage of subpages; we've enabled that in the wiki, and it makes organization a lot easier. So you could have like a main "Tutorials" page, with subpages like this:<br />
<pre><br />
Tutorials<br />
Tutorials/Mapping<br />
Tutorials/Mapping/Your First Map<br />
Tutorials/Mapping/Your First Map/Step 1: Make a box<br />
...<br />
Tutorials/Modeling<br />
</pre><br />
This also keeps the list of pages less of a mess and makes page titles look neater. For pages that you're working on yourself, name them like "User:Veyrdite/Main_Page" (without any modification to the actual page title). This is pretty much standard operating procedure on some wikis like the Blender wiki, and for good reason (it just makes sense).<br />
</li><br />
</ul><br />
<br />
Also, I saw that you changed the main page to not use the CurrentVersion template. Now that you're an admin, you should be able to edit it. Please do that from now on, as that template affects many other pages as well (the pages that document getting the source code and downloading files manually use that template, for example, and it is important that it stays up to date for users who don't have the savvy to realize that the commands are wrong).<br />
<br />
One last thing, I saw you removed my name from the Developers page. That's fine because I'm not active anymore (and do not plan on being active again for the foreseeable future), but I think myself and other past developers would appreciate if there were a "Past Developers" table, just as something to point to to say, "hey, I worked on that, see?" (There is something like that on the main Unvanquished credits page, but keeping something separate on the wiki would be easier and would allow past contributors who may have been missed but don't feel like talking to someone to add their names in there).<br />
<br />
One more last thing, I changed the protection level of the main page back. You can still edit it, I just think it should stay protected. (Especially in the event that we somehow get hit hard by spam again, which we have been in the past).<br />
<br />
&mdash;[[User:Velociostrich|Velociostrich]] ([[User talk:Velociostrich|talk]]) 09:19, 1 December 2013 (CST)</div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Main_Page&diff=2317Main Page2013-12-01T15:17:24Z<p>Velociostrich: Protected "Main Page": High traffic page: Make a user who wants to edit an admin, or have them make changes to a page under their name and merge the changes yourself. ([edit=sysop] (indefinite) [move=sysop] (indefinite))</p>
<hr />
<div><!-- Please see http://www.mediawiki.org/wiki/Help:Magic_words for information on what these do. --><br />
__NOTOC__<br />
<br />
<h1 style="text-align:center;margin:0px 0px 30px 0px;border-bottom-style:none;">Welcome to the Unvanquished Wiki!</h1><br />
<br />
<table style="width:100%" cellspacing="0" cellpadding="0"><br />
<tr><br />
<td colspan="2"><br />
<div class="mainPageLinkBox" style="margin-bottom: 10px;"><br />
<br />
<h2>What is Unvanquished?</h2><br />
<br />
Unvanquished is a free and open-source first-person shooter and strategy game created by [[Developers|Unvanquished Development]]. Players fight online in team based combat in a war of [[aliens]] against [[humans]]. The game is available for most major platforms (Linux, Mac and Windows). Support for other platforms (e.g., BSD) is partially completed but not officially supported.<br />
<br />
While the humans are equipped with conventional weapons&mdash;ranging from the standard-issue [[Rifle|rifle]] to the powerful [[Lucifer Cannon]]&mdash;the aliens fight with pincers, mandibles, electrical, and projectile attacks. The game has a high emphasis on team-play: lone players are easy pickings for an opposing team who travels in groups. RTS-like strategy comes into play in the form of base-building: each map has a default base for both teams, but players are free to expand or move however they please. Similarly, a team wins by destroying the opposing team's spawn points and killing any remaining members of that team before they are able to rebuild.<br />
<br />
While Unvanquished traces its roots to [http://tremulous.net Tremulous], it is under very active development and is quickly becoming a very different game. We aim to provide a transparent development process that is open to the community, and make a new release every month. We use the [[Engine features|Daemon engine]] which provides a host of new features over Tremulous' engine.<br />
<br />
===Is it done?===<br />
<br />
Nope, we're still in alpha! However, alpha releases are public and you can download the latest release right now! Upstream development is typically very stable as are the monthly alpha releases. Each release brings new artwork and new features, as well as new gameplay elements.<br />
<br />
</div><br />
</td><br />
</tr><br />
<tr><br />
<td colspan="2"><br />
<div class="mainPageLinkBox" style="margin-bottom: 10px;"><br />
<br />
==Contributors==<br />
<br />
There are a number of ways you can help. If you would like to contribute to the project, contact a [[Developers|team member]] on the [http://unvanquished.net/forum/ forums] or on [[IRC]]. We have two channels, [irc://freenode.net/#unvanquished #unvanquished] and [irc://freenode.net/#unvanquished-dev #unvanquished-dev] on [http://freenode.net// Freenode]. The former is for general discussion, while the latter is strictly for development-related discussion, so while members of the public are welcome at either, please keep the discussion on #unvanquished-dev on topic.<br />
<br />
If you do not have an IRC client, you can use the [http://webchat.freenode.net/?channels=unvanquished web chat] directly in your browser.<br />
<br />
Newly recruited artists, please read [[Contributing/Artists|these guidelines]].<br />
<br />
</div><br />
</td><br />
</tr><br />
<tr><br />
<td width="50%" style="vertical-align: top;"><br />
<!--<br />
#####################################################################<br />
# PLAYERS #<br />
#####################################################################<br />
--><br />
<div class="mainPageLinkBox"><br />
<br />
==Players==<br />
<!-- If you would like to update the release information, please edit Template:CurrentVersion. --><br />
<br />
The current release is {{CurrentVersion|FullName}} ({{CurrentVersion|Version}}), released {{CurrentVersion|Date}}.<br />
<br />
You can read about [{{CurrentVersion|BlogPost}} this release on the official blog].<br />
<br />
{| style="width:100%"<br />
|-<br />
| class="top" |<br />
<span class="h3">Getting the Game</span><br />
<br />
* [[Downloading & Installing|Installation instructions]]<br />
* [http://sourceforge.net/projects/unvanquished/files/ All downloads]<br />
* [http://sourceforge.net/projects/unvanquished/files/Assets/ Maps & Game Data]<br />
<br />
<span class="h4">Compiling</span><br />
<br />
* [[Getting the source]]<br />
* [[Development environments]]<br />
* [[Compiling the source]]<br />
<br />
<span class="h4">Windows</span><br />
<br />
* [http://sourceforge.net/projects/unvanquished/files/Windows/ Official Installer]<br />
<br />
<span class="h4">Mac OS X</span><br />
<br />
* [http://sourceforge.net/projects/unvanquished/files/Mac%20OS%20X/ Official Installer]<br />
<br />
<span class="h4">Linux</span><br />
<br />
* [http://sourceforge.net/projects/unvanquished/files/Linux/ (''Official'') All platforms]<br />
* [http://www.unvanquished.net/download#debian (''Official'') Debian & Ubuntu]<br />
* [https://aur.archlinux.org/packages.php?ID=61163 (''Semi-official'') Arch Linux]<br />
<br />
| class="top" |<br />
<span class="h3">Lore</span><br />
<br />
* [[Aliens]]<br />
* [[Humans]]<br />
<br />
<span class="h3">Playing the Game</span><br />
<br />
* [[Running the game]]<br />
** Requirements<br />
** Run-time options<br />
* [[LocalGames|Playing offline with bots]]<br />
* [[Troubleshooting]]<br />
* [[Glossary]]<br />
<br />
<span class="h3">Get Competitive</span><br />
<br />
* [http://www.unvanquished.net/stats/NA1/ Gameplay stats]<br />
* [[Creating custom keybinds|Create custom keybinds]]<br />
** [[Running_the_game#Advanced_options|Advanced game options]]<br />
** [[New Cvars]]<br />
** [[Renderer Status|Renderer Cvars]]<br />
<br />
<span class="h3">Server Administration</span><br />
<br />
* [[Running a server]]<br />
|-<br />
|}<br />
</div><br />
<!--<br />
#####################################################################<br />
# ARTISTS #<br />
#####################################################################<br />
--><br />
<div class="mainPageLinkBox"><br />
<br />
==Artists==<br />
{| style="width:100%"<br />
|-<br />
| class="top" |<br />
<span class="h3">Overview</span><br />
<br />
* [[Tech overview]]<br />
* [[Tools]]<br />
<br />
<span class="h3">Texture Artists</span><br />
<br />
* [[UI Design]]<br />
* [[Texture creation]]<br />
<br />
<span class="h3">Audio Engineers</span><br />
<br />
* [[Music and sounds]] ([[Sound_Progress|Progress]])<br />
<br />
| class="top" |<br />
<br />
<span class="h3">Modelers</span><br />
<br />
* [[Modeling]] ([[Modeling_progress|Progress]])<br />
<br />
<span class="h3">Mappers</span><br />
<br />
* [[Mapping]]<br />
* [[Particle effects]]<br />
|-<br />
|}<br />
</div><br />
</td><br />
<td width="50%" style="vertical-align: top;"><br />
<!--<br />
#####################################################################<br />
# META-PROJECT #<br />
#####################################################################<br />
--><br />
<div class="mainPageLinkBox"><br />
==Meta Project==<br />
{| style="width:100%"<br />
|-<br />
| class="top" |<br />
<span class="h3">Discuss</span><br />
<br />
* [http://unvanquished.net/forum/ Forums]<br />
* [[IRC]]<br />
<br />
<span class="h3">Quality Assurance</span><br />
<br />
* [[Testing]]<br />
* [[Bug reporting]]<br />
<br />
<span class="h3">Documentation & Translation</span><br />
<br />
* [[Wiki Project Task List]]<br />
** [[Wiki Editing Guidelines]]<br />
** [[:Category:OutOfDate|Out of date pages]]<br />
* [http://unvanquished.net/translate Translations]<br />
<br />
<span class="h3">Around the Web</span><br />
<br />
* [http://www.moddb.com/games/unvanquished ModDB page]<br />
* [http://www.lgdb.org/game/unvanquished Linux Game Database page]<br />
<br />
* [http://macgamescout.org/tremz-unvanquished/ Macgamescout page]<br />
<br />
| class="top" |<br />
<span class="h3">Project Status</span><br />
<br />
* [[Developers]]<br />
* [[Sound_Progress|Sound Project Progress]]<br />
* [[Modeling_progress|Modeling Project Progress]]<br />
<br />
<span class="h3">Design</span><br />
<br />
Communicate via the [http://unvanquished.net/forum/ Forums] and [[IRC]]<br />
* [[Design Document]]<br />
* [[Feature Proposals]]<br />
* [http://unvanquished.net/ideas/ideatorrent Project IdeaTorrent]<br />
<br />
<span class="h3">Development News</span><br />
<br />
* [http://www.unvanquished.net/news Development Blog]<br />
* [https://picasaweb.google.com/104009985595164250961 Development screenshots]<br />
|}<br />
</div><br />
<!--<br />
#####################################################################<br />
# PROGRAMMERS #<br />
#####################################################################<br />
--><br />
<div class="mainPageLinkBox"><br />
<br />
==Programmers==<br />
<br />
<span class="h3">Getting Started</span><br />
<br />
* [[Getting the source]]<br />
** [https://github.com/Unvanquished/Unvanquished Game/engine source] ([https://github.com/Unvanquished/Unvanquished/issues bug tracker])<br />
** [https://github.com/Unvanquished/Osavul Osavul server browser source] ([https://github.com/Unvanquished/Osavul/issues bug tracker])<br />
** [https://github.com/Unvanquished/unvanquished-master Master server source] ([https://github.com/Unvanquished/unvanquished-master/issues bug tracker])<br />
** [https://github.com/harmonise/BitRock Installer source] ([https://github.com/harmonise/BitRock/issues bug tracker])<br />
** [[Tools/Chameleon|Chameleon]] [https://github.com/Unvanquished/Chameleon source]<br />
** [[Tools/Archipelago|Archipelago]] [https://github.com/velociostrich/remapper source] ([https://github.com/velociostrich/remapper/issues bug tracker])<br />
* [[Development environments]]<br />
* [[Compiling the source]]<br />
<br />
{| style="width:100%"<br />
|-<br />
| class="top" |<br />
<span class="h3">Documentation</span><br />
<br />
* [[Engine features]]<br />
** [[Feature Proposals]]<br />
* [[Technical Documentation]]<br />
* [[Renderer Status]]<br />
* [[UI Implementation]]<br />
<br />
| class="top" |<br />
<br />
<span class="h3">Contributing</span><br />
<br />
* [[Coding convention]]<br />
* [[Contributing/Code|Contributing code]]<br />
* [[Contributor Quickies]]<br />
* [[Programming Task List]]<br />
|-<br />
|}<br />
</div><br />
</td><br />
</tr><br />
</table></div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Main_Page&diff=2316Main Page2013-12-01T15:02:35Z<p>Velociostrich: Revert main page to use the {{CurrentVersion}} template.</p>
<hr />
<div><!-- Please see http://www.mediawiki.org/wiki/Help:Magic_words for information on what these do. --><br />
__NOTOC__<br />
<br />
<h1 style="text-align:center;margin:0px 0px 30px 0px;border-bottom-style:none;">Welcome to the Unvanquished Wiki!</h1><br />
<br />
<table style="width:100%" cellspacing="0" cellpadding="0"><br />
<tr><br />
<td colspan="2"><br />
<div class="mainPageLinkBox" style="margin-bottom: 10px;"><br />
<br />
<h2>What is Unvanquished?</h2><br />
<br />
Unvanquished is a free and open-source first-person shooter and strategy game created by [[Developers|Unvanquished Development]]. Players fight online in team based combat in a war of [[aliens]] against [[humans]]. The game is available for most major platforms (Linux, Mac and Windows). Support for other platforms (e.g., BSD) is partially completed but not officially supported.<br />
<br />
While the humans are equipped with conventional weapons&mdash;ranging from the standard-issue [[Rifle|rifle]] to the powerful [[Lucifer Cannon]]&mdash;the aliens fight with pincers, mandibles, electrical, and projectile attacks. The game has a high emphasis on team-play: lone players are easy pickings for an opposing team who travels in groups. RTS-like strategy comes into play in the form of base-building: each map has a default base for both teams, but players are free to expand or move however they please. Similarly, a team wins by destroying the opposing team's spawn points and killing any remaining members of that team before they are able to rebuild.<br />
<br />
While Unvanquished traces its roots to [http://tremulous.net Tremulous], it is under very active development and is quickly becoming a very different game. We aim to provide a transparent development process that is open to the community, and make a new release every month. We use the [[Engine features|Daemon engine]] which provides a host of new features over Tremulous' engine.<br />
<br />
===Is it done?===<br />
<br />
Nope, we're still in alpha! However, alpha releases are public and you can download the latest release right now! Upstream development is typically very stable as are the monthly alpha releases. Each release brings new artwork and new features, as well as new gameplay elements.<br />
<br />
</div><br />
</td><br />
</tr><br />
<tr><br />
<td colspan="2"><br />
<div class="mainPageLinkBox" style="margin-bottom: 10px;"><br />
<br />
==Contributors==<br />
<br />
There are a number of ways you can help. If you would like to contribute to the project, contact a [[Developers|team member]] on the [http://unvanquished.net/forum/ forums] or on [[IRC]]. We have two channels, [irc://freenode.net/#unvanquished #unvanquished] and [irc://freenode.net/#unvanquished-dev #unvanquished-dev] on [http://freenode.net// Freenode]. The former is for general discussion, while the latter is strictly for development-related discussion, so while members of the public are welcome at either, please keep the discussion on #unvanquished-dev on topic.<br />
<br />
If you do not have an IRC client, you can use the [http://webchat.freenode.net/?channels=unvanquished web chat] directly in your browser.<br />
<br />
Newly recruited artists, please read [[Contributing/Artists|these guidelines]].<br />
<br />
</div><br />
</td><br />
</tr><br />
<tr><br />
<td width="50%" style="vertical-align: top;"><br />
<!--<br />
#####################################################################<br />
# PLAYERS #<br />
#####################################################################<br />
--><br />
<div class="mainPageLinkBox"><br />
<br />
==Players==<br />
<!-- If you would like to update the release information, please edit Template:CurrentVersion. --><br />
<br />
The current release is {{CurrentVersion|FullName}} ({{CurrentVersion|Version}}), released {{CurrentVersion|Date}}.<br />
<br />
You can read about [{{CurrentVersion|BlogPost}} this release on the official blog].<br />
<br />
{| style="width:100%"<br />
|-<br />
| class="top" |<br />
<span class="h3">Getting the Game</span><br />
<br />
* [[Downloading & Installing|Installation instructions]]<br />
* [http://sourceforge.net/projects/unvanquished/files/ All downloads]<br />
* [http://sourceforge.net/projects/unvanquished/files/Assets/ Maps & Game Data]<br />
<br />
<span class="h4">Compiling</span><br />
<br />
* [[Getting the source]]<br />
* [[Development environments]]<br />
* [[Compiling the source]]<br />
<br />
<span class="h4">Windows</span><br />
<br />
* [http://sourceforge.net/projects/unvanquished/files/Windows/ Official Installer]<br />
<br />
<span class="h4">Mac OS X</span><br />
<br />
* [http://sourceforge.net/projects/unvanquished/files/Mac%20OS%20X/ Official Installer]<br />
<br />
<span class="h4">Linux</span><br />
<br />
* [http://sourceforge.net/projects/unvanquished/files/Linux/ (''Official'') All platforms]<br />
* [http://www.unvanquished.net/download#debian (''Official'') Debian & Ubuntu]<br />
* [https://aur.archlinux.org/packages.php?ID=61163 (''Semi-official'') Arch Linux]<br />
<br />
| class="top" |<br />
<span class="h3">Lore</span><br />
<br />
* [[Aliens]]<br />
* [[Humans]]<br />
<br />
<span class="h3">Playing the Game</span><br />
<br />
* [[Running the game]]<br />
** Requirements<br />
** Run-time options<br />
* [[LocalGames|Playing offline with bots]]<br />
* [[Troubleshooting]]<br />
* [[Glossary]]<br />
<br />
<span class="h3">Get Competitive</span><br />
<br />
* [http://www.unvanquished.net/stats/NA1/ Gameplay stats]<br />
* [[Creating custom keybinds|Create custom keybinds]]<br />
** [[Running_the_game#Advanced_options|Advanced game options]]<br />
** [[New Cvars]]<br />
** [[Renderer Status|Renderer Cvars]]<br />
<br />
<span class="h3">Server Administration</span><br />
<br />
* [[Running a server]]<br />
|-<br />
|}<br />
</div><br />
<!--<br />
#####################################################################<br />
# ARTISTS #<br />
#####################################################################<br />
--><br />
<div class="mainPageLinkBox"><br />
<br />
==Artists==<br />
{| style="width:100%"<br />
|-<br />
| class="top" |<br />
<span class="h3">Overview</span><br />
<br />
* [[Tech overview]]<br />
* [[Tools]]<br />
<br />
<span class="h3">Texture Artists</span><br />
<br />
* [[UI Design]]<br />
* [[Texture creation]]<br />
<br />
<span class="h3">Audio Engineers</span><br />
<br />
* [[Music and sounds]] ([[Sound_Progress|Progress]])<br />
<br />
| class="top" |<br />
<br />
<span class="h3">Modelers</span><br />
<br />
* [[Modeling]] ([[Modeling_progress|Progress]])<br />
<br />
<span class="h3">Mappers</span><br />
<br />
* [[Mapping]]<br />
* [[Particle effects]]<br />
|-<br />
|}<br />
</div><br />
</td><br />
<td width="50%" style="vertical-align: top;"><br />
<!--<br />
#####################################################################<br />
# META-PROJECT #<br />
#####################################################################<br />
--><br />
<div class="mainPageLinkBox"><br />
==Meta Project==<br />
{| style="width:100%"<br />
|-<br />
| class="top" |<br />
<span class="h3">Discuss</span><br />
<br />
* [http://unvanquished.net/forum/ Forums]<br />
* [[IRC]]<br />
<br />
<span class="h3">Quality Assurance</span><br />
<br />
* [[Testing]]<br />
* [[Bug reporting]]<br />
<br />
<span class="h3">Documentation & Translation</span><br />
<br />
* [[Wiki Project Task List]]<br />
** [[Wiki Editing Guidelines]]<br />
** [[:Category:OutOfDate|Out of date pages]]<br />
* [http://unvanquished.net/translate Translations]<br />
<br />
<span class="h3">Around the Web</span><br />
<br />
* [http://www.moddb.com/games/unvanquished ModDB page]<br />
* [http://www.lgdb.org/game/unvanquished Linux Game Database page]<br />
<br />
* [http://macgamescout.org/tremz-unvanquished/ Macgamescout page]<br />
<br />
| class="top" |<br />
<span class="h3">Project Status</span><br />
<br />
* [[Developers]]<br />
* [[Sound_Progress|Sound Project Progress]]<br />
* [[Modeling_progress|Modeling Project Progress]]<br />
<br />
<span class="h3">Design</span><br />
<br />
Communicate via the [http://unvanquished.net/forum/ Forums] and [[IRC]]<br />
* [[Design Document]]<br />
* [[Feature Proposals]]<br />
* [http://unvanquished.net/ideas/ideatorrent Project IdeaTorrent]<br />
<br />
<span class="h3">Development News</span><br />
<br />
* [http://www.unvanquished.net/news Development Blog]<br />
* [https://picasaweb.google.com/104009985595164250961 Development screenshots]<br />
|}<br />
</div><br />
<!--<br />
#####################################################################<br />
# PROGRAMMERS #<br />
#####################################################################<br />
--><br />
<div class="mainPageLinkBox"><br />
<br />
==Programmers==<br />
<br />
<span class="h3">Getting Started</span><br />
<br />
* [[Getting the source]]<br />
** [https://github.com/Unvanquished/Unvanquished Game/engine source] ([https://github.com/Unvanquished/Unvanquished/issues bug tracker])<br />
** [https://github.com/Unvanquished/Osavul Osavul server browser source] ([https://github.com/Unvanquished/Osavul/issues bug tracker])<br />
** [https://github.com/Unvanquished/unvanquished-master Master server source] ([https://github.com/Unvanquished/unvanquished-master/issues bug tracker])<br />
** [https://github.com/harmonise/BitRock Installer source] ([https://github.com/harmonise/BitRock/issues bug tracker])<br />
** [[Tools/Chameleon|Chameleon]] [https://github.com/Unvanquished/Chameleon source]<br />
** [[Tools/Archipelago|Archipelago]] [https://github.com/velociostrich/remapper source] ([https://github.com/velociostrich/remapper/issues bug tracker])<br />
* [[Development environments]]<br />
* [[Compiling the source]]<br />
<br />
{| style="width:100%"<br />
|-<br />
| class="top" |<br />
<span class="h3">Documentation</span><br />
<br />
* [[Engine features]]<br />
** [[Feature Proposals]]<br />
* [[Technical Documentation]]<br />
* [[Renderer Status]]<br />
* [[UI Implementation]]<br />
<br />
| class="top" |<br />
<br />
<span class="h3">Contributing</span><br />
<br />
* [[Coding convention]]<br />
* [[Contributing/Code|Contributing code]]<br />
* [[Contributor Quickies]]<br />
* [[Programming Task List]]<br />
|-<br />
|}<br />
</div><br />
</td><br />
</tr><br />
</table></div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Template:Current&diff=2315Template:Current2013-12-01T15:02:15Z<p>Velociostrich: Update current version.</p>
<hr />
<div><includeonly>{{#switch: {{{1}}}<br />
| BlogPost = http://unvanquished.net/news/85-alpha-21-time<br />
| Date = November 4<sup>th</sup><br />
| FullName = Alpha 21<br />
| MD5HashFile = md5sums0.21<br />
| Number = 21<br />
| PakFiles = pak{{lcb}}{0..9},{A..J},K.{1,2}{{rcb}}.pk3<br />
| Tag = v0.21.0<br />
| Type = Alpha<br />
| Version = v0.21.0<br />
| VMPk3 = vms-0.21.0.pk3<br />
}}</includeonly><noinclude><br />
{{Documentation}}<br />
</noinclude></div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Template:Current&diff=2101Template:Current2013-07-22T02:58:27Z<p>Velociostrich: Ain't nobody got time for this?</p>
<hr />
<div><includeonly>{{#switch: {{{1}}}<br />
| BlogPost = http://unvanquished.net/news/64-alpha-17-is-ready<br />
| Date = July 7<sup>th</sup><br />
| FullName = Alpha 17<br />
| MD5HashFile = md5sums0.17<br />
| Number = 17<br />
| PakFiles = pak{{lcb}}{0..9},{A..G}{{rcb}}.pk3<br />
| Tag = v0.17.0<br />
| Type = Alpha<br />
| Version = v0.17.0<br />
| VMPk3 = vms-0.17.0.pk3<br />
}}</includeonly><noinclude><br />
{{Documentation}}<br />
</noinclude></div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Contributing&diff=2065Contributing2013-05-31T02:47:43Z<p>Velociostrich: Initial edit.</p>
<hr />
<div>==I am skilled at ______. What do I need to know?==<br />
<br />
There are separate pages for guidelines for the following:<br />
<br />
* {{Subpage|Code}}<br />
* {{Subpage|Artists}}<br />
<br />
==How does the project work?==<br />
<br />
Unvanquished is developed by individuals around the world over the internet. Individuals involved with the project can be divided into a few different categories:<br />
<br />
<!-- Note to editors: Please do not add names to this page so that we do not have to constantly keep it updated as well as the credits page. The credits page can serve as a reference for who's who. --><br />
<ul> <br />
<li>'''Project Leaders.''' Currently, there are only three of these:<br />
<ul><br />
<li>Art lead &mdash; Responsible for maintaining quality of all elements of the visual and auditory aspects of the game that are not controlled by code.</li><br />
<li>Programming lead &mdash; Responsible for overseeing development of the engine and game code.</li><br />
<li>Meta-project &amp; Public Relations lead &mdash; Responsible for public relations (any interactions with our player base and the outside world) as well as recruiting new developers.</li><br />
</ul><br />
Input from project leads is considered only in some cases to be law, but that doesn't mean that discussion from other individuals will not change what the project leaders do or say. The aim of project leads is to guide, not rule: if a project lead has an unpopular opinion, it will not be enforced in any way. The development '''team''' as a whole is responsible for shaping Unvanquished, not a handful of individuals. Developers are not ''expected'' to do what they are asked, but if a project lead makes a request, then there is generally a reason for it.<br />
</li><br />
<li>'''Developers.''' These are all those who actively make large contributions (in terms of effort) to the project.</li><br />
<li>'''Contributors.''' These are those who have made smaller or more infrequent contributions to the project, or who do not wish to get too involved.</li><br />
<li>'''Users.''' Those who play the game but do not contribute any further than to merely provide discussion fall into this category.</li><br />
</ul><br />
<br />
===How do I become a developer?===<br />
<br />
====For content creators====<br />
<br />
Please let us know that you are interested in producing content for the game via [[IRC]] or the [http://unvanquished.net/forum/forum.php forums] and someone will get in touch with you with further instructions.<br />
<br />
====For programmers====<br />
<br />
Talk to the team! Just introduce yourself on [[IRC]] or the [http://unvanquished.net/forum/forum.php forums] and get involved in discussion. If you appear to be intelligent and posses the right attitude, you may be made into a contributor (to allow you access to the development sub-forums) without even having contributed any actual code.<br />
<br />
==How often is there a release?==<br />
<br />
The game is currently in Alpha. Official releases are made once a month. Our last Alpha release is expected to be the 22nd, making the first Beta release in January.<br />
<br />
==Where does discussion take place?==<br />
<br />
Unlike many open-source projects, we do not have a mailing list. Instead, discussion occurs in one of two places:<br />
<br />
* [http://unvanquished.net/forum/forum.php The forums], where long-form discussion takes place, and<br />
* [[IRC]], where short-form discussion takes place.<br />
<br />
Because of the verbose nature of the forums, they are the preferred destination for any serious discussion. Moreover, the forums allow individuals '''from all timezones''' the opportunity to contribute to discussion, and discussion generally stays much more on-topic.<br />
<br />
Do note that there are two separate forums for discussion:<br />
<br />
* "Community Development", and<br />
* "Development".<br />
<br />
While the former is visible to the public, the latter is not; you must have either Contributor or Developer status to view the "Development" forums. While not everyone agrees that this is a good idea, the reasoning is as follows:<br />
<br />
* There is not much useful feedback to be gained on specific, development-related discussions from users. While user input is read and acknowledged by members of the development team, users who do not have development skills cannot by definition make useful contributions to the discussion of aspects such as how particular engine systems will be implemented or the like.<br />
* Some members of the development team fear that users will be driven away if they see how development actually works. That is, oftentimes very encouraging amounts of progress are made very quickly, followed by either silence from particular members of the development team (due to wavering interest or real life issues) or show-stopping problems. These sort of things happen quite often, so the idea is that by hiding development discussion, users only see those subprojects '''which have actually reached completion,''' to avoid disappointment.</div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Contributing/Media&diff=2064Contributing/Media2013-05-31T02:29:23Z<p>Velociostrich: Add a link to the main contributing page.</p>
<hr />
<div>This page outlines information about the project as a whole so that you can get involved more quickly.<br />
<br />
==Before you begin==<br />
<br />
Before following these guidelines, please read the [[Contributing|main article on contributing]]. It contains useful information about how the project is structured as a whole and what our philosophies are towards development.<br />
<br />
==Trying Out the Game==<br />
<br />
{{Note|content=Please be aware that this information applies to '''all''' members of the team. You are expected to try the game at some point if you intend on contributing content to it. This is only fair to everyone else who has contributed content in the past, and ensures consistency with existing content.}}<br />
<br />
Basic download instructions are available from [http://www.unvanquished.net/download our homepage]. [[Downloading & Installing|More detailed instructions]] are available as well. If you use an unsupported operating system, please read the instructions on [[Getting the source|acquiring]] and [[Compiling the source|compiling]] the source code.<br />
<br />
Although there currently are very few players on servers at any point in time, you still have a couple of options to play the game to try it out:<br />
* '''Play against bots.''' &mdash; There are currently a number of servers with enough bots that the game is playable even without any human opponents. The training server typically always has bots, and even has a few special game modes. If you compile the source yourself, you can even test the bots offline.<!-- TODO: Add instructions for this --><br />
* '''Wait for a scheduled development game.''' &mdash; For the past several weeks, we have been scheduling games on the weekends to ensure an adequate number of players for testing. Scheduled games are all posted in the [http://unvanquished.net/forum/forumdisplay.php/35-Events Events subforum].<br />
* '''Test offline.''' &mdash; You can always start a [[Testing#Starting_a_testing_session|testing session]] and [[Testing#Testing_with_gameplay_code|use some cheats]] to test all the different weapons and character classes.<br />
<br />
Of course, you can always check who's playing online at any given moment via the [http://master.unvanquished.de master server status page] or with [[Osavul]], the game's stand-alone server browser.<br />
<br />
==Licensing==<br />
<br />
Please understand that you will be expected to license your work. You are also expected to have some basic understanding of copyright law. '''It is extremely important that you license your work correctly and that you understand the implications of what you are doing!''' Also note that assets that are of questionable origin will not be included in the game.<br />
<br />
You are expected to use one of the following Creative Commons licenses:<br />
<br />
{| class="progress wikitable"<br />
! colspan="2" | Name<br />
! colspan="4" | Features<br />
! colspan="2" | Text<br />
|-<br />
! Full<br />
! Abbreviated<br />
! Requires attribution?<br />
! Allows modification?<br />
! Allows commercial use?<br />
! Allows relicensing?<br />
! Human-readable<br />
! Legal Code<br />
|-<br />
| Creative Commons Attribution-ShareAlike 3.0 Unported<br />
| CC BY-SA 3.0<br />
| class="done" style="text-align:center;" | Yes<br />
| class="done" style="text-align:center;" | Yes<br />
| class="done" style="text-align:center;" | Yes<br />
| class="none" style="text-align:center;" | No<br />
| [http://creativecommons.org/licenses/by-sa/3.0/ License Deed]<br />
| [http://creativecommons.org/licenses/by-sa/3.0/legalcode Legal Code]<br />
|-<br />
| Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported<br />
| CC BY-NC-SA 3.0<br />
| class="done" style="text-align:center;" | Yes<br />
| class="done" style="text-align:center;" | Yes<br />
| class="none" style="text-align:center;" | No<br />
| class="none" style="text-align:center;" | No<br />
| [http://creativecommons.org/licenses/by-nc-sa/3.0/ License Deed]<br />
| [http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode Legal Code]<br />
|-<br />
| Creative Commons Attribution-NoDerivs 3.0 Unported<br />
| CC BY-ND 3.0<br />
| class="done" style="text-align:center;" | Yes<br />
| class="none" style="text-align:center;" | No<br />
| class="done" style="text-align:center;" | Yes<br />
| class="none" style="text-align:center;" | No<br />
| [http://creativecommons.org/licenses/by-nd/3.0/ License Deed]<br />
| [http://creativecommons.org/licenses/by-nd/3.0/legalcode Legal Code]<br />
|-<br />
| Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported<br />
| CC BY-NC-ND 3.0<br />
| class="done" style="text-align:center;" | Yes<br />
| class="none" style="text-align:center;" | No<br />
| class="none" style="text-align:center;" | No<br />
| class="none" style="text-align:center;" | No<br />
| [http://creativecommons.org/licenses/by-nc-nd/3.0/ License Deed]<br />
| [http://creativecommons.org/licenses/by-nc-nd/3.0/legalcode Legal Code]<br />
|-<br />
|}<br />
<br />
All of these licenses allow redistributing your work. Please note that we would much prefer if you would use one of the former two licenses. '''You must obtain permission from a project head to use one of the latter two licenses if you would like your work to be included in the game:''' while you are certainly free to license your work as you please, using one of the latter two licenses in certain situations might prevent your work from being included.<br />
<br />
If you disagree with all of the above licenses, please contact any of the project leads with your concerns. If you have another license in mind, please inform us. Be prepared to defend your criticisms of the Creative Commons licenses (i.e., provide a compelling argument) and your choice for another license. Be aware that more restrictive licenses are not likely to be accepted by the project heads.<br />
<br />
===Marking your Work===<br />
<br />
If you are working in Blender, please add a license to your work visible in the default screen layout visible in a text editor view. '''Please note that you should not do this if you are not the original creator of the work.''' For example, if you are animating a model that was created by someone else, ask '''them''' to add a notice themselves.<br />
<br />
You are advised to use the following template:<br />
<br />
Copyright {{CURRENTYEAR}} <var>your real name</var>.<br />
<br />
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.<br />
http://creativecommons.org/licenses/by-sa/3.0/<br />
<br />
Of course, you should modify this template to match whichever license your are using.<br />
<br />
===Mappers===<br />
<br />
In creating a map, you likely will end up using textures from a variety of sources. You '''must''' include copies of licenses and notices of attribution for any and all textures that you use not created by yourself. Those textures which you have created yourself should be licensed as outlined above, and a notice included. It is recommended to include a file named <code><var>mapname</var>.txt</code>, <code>map-<var>mapname</var>.txt</code> or <code>map-<var>mapname</var>-<var>version</var>.txt</code> inside a directory named <code>about</code> in your [[Packaging_game_data|.pk3]].<br />
<br />
==Introducing Yourself==<br />
<br />
Once you have access to the developer subforums, please create a post on the [http://unvanquished.net/forum/forumdisplay.php/36-Assets-amp-Artwork Assets & Artwork] subforum telling us a little about yourself.<br />
<br />
At the end of your introduction, please add the following information using this template:<br />
<br />
[LIST]<br />
[*] [B]Skillset[/B]: <var>List your skills here</var><br />
[*] [B]Software[/B]: <var>List software you know well here</var><br />
[*] [B]E-mail[/B]: <var>Please place an e-mail address that you would like to be contacted at here</var><br />
[*] [B]Preferred means of contact[/B]: <var>How would you like to be contacted?</var><br />
[*] [B]Primary operating system[/B]: <var>Which operating system (and version) do you use the most often? (E.g., Mac OS X 10.6)</var><br />
[*] [B]Portfolio[/B]: <var>Add links to any work that you have done that is visible on the internet</var><br />
[/LIST]<br />
<br />
If you do not have a portfolio and you are a 2d or 3d artist, please upload a gallery of images of your work to imgur. Similarly, if you are an audio engineer or musician, upload your work to some audio sharing site.<br />
<br />
You may wish to include other information, such as:<br />
<br />
* Alternate means of contact (e.g., Skype)<br />
* Your time zone, so that we know when we can contact you<br />
<br />
Continue reading for more specific instructions.<br />
<br />
==Animators==<br />
<br />
In addition to the [[#Introducing_Yourself|above information]], we'd like to know the following about you:<br />
<br />
* What software do you use?<br />
* How familiar are you with your preferred software? I.e., what features of your animation package do you utilize? For example, if you use Blender, do you know how to use actions and constraints?<br />
<br />
We currently use the MD5 format for animations. Please familiarize yourself with the following documentation before beginning to animate anything:<br />
<br />
* Read the [[Modeling#Workflow_overview|workflow overview]]. This explains the workflow shared by our artists for bringing a concept into reality. You are expected to understand this. If you have any questions, do not hesitate to ask.<br />
* From the model exporting guide, please read the [[Exporting_Models#Overview|overview]] and the [[Exporting_Models#What_is_MD5.3F|What is MD5?]] section. You will need to understand these in order to be able to create an animation that can successfully be exported from your animation package of choice and loaded into the game.<br />
<br />
In particular, you are expected to know the limitations of the MD5 format. '''If you do not respect these limitations, you are guaranteed to have a great deal if difficulty when attempting to export your model.''' While the art lead is more than willing to provide help to get your asset in-game, you would be wasting his/her time by not reading the documentation beforehand; it is only respectful to do so.<br />
<br />
==Audio Engineers & Musicians==<br />
<br />
In addition to the [[#Introducing_Yourself|above information]], we'd like to know the following about you:<br />
<br />
* What hardware and instruments do you have access to?<br />
* If you are a musician, what instruments do you play? If you don't play an instrument, what do you compose music with?<br />
* If you are a musician, what sort of music do you like to compose?<br />
* If you are an audio engineer, what is your particular skillset?<br />
<br />
You are expected to familiarize yourself with the following:<br />
<br />
* Please read the [[Music_and_sounds|documentation]] on music and sounds. Be aware that at the time of writing (19 March 2013), this information is rather inadequate, but it will at least answer some questions.<br />
* Please take a look at the [[Sound_Progress|sound progress]] page for an idea of what sounds there are that need replacement.<br />
<br />
In addition, you should be aware that as of the time of writing (19 March 2013), all of the sounds present in Unvanquished were inherited from Tremulous (with the exception of the main menu music) and '''must''' be replaced. '''Note that this is non-negotiable''': the sounds from Tremulous were later revealed to be stolen from various sources and cannot legally be included. As this is an open-source project, this sort of copyright infringement is not acceptable.<br />
<br />
==Concept Artists==<br />
<br />
In addition to the [[#Introducing_Yourself|above information]], we'd like to know the following about you:<br />
<br />
* What is your preferred medium? E.g., do you draw with a tablet in Photoshop, or do you use pencil and paper? Be specific.<br />
* What is your greatest strength with respect to drawing? I.e., what is the one thing that you think you are the best at drawing?<br />
* How long do you expect it to take to create a concept? We're not [http://clientsfromhell.net/ clients from hell], so we're not going to pressure you to do things quickly, but we'd just like to know in advance if it might take a week or whatever so that know you haven't just died on us if we don't hear from you for a while!<br />
<br />
Please be aware:<br />
<br />
* If you are unsure of what you would like to work on, please familiarize yourself with both the [[Aliens|alien]] and [[Humans|human]] teams.<br />
* Be aware that you are expected to [[#Trying_Out_the_Game|try the game]] at some point!<br />
* If you would like to know what character and weapon models have not been completed that are therefore available to create a concept for, take a look at the [[modeling progress]] page. Anything that is not being worked on is fair game, even if other concepts have been made before.<br />
* There is not currently a listing of all the concepts made for the game, so you will have to browse the [http://unvanquished.net/forum/forumdisplay.php/36-Assets-amp-Artwork Assets & Artwork subforum] for now.<br />
<br />
==Mappers==<br />
<br />
In addition to the [[#Introducing_Yourself|above information]], we'd like to know the following about you:<br />
<br />
* What maps have you released to the public in the past, and for what games?<br />
* What experience do you have with mapping software? Include any and all software that you have used, even if it was not for a Quake-derived game, and some indication of your skill with that software.<br />
<br />
You are expected to familiarize yourself with the following:<br />
<br />
* Please read the [[Mapping|mapping guide]] all the way through. You do not necessarily need to know how to use every feature of the tools right away, but you should understand the basics.<br />
* [[Packaging_game_data|How to get data in the game]]. This is less important when you begin mapping, but you must understand this when you approach time to release or upload your map online for testing. Ideally, you would not be creating a final release of your map without at least one beta test version.<br />
<br />
==Modelers==<br />
<br />
In addition to the [[#Introducing_Yourself|above information]], we'd like to know the following about you:<br />
<br />
* What software do you '''prefer''' to use?<br />
* What is your personal workflow? Do you begin with a high poly model and retopo that? Or do you begin and end with the geometry that will end up in the final game?<br />
* Are you capable of completing a modeling assignment, or will you need assistance? If you will need assistance (e.g., with retopoing, unwrapping, texturing, rigging, or animation), please inform us. Be specific.<br />
* Are you familiar with modern techniques? Specifically, we'd like to know if you know what the following are and how to use them:<br />
** Normal maps<br />
** Bump maps<br />
** Specular maps<br />
** Glow maps<br />
** Parallax mapping<br />
** Smoothing groups<br />
* Are you familiar with the idea of not storing lighting information in your diffuse texture? '''If you do not understand what this means, please ask.''' A guide will eventually be written on this.<br />
* Is hardware an issue? E.g., if you are going to be editing a very high poly model, do you have a video card that can handle that?<br />
<br />
You are expected to familiarize yourself with the following:<br />
<br />
* Read the [[Modeling#Workflow_overview|workflow overview]]. This explains the workflow shared by our artists for bringing a concept into reality. You are expected to understand this. If you have any questions, do not hesitate to ask.<br />
* From the model exporting guide, please read the [[Exporting_Models#Overview|overview]]. If you are not going to animate your model yourself, this is less important, but it is good to know anyway.<br />
<br />
==Texture Artists==<br />
<br />
In addition to the [[#Introducing_Yourself|above information]], we'd like to know the following about you:<br />
<br />
* Are you familiar with the idea of not storing lighting information in your diffuse texture? '''If you do not understand what this means, please ask.''' A guide will eventually be written on this.<br />
<br />
You are expected to familiarize yourself with the following:<br />
<br />
* Please read the [[texture creation]] guide. This contains important information about what formats the engine supports and where you can obtain special tools that you may need to create content specifically for our engine.</div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Main_Page&diff=2063Main Page2013-05-31T02:12:32Z<p>Velociostrich: /* Programmers */ The "Contributing code" page has been moved as a subpage of the Contributing page.</p>
<hr />
<div><!-- Please see http://www.mediawiki.org/wiki/Help:Magic_words for information on what these do. --><br />
__NOTOC__<br />
<br />
<h1 style="text-align:center;margin:0px 0px 30px 0px;border-bottom-style:none;">Welcome to the Unvanquished Wiki!</h1><br />
<br />
<table style="width:100%" cellspacing="0" cellpadding="0"><br />
<tr><br />
<td colspan="2"><br />
<div class="mainPageLinkBox" style="margin-bottom: 10px;"><br />
<br />
<h2>What is Unvanquished?</h2><br />
<br />
Unvanquished is a free and open-source first-person shooter and strategy game created by [[Developers|Unvanquished Development]]. Players fight online in team based combat in a war of [[aliens]] against [[humans]]. The game is available for most major platforms (Linux, Mac and Windows). Support for other platforms (e.g., BSD) is partially completed but not officially supported.<br />
<br />
While the humans are equipped with conventional weapons&mdash;ranging from the standard-issue [[Rifle|rifle]] to the powerful [[Lucifer Cannon]]&mdash;the aliens fight with pincers, mandibles, electrical, and projectile attacks. The game has a high emphasis on team-play: lone players are easy pickings for an opposing team who travels in groups. RTS-like strategy comes into play in the form of base-building: each map has a default base for both teams, but players are free to expand or move however they please. Similarly, a team wins by destroying the opposing team's spawn points and killing any remaining members of that team before they are able to rebuild.<br />
<br />
While Unvanquished traces its roots to [http://tremulous.net Tremulous], it is under very active development and is quickly becoming a very different game. We aim to provide a transparent development process that is open to the community, and make a new release every month. We use the [[Engine features|Daemon engine]] which provides a host of new features over Tremulous' engine.<br />
<br />
===Is it done?===<br />
<br />
Nope, we're still in alpha! However, alpha releases are public and you can download the latest release right now! Upstream development is typically very stable as are the monthly alpha releases. Each release brings new artwork and new features, as well as new gameplay elements.<br />
<br />
</div><br />
</td><br />
</tr><br />
<tr><br />
<td colspan="2"><br />
<div class="mainPageLinkBox" style="margin-bottom: 10px;"><br />
<br />
==Contributors==<br />
<br />
There are a number of ways you can help. If you would like to contribute to the project, contact a [[Developers|team member]] on the [http://unvanquished.net/forum/ forums] or on [[IRC]]. We have two channels, [irc://freenode.net/#unvanquished #unvanquished] and [irc://freenode.net/#unvanquished-dev #unvanquished-dev] on [http://freenode.net// Freenode]. The former is for general discussion, while the latter is strictly for development-related discussion, so while members of the public are welcome at either, please keep the discussion on #unvanquished-dev on topic.<br />
<br />
If you do not have an IRC client, you can use the [http://webchat.freenode.net/?channels=unvanquished web chat] directly in your browser.<br />
<br />
Newly recruited artists, please read [[Contributing/Artists|these guidelines]].<br />
<br />
</div><br />
</td><br />
</tr><br />
<tr><br />
<td width="50%" style="vertical-align: top;"><br />
<!--<br />
#####################################################################<br />
# PLAYERS #<br />
#####################################################################<br />
--><br />
<div class="mainPageLinkBox"><br />
<br />
==Players==<br />
<!-- If you would like to update the release information, please edit Template:CurrentVersion. --><br />
The current release is {{CurrentVersion|FullName}} ({{CurrentVersion|Version}}), released {{CurrentVersion|Date}}.<br />
<br />
You can read about it [{{CurrentVersion|BlogPost}} on the official blog].<br />
<br />
{| style="width:100%"<br />
|-<br />
| class="top" |<br />
<span class="h3">Getting the Game</span><br />
<br />
* [[Downloading & Installing|Installation instructions]]<br />
* [http://sourceforge.net/projects/unvanquished/files/ All downloads]<br />
* [http://sourceforge.net/projects/unvanquished/files/Assets/ Maps & Game Data]<br />
<br />
<span class="h4">Compiling</span><br />
<br />
* [[Getting the source]]<br />
* [[Development environments]]<br />
* [[Compiling the source]]<br />
<br />
<span class="h4">Windows</span><br />
<br />
* [http://sourceforge.net/projects/unvanquished/files/Windows/ Official Installer]<br />
<br />
<span class="h4">Mac OS X</span><br />
<br />
* [http://sourceforge.net/projects/unvanquished/files/Mac%20OS%20X/ Official Installer]<br />
<br />
<span class="h4">Linux</span><br />
<br />
* [http://sourceforge.net/projects/unvanquished/files/Linux/ (''Official'') All platforms]<sup>&dagger;</sup><br />
* [http://www.unvanquished.net/download#debian (''Official'') Debian & Ubuntu]<br />
* [https://aur.archlinux.org/packages.php?ID=61163 (''Semi-official'') Arch Linux]<br />
* [http://www.playdeb.net/software/Unvanquished (''Unofficial'') PlayDeb]<br />
<br />
| class="top" |<br />
<span class="h3">Lore</span><br />
<br />
* [[Aliens]]<br />
* [[Humans]]<br />
<br />
<span class="h3">Playing the Game</span><br />
<br />
* [[Running the game]]<br />
* [[Troubleshooting]]<br />
* [[Glossary]]<br />
<br />
<span class="h3">Get Competitive</span><br />
<br />
* [http://www.unvanquished.net/stats/NA1/ Gameplay stats]<br />
* [[Creating custom keybinds|Create custom keybinds]]<br />
** [[Running_the_game#Advanced_options|Advanced game options]]<br />
** [[New Cvars]]<br />
** [[Renderer Status|Renderer Cvars]]<br />
** [[Testing|Cvars and Commands for Testing]]<br />
* [[Running_the_game#Advanced_options|Tweak settings]]<br />
<br />
<span class="h3">Server Administration</span><br />
<br />
* [[Running a server]]<br />
|-<br />
|}<br />
<br />
----<br />
<br />
{|<br />
| class="top" | &dagger;<br />
| Please be aware that official Linux builds have not been available since Alpha 9 due to technical issues. Sorry for the inconvenience!<br />
|}<br />
</div><br />
<!--<br />
#####################################################################<br />
# ARTISTS #<br />
#####################################################################<br />
--><br />
<div class="mainPageLinkBox"><br />
<br />
==Artists==<br />
{| style="width:100%"<br />
|-<br />
| class="top" |<br />
<span class="h3">Overview</span><br />
<br />
* [[Tech overview]]<br />
* [[Tools]]<br />
<br />
<span class="h3">Texture Artists</span><br />
<br />
* [[UI Design]]<br />
* [[Texture creation]]<br />
<br />
<span class="h3">Audio Engineers</span><br />
<br />
* [[Music and sounds]] ([[Sound_Progress|Progress]])<br />
<br />
| class="top" |<br />
<br />
<span class="h3">Modelers</span><br />
<br />
* [[Modeling]] ([[Modeling_progress|Progress]])<br />
<br />
<span class="h3">Mappers</span><br />
<br />
* [[Mapping]]<br />
* [[Particle effects]]<br />
|-<br />
|}<br />
</div><br />
</td><br />
<td width="50%" style="vertical-align: top;"><br />
<!--<br />
#####################################################################<br />
# META-PROJECT #<br />
#####################################################################<br />
--><br />
<div class="mainPageLinkBox"><br />
==Meta Project==<br />
{| style="width:100%"<br />
|-<br />
| class="top" |<br />
<span class="h3">Discuss</span><br />
<br />
* [http://unvanquished.net/forum/ Forums]<br />
* [[IRC]]<br />
<br />
<span class="h3">Quality Assurance</span><br />
<br />
* [[Testing]]<br />
* [[Bug reporting]]<br />
<br />
<span class="h3">Documentation & Translation</span><br />
<br />
* [[Wiki Project Task List]]<br />
* [[Wiki Editing Guidelines]]<br />
* [http://unvanquished.net/translate Translations]<br />
<br />
<span class="h3">Around the Web</span><br />
<br />
* [http://www.moddb.com/games/unvanquished ModDB page]<br />
* [http://www.lgdb.org/game/unvanquished Linux Game Database page]<br />
* [http://www.happypenguin.org/show?Unvanquished Linux Game Tome page]<br />
* [http://macgamescout.org/tremz-unvanquished/ Macgamescout page]<br />
<br />
| class="top" |<br />
<span class="h3">Project Status</span><br />
<br />
* [[Sound_Progress|Sound Project Progress]]<br />
* [[Modeling_progress|Modeling Project Progress]]<br />
<br />
<span class="h3">Design</span><br />
<br />
* [[Singleplayer Brainstorming]]<br />
* [[Design Document]]<br />
* [[Game design proposals]]<br />
* [[Feature Proposals]]<br />
* [http://unvanquished.net/ideas/ideatorrent Project IdeaTorrent]<br />
<br />
<span class="h3">Development News</span><br />
<br />
* [http://www.unvanquished.net/news Development Blog]<br />
* [https://picasaweb.google.com/104009985595164250961 Development screenshots]<br />
|}<br />
</div><br />
<!--<br />
#####################################################################<br />
# PROGRAMMERS #<br />
#####################################################################<br />
--><br />
<div class="mainPageLinkBox"><br />
<br />
==Programmers==<br />
<br />
<span class="h3">Getting Started</span><br />
<br />
* [[Getting the source]]<br />
** [https://github.com/Unvanquished/Unvanquished Game/engine source] ([https://github.com/Unvanquished/Unvanquished/issues bug tracker])<br />
** [https://github.com/Unvanquished/Osavul Osavul server browser source] ([https://github.com/Unvanquished/Osavul/issues bug tracker])<br />
** [https://github.com/Unvanquished/unvanquished-master Master server source] ([https://github.com/Unvanquished/unvanquished-master/issues bug tracker])<br />
** [https://github.com/harmonise/BitRock Installer source] ([https://github.com/harmonise/BitRock/issues bug tracker])<br />
** [[Tools/Chameleon|Chameleon]] [https://github.com/Unvanquished/Chameleon source]<br />
** [[Tools/Archipelago|Archipelago]] [https://github.com/velociostrich/remapper source] ([https://github.com/velociostrich/remapper/issues bug tracker])<br />
* [[Development environments]]<br />
* [[Compiling the source]]<br />
<br />
{| style="width:100%"<br />
|-<br />
| class="top" |<br />
<span class="h3">Documentation</span><br />
<br />
* [[Engine features]]<br />
** [[Feature Proposals]]<br />
* [[Technical Documentation]]<br />
* [[Renderer Status]]<br />
* [[UI Implementation]]<br />
<br />
| class="top" |<br />
<br />
<span class="h3">Contributing</span><br />
<br />
* [[Coding convention]]<br />
* [[Contributing/Code|Contributing code]]<br />
* [[Contributor Quickies]]<br />
* [[Programming Task List]]<br />
|-<br />
|}<br />
</div><br />
</td><br />
</tr><br />
</table></div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Contributing/Code&diff=2061Contributing/Code2013-05-31T02:12:19Z<p>Velociostrich: Velociostrich moved page Contributing code to Contributing/Code: Information for contributors will now be subpages of the Contributing page.</p>
<hr />
<div>As we use github for hosting, you may very easily [https://help.github.com/articles/fork-a-repo fork] our [https://github.com/Unvanquished/Unvanquished project] (or any sub-project, such as [https://github.com/Unvanquished/Osavul Osavul]). From there, you may [https://help.github.com/articles/using-pull-requests open a pull request]. If you intend on adding a new feature, it would be wise to discuss your intentions with other developers via [[IRC]] or the [http://unvanquished.net/forums forums].<br />
<br />
Please try to do the following when contributing code:<br />
* Write [http://tbaggery.com/2008/04/19/a-note-about-git-commit-messages.html good commit messages].<br />
* Follow established [[Coding_convention|coding conventions]].<br />
* Test your commit before opening a pull request or pushing.</div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Contributing/Media&diff=2059Contributing/Media2013-05-30T01:37:45Z<p>Velociostrich: Fix a typo (s/Pleas/Please)</p>
<hr />
<div>This page outlines information about the project as a whole so that you can get involved more quickly.<br />
<br />
==Trying Out the Game==<br />
<br />
{{Note|content=Please be aware that this information applies to '''all''' members of the team. You are expected to try the game at some point if you intend on contributing content to it. This is only fair to everyone else who has contributed content in the past, and ensures consistency with existing content.}}<br />
<br />
Basic download instructions are available from [http://www.unvanquished.net/download our homepage]. [[Downloading & Installing|More detailed instructions]] are available as well. If you use an unsupported operating system, please read the instructions on [[Getting the source|acquiring]] and [[Compiling the source|compiling]] the source code.<br />
<br />
Although there currently are very few players on servers at any point in time, you still have a couple of options to play the game to try it out:<br />
* '''Play against bots.''' &mdash; There are currently a number of servers with enough bots that the game is playable even without any human opponents. The training server typically always has bots, and even has a few special game modes. If you compile the source yourself, you can even test the bots offline.<!-- TODO: Add instructions for this --><br />
* '''Wait for a scheduled development game.''' &mdash; For the past several weeks, we have been scheduling games on the weekends to ensure an adequate number of players for testing. Scheduled games are all posted in the [http://unvanquished.net/forum/forumdisplay.php/35-Events Events subforum].<br />
* '''Test offline.''' &mdash; You can always start a [[Testing#Starting_a_testing_session|testing session]] and [[Testing#Testing_with_gameplay_code|use some cheats]] to test all the different weapons and character classes.<br />
<br />
Of course, you can always check who's playing online at any given moment via the [http://master.unvanquished.de master server status page] or with [[Osavul]], the game's stand-alone server browser.<br />
<br />
==Licensing==<br />
<br />
Please understand that you will be expected to license your work. You are also expected to have some basic understanding of copyright law. '''It is extremely important that you license your work correctly and that you understand the implications of what you are doing!''' Also note that assets that are of questionable origin will not be included in the game.<br />
<br />
You are expected to use one of the following Creative Commons licenses:<br />
<br />
{| class="progress wikitable"<br />
! colspan="2" | Name<br />
! colspan="4" | Features<br />
! colspan="2" | Text<br />
|-<br />
! Full<br />
! Abbreviated<br />
! Requires attribution?<br />
! Allows modification?<br />
! Allows commercial use?<br />
! Allows relicensing?<br />
! Human-readable<br />
! Legal Code<br />
|-<br />
| Creative Commons Attribution-ShareAlike 3.0 Unported<br />
| CC BY-SA 3.0<br />
| class="done" style="text-align:center;" | Yes<br />
| class="done" style="text-align:center;" | Yes<br />
| class="done" style="text-align:center;" | Yes<br />
| class="none" style="text-align:center;" | No<br />
| [http://creativecommons.org/licenses/by-sa/3.0/ License Deed]<br />
| [http://creativecommons.org/licenses/by-sa/3.0/legalcode Legal Code]<br />
|-<br />
| Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported<br />
| CC BY-NC-SA 3.0<br />
| class="done" style="text-align:center;" | Yes<br />
| class="done" style="text-align:center;" | Yes<br />
| class="none" style="text-align:center;" | No<br />
| class="none" style="text-align:center;" | No<br />
| [http://creativecommons.org/licenses/by-nc-sa/3.0/ License Deed]<br />
| [http://creativecommons.org/licenses/by-nc-sa/3.0/legalcode Legal Code]<br />
|-<br />
| Creative Commons Attribution-NoDerivs 3.0 Unported<br />
| CC BY-ND 3.0<br />
| class="done" style="text-align:center;" | Yes<br />
| class="none" style="text-align:center;" | No<br />
| class="done" style="text-align:center;" | Yes<br />
| class="none" style="text-align:center;" | No<br />
| [http://creativecommons.org/licenses/by-nd/3.0/ License Deed]<br />
| [http://creativecommons.org/licenses/by-nd/3.0/legalcode Legal Code]<br />
|-<br />
| Creative Commons Attribution-NonCommercial-NoDerivs 3.0 Unported<br />
| CC BY-NC-ND 3.0<br />
| class="done" style="text-align:center;" | Yes<br />
| class="none" style="text-align:center;" | No<br />
| class="none" style="text-align:center;" | No<br />
| class="none" style="text-align:center;" | No<br />
| [http://creativecommons.org/licenses/by-nc-nd/3.0/ License Deed]<br />
| [http://creativecommons.org/licenses/by-nc-nd/3.0/legalcode Legal Code]<br />
|-<br />
|}<br />
<br />
All of these licenses allow redistributing your work. Please note that we would much prefer if you would use one of the former two licenses. '''You must obtain permission from a project head to use one of the latter two licenses if you would like your work to be included in the game:''' while you are certainly free to license your work as you please, using one of the latter two licenses in certain situations might prevent your work from being included.<br />
<br />
If you disagree with all of the above licenses, please contact any of the project leads with your concerns. If you have another license in mind, please inform us. Be prepared to defend your criticisms of the Creative Commons licenses (i.e., provide a compelling argument) and your choice for another license. Be aware that more restrictive licenses are not likely to be accepted by the project heads.<br />
<br />
===Marking your Work===<br />
<br />
If you are working in Blender, please add a license to your work visible in the default screen layout visible in a text editor view. '''Please note that you should not do this if you are not the original creator of the work.''' For example, if you are animating a model that was created by someone else, ask '''them''' to add a notice themselves.<br />
<br />
You are advised to use the following template:<br />
<br />
Copyright {{CURRENTYEAR}} <var>your real name</var>.<br />
<br />
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.<br />
http://creativecommons.org/licenses/by-sa/3.0/<br />
<br />
Of course, you should modify this template to match whichever license your are using.<br />
<br />
===Mappers===<br />
<br />
In creating a map, you likely will end up using textures from a variety of sources. You '''must''' include copies of licenses and notices of attribution for any and all textures that you use not created by yourself. Those textures which you have created yourself should be licensed as outlined above, and a notice included. It is recommended to include a file named <code><var>mapname</var>.txt</code>, <code>map-<var>mapname</var>.txt</code> or <code>map-<var>mapname</var>-<var>version</var>.txt</code> inside a directory named <code>about</code> in your [[Packaging_game_data|.pk3]].<br />
<br />
==Introducing Yourself==<br />
<br />
Once you have access to the developer subforums, please create a post on the [http://unvanquished.net/forum/forumdisplay.php/36-Assets-amp-Artwork Assets & Artwork] subforum telling us a little about yourself.<br />
<br />
At the end of your introduction, please add the following information using this template:<br />
<br />
[LIST]<br />
[*] [B]Skillset[/B]: <var>List your skills here</var><br />
[*] [B]Software[/B]: <var>List software you know well here</var><br />
[*] [B]E-mail[/B]: <var>Please place an e-mail address that you would like to be contacted at here</var><br />
[*] [B]Preferred means of contact[/B]: <var>How would you like to be contacted?</var><br />
[*] [B]Primary operating system[/B]: <var>Which operating system (and version) do you use the most often? (E.g., Mac OS X 10.6)</var><br />
[*] [B]Portfolio[/B]: <var>Add links to any work that you have done that is visible on the internet</var><br />
[/LIST]<br />
<br />
If you do not have a portfolio and you are a 2d or 3d artist, please upload a gallery of images of your work to imgur. Similarly, if you are an audio engineer or musician, upload your work to some audio sharing site.<br />
<br />
You may wish to include other information, such as:<br />
<br />
* Alternate means of contact (e.g., Skype)<br />
* Your time zone, so that we know when we can contact you<br />
<br />
Continue reading for more specific instructions.<br />
<br />
==Animators==<br />
<br />
In addition to the [[#Introducing_Yourself|above information]], we'd like to know the following about you:<br />
<br />
* What software do you use?<br />
* How familiar are you with your preferred software? I.e., what features of your animation package do you utilize? For example, if you use Blender, do you know how to use actions and constraints?<br />
<br />
We currently use the MD5 format for animations. Please familiarize yourself with the following documentation before beginning to animate anything:<br />
<br />
* Read the [[Modeling#Workflow_overview|workflow overview]]. This explains the workflow shared by our artists for bringing a concept into reality. You are expected to understand this. If you have any questions, do not hesitate to ask.<br />
* From the model exporting guide, please read the [[Exporting_Models#Overview|overview]] and the [[Exporting_Models#What_is_MD5.3F|What is MD5?]] section. You will need to understand these in order to be able to create an animation that can successfully be exported from your animation package of choice and loaded into the game.<br />
<br />
In particular, you are expected to know the limitations of the MD5 format. '''If you do not respect these limitations, you are guaranteed to have a great deal if difficulty when attempting to export your model.''' While the art lead is more than willing to provide help to get your asset in-game, you would be wasting his/her time by not reading the documentation beforehand; it is only respectful to do so.<br />
<br />
==Audio Engineers & Musicians==<br />
<br />
In addition to the [[#Introducing_Yourself|above information]], we'd like to know the following about you:<br />
<br />
* What hardware and instruments do you have access to?<br />
* If you are a musician, what instruments do you play? If you don't play an instrument, what do you compose music with?<br />
* If you are a musician, what sort of music do you like to compose?<br />
* If you are an audio engineer, what is your particular skillset?<br />
<br />
You are expected to familiarize yourself with the following:<br />
<br />
* Please read the [[Music_and_sounds|documentation]] on music and sounds. Be aware that at the time of writing (19 March 2013), this information is rather inadequate, but it will at least answer some questions.<br />
* Please take a look at the [[Sound_Progress|sound progress]] page for an idea of what sounds there are that need replacement.<br />
<br />
In addition, you should be aware that as of the time of writing (19 March 2013), all of the sounds present in Unvanquished were inherited from Tremulous (with the exception of the main menu music) and '''must''' be replaced. '''Note that this is non-negotiable''': the sounds from Tremulous were later revealed to be stolen from various sources and cannot legally be included. As this is an open-source project, this sort of copyright infringement is not acceptable.<br />
<br />
==Concept Artists==<br />
<br />
In addition to the [[#Introducing_Yourself|above information]], we'd like to know the following about you:<br />
<br />
* What is your preferred medium? E.g., do you draw with a tablet in Photoshop, or do you use pencil and paper? Be specific.<br />
* What is your greatest strength with respect to drawing? I.e., what is the one thing that you think you are the best at drawing?<br />
* How long do you expect it to take to create a concept? We're not [http://clientsfromhell.net/ clients from hell], so we're not going to pressure you to do things quickly, but we'd just like to know in advance if it might take a week or whatever so that know you haven't just died on us if we don't hear from you for a while!<br />
<br />
Please be aware:<br />
<br />
* If you are unsure of what you would like to work on, please familiarize yourself with both the [[Aliens|alien]] and [[Humans|human]] teams.<br />
* Be aware that you are expected to [[#Trying_Out_the_Game|try the game]] at some point!<br />
* If you would like to know what character and weapon models have not been completed that are therefore available to create a concept for, take a look at the [[modeling progress]] page. Anything that is not being worked on is fair game, even if other concepts have been made before.<br />
* There is not currently a listing of all the concepts made for the game, so you will have to browse the [http://unvanquished.net/forum/forumdisplay.php/36-Assets-amp-Artwork Assets & Artwork subforum] for now.<br />
<br />
==Mappers==<br />
<br />
In addition to the [[#Introducing_Yourself|above information]], we'd like to know the following about you:<br />
<br />
* What maps have you released to the public in the past, and for what games?<br />
* What experience do you have with mapping software? Include any and all software that you have used, even if it was not for a Quake-derived game, and some indication of your skill with that software.<br />
<br />
You are expected to familiarize yourself with the following:<br />
<br />
* Please read the [[Mapping|mapping guide]] all the way through. You do not necessarily need to know how to use every feature of the tools right away, but you should understand the basics.<br />
* [[Packaging_game_data|How to get data in the game]]. This is less important when you begin mapping, but you must understand this when you approach time to release or upload your map online for testing. Ideally, you would not be creating a final release of your map without at least one beta test version.<br />
<br />
==Modelers==<br />
<br />
In addition to the [[#Introducing_Yourself|above information]], we'd like to know the following about you:<br />
<br />
* What software do you '''prefer''' to use?<br />
* What is your personal workflow? Do you begin with a high poly model and retopo that? Or do you begin and end with the geometry that will end up in the final game?<br />
* Are you capable of completing a modeling assignment, or will you need assistance? If you will need assistance (e.g., with retopoing, unwrapping, texturing, rigging, or animation), please inform us. Be specific.<br />
* Are you familiar with modern techniques? Specifically, we'd like to know if you know what the following are and how to use them:<br />
** Normal maps<br />
** Bump maps<br />
** Specular maps<br />
** Glow maps<br />
** Parallax mapping<br />
** Smoothing groups<br />
* Are you familiar with the idea of not storing lighting information in your diffuse texture? '''If you do not understand what this means, please ask.''' A guide will eventually be written on this.<br />
* Is hardware an issue? E.g., if you are going to be editing a very high poly model, do you have a video card that can handle that?<br />
<br />
You are expected to familiarize yourself with the following:<br />
<br />
* Read the [[Modeling#Workflow_overview|workflow overview]]. This explains the workflow shared by our artists for bringing a concept into reality. You are expected to understand this. If you have any questions, do not hesitate to ask.<br />
* From the model exporting guide, please read the [[Exporting_Models#Overview|overview]]. If you are not going to animate your model yourself, this is less important, but it is good to know anyway.<br />
<br />
==Texture Artists==<br />
<br />
In addition to the [[#Introducing_Yourself|above information]], we'd like to know the following about you:<br />
<br />
* Are you familiar with the idea of not storing lighting information in your diffuse texture? '''If you do not understand what this means, please ask.''' A guide will eventually be written on this.<br />
<br />
You are expected to familiarize yourself with the following:<br />
<br />
* Please read the [[texture creation]] guide. This contains important information about what formats the engine supports and where you can obtain special tools that you may need to create content specifically for our engine.</div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Compiling_the_source&diff=2053Compiling the source2013-05-25T16:30:03Z<p>Velociostrich: /* Visual Studio */ Add a note on error 5100 with the Windows 7 SDK.</p>
<hr />
<div>==Mac OS X==<br />
<br />
First, you need to [[Getting_the_source|acquire the source code]].<br />
<br />
Regardless of what interface you may use to compile the source, you will need [http://www.cmake.org/cmake/resources/software.html CMake] to generate makefiles. You will also need to install [https://developer.apple.com/xcode/ Xcode] (making sure to choose to install the command-line utilities when prompted by the installer).<br />
<br />
Then, you will need to acquire (and in some cases, manually compile) at a minimum the [[#Dependencies|necessary libraries]].<br />
<br />
Once you have the source code and the libraries installed, you may actually proceed to compile the source. You have several options:<br />
* '''Compile the source at the command line'''. This is the easiest if you would just like to compile the game to use yourself and you do not intend to work on the code.<br />
* '''Compile the source using an IDE'''. This is preferred if you intend on developing the source.<br />
** Xcode is Apple's flagship IDE and you should have installed to compile the source regardless of which method you use.<br />
** [http://qt-project.org/downloads QtCreator] is cross-platform and provides real-time feedback of syntax errors, a Vim mode, as well as other features.<br />
** [http://www.codeblocks.org/ Code::Blcoks] is also cross-platform but lacks some of the features of Xcode and QtCreator.<br />
<br />
===Dependencies===<br />
<br />
You only need to use one of the following methods (HomeBrew or compiling by hand). Please try and avoid mixing methods as this may produce unexpected results.<br />
<br />
Unvanquished requires the following libraries:<br />
* [[#JPEG|JPEG]], version 8 or higher. (Version 6 was known to have problems)<br />
* [[#Simple_DirectMedia_Layer_.28SDL.29|Simple DirectMedia Layer]] (The binary provided by libsdl.org causes graphical corruptions. Compile from source or use homebrew/macports)<br />
* [[#The_OpenGL_Extension_Wrangler_Library_.28GLEW.29|The OpenGL Extension Wrangler Library]]<br />
* CuRL<br />
* [[#The_GNU_MP_Bignum_Library_.28libgmp.29|GMP]]<br />
* [[#WebP|WebP]] (v0.2.0 or newer)<br />
<br />
The following libraries are optional:<br />
* Theora<br />
* Speex<br />
* [[#Ogg|Ogg]]<br />
* [[#Vorbis|Vorbis]]<br />
<br />
====HomeBrew====<br />
Install [http://mxcl.github.com/homebrew/ HomeBrew] and then run the following command<br />
<br />
$ brew install nettle libjpeg curl sdl webp xvid gmp glew speex libvorbis theora<br />
<br />
All the necessary libraries should now have been installed.<br />
<br />
====Compiling by hand====<br />
The following are shell scripts that download, compile, and install various libraries. This is more time consuming then other methods but might be useful if you need more control over your libraries<br />
<br />
=====JPEG=====<br />
<br />
$ curl http://www.ijg.org/files/jpegsrc.v8d.tar.gz > jpegsrc.v8d.tar.gz<br />
$ tar xvzf jpegsrc.v8d.tar.gz<br />
$ cd jpeg-8d<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The OpenGL Extension Wrangler Library (GLEW)=====<br />
<br />
$ curl -L https://sourceforge.net/projects/glew/files/glew/1.7.0/glew-1.7.0.tgz/download > glew-1.7.0.tgz<br />
$ tar xvzf glew-1.7.0.tgz<br />
$ cd glew-1.7.0<br />
$ make<br />
$ sudo make install<br />
<br />
=====Simple DirectMedia Layer (SDL)=====<br />
<br />
Do not use the binaries provided by libsdl.org, as these are known to cause issues with gamma and color display. Instead, compile your own:<br />
<br />
$ curl http://www.libsdl.org/release/SDL-1.2.15.tar.gz > SDL-1.2.15.tar.gz<br />
$ tar xvzf SDL-1.2.15.tar.gz<br />
$ cd SDL-1.2.15<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The GNU MP Bignum Library (libgmp)=====<br />
<br />
$ curl ftp://ftp.gmplib.org/pub/gmp-5.0.5/gmp-5.0.5.tar.bz2 > gmp-5.0.5.tar.bz2<br />
$ tar xvjf gmp-5.0.5.tar.bz2<br />
$ cd gmp-5.0.5<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Ogg=====<br />
<br />
$ curl http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz > libogg-1.3.0.tar.gz<br />
$ tar xvzf libogg-1.3.0.tar.gz<br />
$ cd libogg-1.3.0<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Vorbis=====<br />
<br />
$ curl http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz > libvorbis-1.3.3.tar.gz<br />
$ tar xvzf libvorbis-1.3.3.tar.gz<br />
$ cd libvorbis-1.3.3<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====WebP=====<br />
<br />
You do not need to compile WebP by hand; Google provides binaries for Mac OS X available from their [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0-mac-10.5.tar.gz project page]. You will need version 0.2.0 or newer.<br />
<br />
Once downloaded, you must still install the header files and the binary:<br />
<br />
$ curl https://webp.googlecode.com/files/libwebp-0.2.0-mac-10.5.tar.gz > libwebp-0.2.0-mac-10.5.tar.gz<br />
$ tar xvzf libwebp-0.2.0-mac-10.5.tar.gz<br />
$ cd libwebp-0.2.0-mac-10.5<br />
$ sudo cp include/webp /usr/local/include<br />
$ sudo cp lib/libwebp.a /usr/local/lib<br />
<br />
===Configuring with CMake===<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 should be a different directory.<br />
# Hit "Configure". You will be prompted as to which generator you would like to use. If you have Xcode installed, choose that. Wait while the configuration process runs. You may have to set the following:<br />
## If CMake did not find your jpeg headers for some reason, set <code>JPEG_INCLUDE_DIR</code> to <code>/path/to/Unvanquished/src/libs/jpeg</code>.<br />
## Check <code>USE_INTERNAL_CRYPTO</code> to avoid having to compile nettle and hogweed yourself.<br />
## Check <code>USE_INTERNAL_SPEEX</code> to avoid having to compile Speex yourself.<br />
## Uncheck <code>USE_CIN_THEORA</code> and <code>USE_CIN_XVID</code> to avoid having to compile Theora or Xvid. (At present, there are not cutscenes or any such that require it.)<br />
## '''You will probably not be able to compile with the GLSL optimizer enabled; uncheck <code>USE_GLSL_OPTIMIZER</code>'''<br />
## If you have selected to generate Xcode project files, make the <code>SDLMAIN_LIBRARY</code> field blank. This option is not available if you have the generator set to Unix makefiles.<br />
# Hit "Generate".<br />
# You may now close CMake.<br />
<br />
===Compiling===<br />
<br />
====With Xcode====<br />
<br />
<ol><br />
<li>Compilation will fail unless you manually create certain directories needed by the build scripts:<br />
<pre><br />
$ cd /path/to/build/dir/CMakeFiles<br />
$ mkdir gpp{game,trem,ui}-qvm.dir<br />
</pre><br />
This is a workaround to {{Issue|101}}.<br />
</li><br />
<li>Either start Xcode and open the project file (in the build directory you specified) or double-click the project file in Finder.</li><br />
<li>Open the project file created by CMake, which should be in the build directory you specified.</li><br />
<li>Change the active target to "ALL_BUILD" and click Product&rarr;Build.</li><br />
</ol><br />
<br />
====With Unix Makefiles====<br />
<br />
<ul><br />
<li>Start Terminal (Applications &rarr; Utilities &rarr; Terminal).</li><br />
<li>Input the following commands:<br />
<pre><br />
$ cd /path/to/Unvanquished-build<br />
$ make<br />
</pre><br />
If you are on a multi-core or multi-processor machine, you may speed up the process by passing the <code>-j</code> argument followed by the number of available cores to <code>make</code>; e.g., <code>make -j4</code>. Note that doing so makes reading error messages more difficult, as multiple instances of the compiler will print to the screen at once, causing information to appear out of order.<br />
</li><br />
</ul><br />
<br />
===Testing the build===<br />
<br />
====With Xcode 4====<br />
<br />
To test the game, select the "client" scheme from the combo box on the toolbar, and click the run button or press {{Hotkey|MacCommand}}{{Hotkey|R}}.<br />
<br />
====With Unix Makefiles====<br />
<br />
After compiling, you'll have to place the data files in the <code>main</code> directory in your build directory. [[#Acquiring the Game Files|For download instructions, see below.]]<br />
<br />
Your file structure should look as follows:<br />
<br />
[[File:Build_dir_Mac_OS_X.png]]<br />
<br />
You may now start the application as such:<br />
<br />
$ ./daemon.i386<br />
<br />
Note that older machines will not support the new OpenGL 3 renderer, and must be started specifying the "vanilla" (aka "GL") renderer:<br />
<br />
$ ./daemon.i386 +set cl_renderer GL<br />
<br />
===Bundling the Application===<br />
<br />
====With CPack====<br />
<br />
CPack is able to create standalone bundles (as well as many other types of installers). However you must generate the files using Unix Makefiles instead of Xcode.<br />
<br />
$ cd /path/to/Unvanquished-build<br />
$ cpack -G Bundle<br />
<br />
Some warnings will be printed however these can be safely ignored. There should be a file called Unvanquished.dmg in the Unvanquished-build folder.<br />
<br />
====Manually====<br />
<br />
{{Note|header=Important|content=<br />
Please be aware that these instructions are very much out of date, and may not work. Also note that the dynamic library bundler does '''not''' work as intended and although you will be able to run your build on your machine, it will most likely not work on other machines. It is strongly suggested that you compile the source using Xcode.<br />
}}<br />
<br />
You'll find the Mac [http://macdylibbundler.sourceforge.net/ dynamic library bundler] to be quite useful (you must generate the files using Unix Makefiles instead of Xcode):<br />
<br />
$ curl -L http://sourceforge.net/projects/macdylibbundler/files/macdylibbundler/0.4.1/dylibbundler0.4.1.zip/download > \<br />
dylibbundler0.4.1.zip<br />
$ unzip dylibbundler0.4.1.zip<br />
$ cd dylibbundler<br />
$ make<br />
$ sudo make install<br />
<br />
Once you've done that, you can proceed to create the application bundle. Note that these steps assume that you have downloaded the data files to <code>main/</code> as shown above:<br />
<br />
<pre><br />
$ git=/path/to/Unvanquished-git-repo<br />
$ build=/path/to/Unvanquished-build-dir<br />
$ mkdir -pv Unvanquished.app/Contents/{libs,MacOS,Resources,Frameworks}<br />
$ cp -r $build/main Unvanquished.app/Contents/MacOS<br />
$ sips -s format tiff $git/debian/unvanquished.png --out temp.tiff<br />
$ tiff2icns temp.tiff Unvanquished.app/Contents/Resources/Unvanquished.icns<br />
$ rm temp.tiff<br />
$ cp $build/daemon{,ded}.i386 $build/*.dylib Unvanquished.app/Contents/MacOS<br />
$ cp -r /Library/Frameworks/SDL.framework Unvanquished.app/Contents/Frameworks<br />
$ install_name_tool -id \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/Frameworks/SDL.framework/Versions/A/SDL<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGLi386.dylib<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGL3i386.dylib<br />
$ for binary in Unvanquished.app/Contents/MacOS/*.{i386,dylib}; do<br />
dylibbundler -b -x $binary -d $dest/Unvanquished.app/Contents/libs/; done<br />
$ cp /usr/lib/libGLEW.1.7.0.dylib ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ chmod +w ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -id @executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -change /usr/lib/libGLEW.1.7.0.dylib \<br />
@executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ cat > Unvanquished.app/Contents/Info.plist<br />
<?xml version="1.0" encoding="UTF-8"?><br />
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"<br />
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"><br />
<plist version="1.0"><br />
<dict><br />
<key>CFBundleName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleDisplayName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleExecutable</key><br />
<string>daemon.i386</string><br />
<key>CFBundleIconFile</key><br />
<string>Unvanquished.icns</string><br />
<key>CFBundleIdentifier</key><br />
<string>net.Unvanquished</string><br />
<key>CFBundleInfoDictionaryVersion</key><br />
<string>6.0</string><br />
<key>CFBundlePackageType</key><br />
<string>APPL</string><br />
<key>CFBundleShortVersionString</key><br />
<string>0.4.0</string><br />
<key>CFBundleVersion</key><br />
<string>0.4.0</string><br />
</dict><br />
</plist><br />
^d<br />
</pre><br />
<br />
Note: <code>^d</code> indicates pressing {{Hotkey|Ctrl}}{{Hotkey|D}} on the keyboard.<br />
<br />
The contents of the completed application bundle should look like this:<br />
<br />
[[File:Bundle_dir_Mac_OS_X.png]]<br />
<br />
'''Note''': If you compiled SDL from source, you will not see a directory titled <code>SDL.framework</code>.<br />
<br />
==Windows==<br />
<br />
===Visual Studio===<br />
<br />
CMake can generate Visual Studio projects for Unvanquished.<br />
<br />
# Run the <code>Visual_Studio32.bat</code> batch script in your source directory by double-clicking it. Alternatively, you may use the <code>Visual_Studio64.bat</code> shell script if you have the [http://www.microsoft.com/en-us/download/details.aspx?id=8279 Windows 7 SDK] installed and a 64-bit system.<br />
# Open <code>build-32/Daemon.sln</code> in Visual Studio 2010.<br />
# In the two text boxes in the toolbar, select "Release" or "Debug" in the first one and Win32 in the second one<br />
# Press {{Hotkey|F5}} to build solution and run application, or just use Build &rarr; Build Solution to compile the code.<br />
<br />
====Important Notes====<br />
<br />
* LLVM is disabled and does not work correctly with CMake generated Visual Studio projects.<br />
* ncurses is not supported under Visual Studio.<br />
* The path to the build folder must not have any spaces otherwise generation of QVMs will fail. See {{Issue|102}}.<br />
* Due to limitations with CMake, neither the startup project nor the working directory can be specified. These must be set manually to debug the client with Visual Studio:<br />
** Right click on client and select "Set as StartUp project".<br />
** Right click on client, select properties, select Debugging and set "Working Directory" to <code>$(TargetPath)\..</code>.<br />
<br />
====Troubleshooting====<br />
<br />
If installing the Windows 7 SDK [http://support.microsoft.com/kb/2717426?ppud=4&wa=wsignin1.0 fails with error code 5100] (when the installation fails, click "View Log", and search for "5100"), remove any installed copies of the Microsoft Visual C++ 2010 x86 Redistributable and Microsoft Visual C++ 2010 x64 Redistributable via the control panel (Control Panel &rarr; Programs and Features), then run the installer again.<br />
<br />
===MinGW===<br />
<br />
It is possible to build Unvanquished with MinGW, although the process is rather arduous compared to Visual Studio or compiling for other platforms. Currently, you will also need [http://cygwin.com/setup.exe Cygwin] to build the GMP library as well.<br />
<br />
====Notes====<br />
<br />
* The easiest way to acquire and install MinGW is with the graphical [http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/ mingw-get-inst installer]. At a minimum, you will need to install the C and C++ compilers. <!-- TODO: maybe walk the user through the installer? --><br />
* When configuring the build with CMake, you will find that you will have to set a number of libraries manually. You can find precompiled DLLs for most of the dependencies; those that are not pre-compiled can be built with the corresponding <code>USE_INTERNAL_</code> setting.<br />
* '''The build will fail during QVM compilation if your source or build directories contain spaces.''' This is due to a bug with lcc. If your home directory contains a space, you may want to create source and build directories at the root of one of your drives (e.g., <code>C:\Unvanquished\Source</code> and <code>C:\Unvanquished\Build</code>.)<br />
<br />
====Instructions====<br />
<br />
The easiest way to get a build up (at the time of writing) is as follows:<br />
<br />
{{Note|content=Although there are 64-bit binaries of most of the libraries required to build the game, these do not work with MinGW at present, so the following instructions all use the 32-bit binaries.}}<br />
<br />
<ol><br />
<li>You will need to download and install some version of the DirectX SDK to compile the source. You may download the June 2010 release from [http://www.microsoft.com/en-us/download/details.aspx?id=6812 Microsoft].</li><br />
<li>Although there are binaries of gmp distributed with the source, they have are dependent on Visual Studio's implementations of <code>_ftol2_sse</code> and <code>_alloca_probe_16</code>. A fix may be found on [http://stackoverflow.com/questions/6753111/static-linking-with-openssl Stack Exchange], but requires that Visual Studio be installed, which defeats the purpose of attempting to use MinGW to compile the source. You can build gmp yourself:<br />
<ol><br />
<li>Download and extract the latest version of the [http://gmplib.org/ GNU MP Bignum Library (GMP)]. (You will need either cygwin with tar and bz2 installed or 7-zip to extract the archive.)</li><br />
<li>Install the following Cygwin packages if you have not already:<br />
* binutils<br />
* gcc<br />
* gcc-g++<br />
* m4<br />
* make<br />
</li><br />
<li>As part of the GMP compilation process, a file called <code>gen-fib.c</code> generates a table of numbers in the Fibonacci sequence. The generated file does not play nicely with Cygwin or MinGW, so you must fix it. Edit <code>gen-fib.c</code>, and at around line 100, change these lines<br />
<pre><br />
for (i = 0; i < fnum; i++)<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
printf ("), /* %d */\n", i-1);<br />
}<br />
printf ("};\n");<br />
</pre><br />
to look like this:<br />
<pre><br />
for (i = 0; i < fnum; i++)<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
printf (")%c /* %d */\n", (i == (fnum-1)) ? ' ' : ',', i-1);<br />
}<br />
printf ("};\n");<br />
</pre><br />
The patch file looks like this:<br />
<pre><br />
@@ -100,7 +100,7 @@<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
- printf ("), /* %d */\n", i-1);<br />
+ printf (")%c /* %d */\n", (i == (fnum-1)) ? ' ' : ',', i-1);<br />
}<br />
printf ("};\n");<br />
}<br />
</pre><br />
</li><br />
<li>Compiling with MinGW does not work, so you will need to compile with Cygwin. At the prompt:<br />
<pre><br />
$ ./configure --disable-static --enable-shared<br />
$ make<br />
</pre><br />
The <code>--disable-static</code> and <code>--enable-shared</code> flags configure GMP to build a DLL instead of a static library. You may optionally perform <code>make install</code>. Additional compilation instructions [http://www.cs.nyu.edu/exact/core/gmp/ are available].<br />
<p>If you experience difficulties with compilation and it appears that MinGW gcc is being detected by <code>configure</code> and not Cygwin gcc, you can try editing your <code>PATH</code> variable:</p><br />
<pre><br />
$ export PATH=`echo $PATH | sed "s|/cygdrive/c/MinGW/bin:||"`<br />
</pre><br />
Re-run <code>configure</code> and <code>make</code> afterwards.<br />
</ol><br />
</li><br />
<li>Download the [http://www.libsdl.org/release/SDL-1.2.15-win32.zip latest stable version] of SDL for Windows. Extract the archive and copy <code>SDL.dll</code> from it to the root of your build directory.</li><br />
<li>Set the following CMake flags:<br />
{| class="wikitable"<br />
! Setting<br />
! Description<br />
! Type<br />
! Value<br />
|-<br />
| <code>USE_INTERNAL_CRYPTO</code><br />
| Use the provided copies of crypto libraries. <!-- FIXME: I think these are nettle and something else --><br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_GLEW</code><br />
| Use the provided copy of GLEW.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_JPEG</code><br />
| Use the provided copy of JPEG.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SDL</code><br />
| Use the provided copy of SDL.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SPEEX</code><br />
| Use the provided copy of Speex.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_WEBP</code><br />
| Use the provided copy of WebP.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_CURSES</code><br />
| Enables/disables curses.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>PNG_LIBRARY</code><br />
| Path to the PNG library DLL.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng/libs/win32/libpng.lib</code><br />
|-<br />
| <code>PNG_PNG_INCLUDE_DIR</code><br />
| Path to the PNG library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng</code><br />
|-<br />
| <code>FREETYPE_LIBRARY</code><br />
| Path to the compiled FreeType library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/lib/freetype.lib</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_freetype2</code><br />
| Path to the FreeType library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/freetype2</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_ft2build</code><br />
| Path to the FreeType library file "ftbuild.h".<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/</code><br />
|-<br />
| <code>GMP_INCLUDE_DIR</code><br />
| Path to the GMP library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/gmp/include</code><br />
|-<br />
| <code>GMP_LIBRARY</code><br />
| Path to the GMP library.<br />
| <code>FILEPATH</code><br />
| <code><var>path/to/compiled/gmp/</var>.libs/cyggmp-10.dll</code><br />
|-<br />
| <code>ZLIB_INCLUDE_DIR</code><br />
| Path to the zlib library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/include</code><br />
|-<br />
| <code>ZLIB_LIBRARY</code><br />
| Path to the zlib library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/lib/x32/zlib1.dll</code><br />
|-<br />
| <code>CURL_LIBRARY</code><br />
| Path to the CURL library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/lib/win32/release/libcurl.dll</code><br />
|-<br />
| <code>CURL_INCLUDE_DIR</code><br />
| Path to the zlib library.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/include/curl</code><br />
|-<br />
| <code>USE_OPENAL</code><br />
| Enables/disables OpenAL support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_THEORA</code><br />
| Enables/disables Theora support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_XVID</code><br />
| Enables/disables Xvid support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CODEC_THEORA</code><br />
| Enables/disables Ogg support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>SDL_LIBRARY</code><br />
| The path to the SDL DLL.<br />
| <code>FILEPATH</code><br />
| <code><var>BuildPath</var>/SDL.dll</code><br />
|-<br />
| <code>SDLMAIN_LIBRARY</code><br />
| Enables/disables Ogg support.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code><br />
|-<br />
|}<br />
Do note that CMake is slash-direction&ndash;agnostic; it can handle both forward- and backslashes on Windows.<br />
<p>If you would like to compile a debug build, change <code>CMAKE_RELEASE_TYPE</code> from <code>Release</code> to <code>Debug</code>.</p><br />
</li><br />
<li>Open <code><var>SourcePath</var>/CMakeLists.txt</code> and edit the line<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi z )<br />
</pre><br />
(around line 1040) to look like this:<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi )<br />
</pre><br />
Also edit around line 1700:<br />
<pre><br />
###########################<br />
#Configure Download Script#<br />
###########################<br />
<br />
if( NOT MSVC )<br />
</pre><br />
to look like this:<br />
<pre><br />
###########################<br />
#Configure Download Script#<br />
###########################<br />
<br />
if( NOT WIN32 )<br />
</pre><br />
</li><br />
<li>Open <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code> and edit the lines:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "SDL.h"<br />
#include "SDL_main.h"<br />
</pre><br />
to look like:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "../../../include/SDL.h"<br />
#include "../../../include/SDL_main.h"<br />
</pre><br />
<li>Open a command prompt and <code>cd</code> to your source directory.</li><br />
<li>Run <code>make</code>:<br />
<pre><br />
> mingw32-make<br />
</pre><br />
If you would like verbose output, set the <code>VERBOSE</code> environment variable before running <code>make</code>.<br />
<pre><br />
> set VERBOSE=1<br />
</pre><br />
To make it easier to build the source, you can create a batch file (call it something like <code>compile.bat</code>) and place it in your build directory:<br />
<pre><br />
@echo off<br />
<br />
set RETURN=compile<br />
<br />
:get_time<br />
:: Thank you, Rob van der Woude:<br />
:: (http://www.robvanderwoude.com/datetimentparse.php)<br />
FOR /F "tokens=1,2,3 delims=:." %%A IN ("%Time%") DO (<br />
SET /A HOURS = 100%%A %% 100<br />
SET /A MINUTES = 100%%B %% 100<br />
SET /A SECONDS = 100%%C %% 100<br />
)<br />
SET /A TICKS=( %HOURS% * 3600 ) + ( %MINUTES% * 60 ) + %SECONDS%<br />
GOTO %RETURN%<br />
<br />
:compile<br />
SET START_TICKS=%TICKS%<br />
<br />
SET VERBOSE=1<br />
:: mingw32-make clean<br />
mingw32-make -j4<br />
<br />
set RETURN=finish<br />
GOTO get_time<br />
<br />
:finish<br />
SET /A COMPILE_TIME=%TICKS% - %START_TICKS%<br />
SET /A MINUTES=%COMPILE_TIME% / 60<br />
SET /A SECONDS=%COMPILE_TIME% %% 60<br />
ECHO.<br />
ECHO Compilation took %MINUTES%m %SECONDS%s.<br />
PAUSE<br />
</pre><br />
</li><br />
<li>Once compilation finishes, you will find that the game will fail to run due to DLL dependencies. To resolve these:<br />
<ul><br />
<li>You will need to move <code>INTERNAL_GLEW</code> from the <code>Release/</code> folder of the build directory to the root of the build directory.</li><br />
<li>You will need to place the following other DLLs in your build directory:<br />
* freetype6.dll<br />
* libcurl.dll<br />
* libpng14-14.dll<br />
* zlib1.dll<br />
If the renderer's DLL dependencies are not met, you will be informed that the game failed to load a renderer. If you receive an error stating that the application failed to start at all, then you are likely missing some version of the Microsoft Visual C runtime redistributable.<br />
<p>You may find that you also need these DLLs (if you configured your build differently):</p><br />
* libbz2.dll<br />
* libogg.dll<br />
* libtheora.dll<br />
* libvorbis.dll<br />
* libvorbisfile.dll<br />
* msvcr100.dll<br />
* msvcr100d.dll<br />
* zlibwapi.dll<br />
The easiest way to obtain these DLLs is by copying them from the installation directory of an [http://sourceforge.net/projects/unvanquished/files/latest/download official release] of Unvanquished.<br />
</li><br />
<li>You will need to copy your compiled DLL of GMP to your build directory. It may be found in <code><var>path/to/compiled/gmp/</var>.libs/cyggmp-10.dll</code>.</li><br />
<li>As you compiled GMP with Cygwin, it in turn depends on <code>cygwin1.dll</code>, which may typically be found in <code>C:\cygwin\bin\</code>. Copy and paste it into your build directory.</li><br />
</ul><br />
Once you have completed these steps, you should never have to do them again.<br />
</li><br />
</ol><br />
<br />
====Notes====<br />
<br />
* If you would like to use curses, try using [http://sourceforge.net/projects/pdcurses/files/pdcurses PDCurses].<br />
<br />
===QtCreator===<br />
<br />
# Install MinGW and follow the above instructions, except select Code::Blocks as the generator.<br />
# Start QtCreator, and select "Open File or Project&hellip;" from the File menu.<br />
# Navigate to your source directory and open CMakeLists.txt.<br />
# At the CMake Wizard, select the same build directory you already configured using CMake. (If you did not chose Code::Blocks as the generator, you will have to start over again, as QtCreator requires a Code::Blocks project file in order to compile the source.)<br />
# Ensure that a generator is selected in the combo box, and click "Run CMake". If there is no generator listed, see the [[#Troubleshooting|troubleshooting]] section below.<br />
# Click "Finish" to close the wizard.<br />
<br />
You should now be able to compile, run, and debug the code using QtCreator.<br />
<br />
====Troubleshooting====<br />
<br />
If at the "Run CMake" prompt of the the CMake Wizard, select "Run CMake" and are warned that no generator was selected, and notice that there are no generators in the combo box, you will likely have to [http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html manually configure your toolchain]. Select "Options&hellip;" from the "Tools" menu, then navigate to "Build &amp; Run".<br />
<br />
At the options window,<br />
* Go to the "Kits" tab, and mouse over the "Desktop (default)" kit under "Manual". If there were any errors in configuring this kit, they will be displayed in the tool tip. If there are problems, select the kit. You may need to manually specify the location of the MinGW debugger, for example, which is typically <code>C:\MinGW\bin\gdb.exe</code>.<br />
* Go to the "Compilers" tab, and ensure that MinGW is present. If not, you will need to add it manually.<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 />
libgmp3-dev libjpeg8-dev libncurses5-dev libogg-dev libopenal-dev \<br />
libpng12-dev libsdl1.2-dev libvorbis-dev zlib1g-dev nettle-dev \<br />
libwebp-dev libspeexdsp-dev libtheora-dev<br />
<br />
If the version of WebP supplied by your version of Debian or Ubuntu is older than v0.2.0, you will need to [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0.tar.gz download] and [https://developers.google.com/speed/webp/docs/compiling#unix compile it from source]. After compiling and installing with <code>sudo make install</code>, in CMake, you'll need to set <code>WEBP_INCLUDE_DIR</code> to <code>/usr/local/include/webp</code> and <code>WEBP_LIBRARY</code> to <code>/usr/local/lib/libwebp.so</code>.<br />
<br />
'''We currently provide a ready-to-use libwebp-dev in our [http://{{SERVERNAME}}/index.php/Download#ubuntu Debian and Ubuntu repositories], alongside .debs of the game and server.'''<br />
<br />
Actual dev package names may vary, e.g. libgmp-dev instead of libgmp3-dev and libglew-dev or libglew1.7-dev instead of libglew1.5-dev.<br />
<br />
Since we have a debian directory in the source, you can also to check what's needed then install the listed packages (choosing from alternatives as needed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ dpkg-checkbuilddeps<br />
…<br />
$ sudo apt-get install <var>package(s)</var><br />
<br />
If dpkg-checkbuilddeps produces no output, you have all necessary build dependencies. Also, debhelper's only needed if you're building .debs.<br />
<br />
====Gentoo====<br />
<br />
$ emerge curl freetype glew gmp jpeg ncurses libogg openal libpng libsdl libvorbis zlib<br />
<br />
====openSUSE====<br />
<br />
$ sudo install zypper gcc gcc-c++ Mesa-libGL-devel SDL-devel libjpeg8-devel \<br />
libpng12-devel glew-devel webp-devel ncurses-devel gmp-devel libcurl-devel \<br />
libnettle-devel openal-soft-devel speex-devel libvorbis-devel \<br />
libtheora-devel<br />
<br />
The latest version of WebP must be installed manually:<br />
<br />
$ wget https://webp.googlecode.com/files/libwebp-0.2.1.tar.gz<br />
$ tar xvzf libwebp-0.2.1.tar.gz<br />
$ cd libwebp-0.2.1<br />
$ ./configure && make<br />
$ sudo make install<br />
<br />
You must disable curses (set <code>USE_CURSES</code> appropriately in CMake) as failing to do so will cause Unvanquished to crash on startup.<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 />
On Debian or 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 />
Or, in Debian or Ubuntu, you can build a package (but you'll need to have devscripts and fakeroot installed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ fakeroot dpkg-buildpackage -b -uc<br />
$ sudo dpkg -i <var>../unvanquished_*.deb</var><br />
<br />
Once in <code>ccmake</code>, use the following keys:<br />
<br />
* Press {{Hotkey|c}} to configure. If an error occurs during this phase, make note of it and press {{Hotkey|e}} to dismiss it.<br />
* Use the up and down arrow keys to navigate the compilation options.<br />
* Press {{Hotkey|Enter}} to enable or disable boolean options (i.e., on/off) or to edit textual options.<br />
** Press {{Hotkey|Esc}} when editing a textual option to cancel the change.<br />
<br />
Once you have finished the configuration process, press {{Hotkey|C}} again, then {{Hotkey|G}} 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=====<br />
<br />
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_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 />
* <code>USE_CIN_THEORA</code> &mdash; Disabling this prevents videos from being recorded in Theora.<br />
* <code>USE_CIN_XVID</code> &mdash; Disabling this prevents videos from being recorded in Xvid.<br />
* <code>USE_VOIP</code> &mdash; Disabling this removes VOIP support. Alternatively enabling <code>USE_INTERNAL_SPEEX</code> will use the libraries distributed with Unvanquished for VoIP<br />
* <code>USE_INTERNAL_CRYPTO</code> &mdash; Enable this to use the crypto libraries provided by Unvanquished.<br />
<br />
===Compiling===<br />
<br />
$ cd <var>path/to/unvanquished/build</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 />
===Acquiring mandatory game files===<br />
<br />
The game files are not in the Git repository, and must be downloaded separately. This may be done on the command line or from your web browser. The downloads may be found on [http://sourceforge.net/projects/unvanquished/files/Assets SourceForge.net]. If you download the files from your browser, just download the files named "pak*.pk3", and save them to the [[Running_the_game#Data_locations|data location]] for your system.<br />
<br />
On Linux, this may be done as follows:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
wget -O $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On FreeBSD, using the <code>sh</code> shell:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
fetch -r -o $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On Mac OS X:<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
curl -L "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download" > $file<br />
fi<br />
done<br />
<br />
Linux users may also use the <code>download-pk3.sh</code> script that is distributed with the source code, which requires that curl be installed:<br />
<br />
$ cd <var>[path to Unvanquished source code]</var><br />
$ mkdir -p ~/.Unvanquished/main<br />
$ ./download-pk3.sh ~/.Unvanquished/main<br />
<br />
===Downloading the map pack===<br />
<br />
The map pack exists only for convenience; if you do not download the map pack, Unvanquished will automatically download maps as needed when you attempt to play online.<br />
<br />
To download the map pack on Linux:<br />
<br />
$ wget -O maps.7z "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z"; done<br />
<br />
To download the map pack on Mac OS X:<br />
<br />
$ curl -L "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z" > maps.7z; done<br />
<br />
Note that you will need to unzip the map pack on either system as it is compressed with LZMA. Mac users can use the [http://wakaba.c3.cx/s/apps/unarchiver.html Unarchiver]. Uncompressing the archive on Linux is highly dependent on your distribution.<br />
<br />
===Verifying the Files===<br />
<br />
Download the latest [http://sourceforge.net/projects/unvanquished/files/Assets/{{CurrentVersion|MD5HashFile}} MD5 hash file] and save it to your system's [[Running_the_game#Data_directory|data location]].<br />
<br />
On systems with the <code>md5</code> command (Mac OS X):<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ cat {{CurrentVersion|MD5HashFile}} | while read line; do<br />
file="`echo "$line" | sed -E "s/^[a-fA-F0-9]+ +\*?//"`"<br />
if [ -e "$file" ]; then<br />
if [ `md5 -r "$file" | cut -d\ -f1` = "`echo "$line" | cut -d\ -f1`" ]<br />
then echo "File \"$file\" appears okay."<br />
else echo "File \"$file\" is corrupt"'!' >&2<br />
fi; fi; done<br />
<br />
On systems with the <code>md5sum</code> command (most Linux distributions):<br />
<br />
$ cd <var>[[Running_the_game#Data_directory|/path/to/data/files]]</var><br />
$ md5sum -c {{CurrentVersion|MD5HashFile}} 2>&1 | grep -v "open or read\|file or directory"<br />
<br />
The <code>grep</code> invocation is used to strip output complaining about missing files.<br />
<br />
Any files that are found to be corrupt should be replaced; just download a [http://sourceforge.net/projects/unvanquished/files/Assets new copy] of the affected file(s).<br />
<br />
==Errors==<br />
<br />
===CMake cannot locate Newton===<br />
<br />
If CMake cannot find Newton, you'll need to set it up yourself.<br />
<br />
It should be in <code><var>/path/to/Unvanquished</var>/src/libs/libnewton/libs/<var>your_os</var>/libNewton.so</code>.<br />
Be sure to replace <var>your_os</var> with the proper directory name.<br />
<br />
Use CMake as before to change the <code>NEWTON_LIBRARY</code> build setting to the said path:<br />
<br />
# Start the CMake configurator:<pre>$ ccmake ..</pre><br />
# Scroll down and highlight <code>NEWTON_LIBRARY</code>.<br />
# Press {{Hotkey|Enter}} to begin editing and input in the path.<br />
# Press {{Hotkey|C}} to configure and {{Hotkey|G}} to generate the new makefiles.<br />
# Press {{Hotkey|Q}} to quit.<br />
# Recompile the source:<pre>$ make</pre><br />
<br />
===The C Compiler is not able to compile a simple test program===<br />
<br />
When attempting to generate a solution for Xcode CMake fails with the following error<br />
-- Check for working C compiler using: Xcode -- broken<br />
CMake Error at /Applications/CMake 2.8-8.app/Contents/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):<br />
The C compiler "/usr/bin/gcc" is not able to compile a simple test program.<br />
<br />
It fails with the following output:<br />
<br />
Change Dir: /Users/danielmaloney/Documents/Unvanquished/build-xcode/CMakeFiles/CMakeTmp<br />
<br />
<br />
<br />
Run Build Command:/Applications/CMake\ 2.8-8.app/Contents/bin/cmakexbuild<br />
-project CMAKE_TRY_COMPILE.xcodeproj build -target<br />
cmTryCompileExec1400153232 -configuration Debug<br />
<br />
Error: No developer directory found at /Developer. Run<br />
/usr/bin/xcode-select to update the developer directory path.<br />
<br />
<br />
<br />
<br />
<br />
CMake will not be able to correctly generate this project.<br />
Call Stack (most recent call first):<br />
CMakeLists.txt:19 (project)<br />
<br />
This is due to Xcode 4.3 having a different directory structure to previous versions. Simply running the following command will correct this error:<br />
sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer/</div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Creating_custom_keybinds&diff=2052Creating custom keybinds2013-05-25T05:22:04Z<p>Velociostrich: /* Special uses */ Remove some special use commands that are listed on the testing page.</p>
<hr />
<div>{| align="right"<br />
| __TOC__<br />
|}<br />
<br />
{{StatusWIP|The information on this page is incomplete.}}<br />
<br />
==Usage==<br />
<br />
Some simple bindings can be made via the configuration menus.<br />
<br />
For more complicated bindings and for team bindings, you need to use the console. For example, you could bind commands to set a team and to spawn:<br />
<br />
bind F9 "team a"<br />
bind F10 "team h"<br />
<br />
// attacking players<br />
teambind aliens F5 "class level0"<br />
teambind humans F5 "class rifle"<br />
<br />
// builders<br />
teambind aliens F6 "class builderupg builder"<br />
teambind humans F6 "class ckit"<br />
<br />
==Differences from Tremulous==<br />
<br />
A number of commands for keybinds have changed since Tremulous, so keybind configurations cannot be directly copied from Tremulous to Unvanquished.<br />
<br />
{| class="wikitable"<br />
! Tremulous || Unvanquished || Used for…<br />
|-<br />
| <code>+button2</code> || <code>+useitem</code> || Using an item; granger spit; dragoon barb<br />
|-<br />
| <code>+button3</code> || <code>+taunt</code> || “Come on!” etc.<br />
|-<br />
| <code>+button5</code> || <code>+attack2</code> || Secondary attack<br />
|-<br />
| <code>+button6</code> || <code>+dodge</code> || Dodging<br />
|-<br />
| <code>+button7</code> || <code>+activate</code> || Using a structure; evolving<br />
|-<br />
| <code>+button8</code> || <code>+sprint</code> || Sprinting<br />
|-<br />
|}<br />
<br />
As of alpha 3, the <code>+button''N''</code> commands are no longer present.<br />
<br />
You may want to bind the new [[Voice say system|vsays]] to different keys.<br />
==Gameplay commands==<br />
<br />
This is a partial list of commands added, using Tremulous GPP r2259 as a reference point. Not everything listed is actually useful.<br />
<br />
{{note|content=The game handles <tt>+</tt>commands specially, in a way which has implications concerning usage.<br />
<br />
There is one way to use them in bindings which works properly, and that's to use the command on its own.<br />
<br />
It is possible to have other commands following one of these ''but'' this is not well handled – the game appends information about when the key was pressed but, at present, assumes that there's just one command present in the binding. It also causes problems on key-up when the <tt>+</tt>command is the first command since, while the it will (correctly) be converted to a <tt>-</tt>command, any following commands will be executed unmodifed, except for the last one (which gets the timing information).<br />
<br />
If you need to use a binding which contains one of these with other commands then use something like “<samp>wait; +taunt; wait; -taunt</samp>”. Timing information will not be added; the server has information which allows it to calculate ‘close enough’ timing information, and there may be a knock-on effect on an immediately-following action.<br />
}}<br />
<br />
===+activate===<br />
Access an armoury; evolve.<br />
<br />
===+attack2===<br />
Secondary attack.<br />
<br />
===+dodge===<br />
Low jump sideways or backwards. (Humans only.)<br />
<br />
===+rally===<br />
“Come on!” etc., as in ‘follow me’.<br />
<br />
===+sprint===<br />
Run. (Humans only.)<br />
<br />
===+taunt===<br />
“Come on!” etc., as in ‘bring it on!’.<br />
<br />
===+useitem===<br />
Use the highlighted item; tertiary attack (granger spit, dragoon snipe).<br />
<br />
===buy===<br />
<br />
<i>(Changed in Alpha 15.)</i> This command can take multiple parameters. It can also be used to sell items.<br />
<br />
For example, if you want a sell-all bind, you would use “<samp>buy -all rifle</samp>” – this will get rid of all equipment and re-equip you with a rifle (though if you're building something, you won't lose your construction kit and consequently will not acquire a rifle).<br />
<br />
===say_area_team===<br />
Talk to all teammates within a server-set range.<br />
<br />
===sell===<br />
<br />
<i>(Changed in Alpha 15.)</i> This command can take multiple parameters.<br />
<br />
===class===<br />
<br />
This command behaves differently depending on which team you are on.<br />
<br />
* As a human or alien, when dead, this command will cause you to spawn with the desired class or weapon, respectively.<br />
* As an alien, this command will cause you to evolve to the class specified. You may not "evolve" into lower-level classes.<br />
<br />
Note that regardless of when you invoke this command, an argument '''must''' be supplied or no result will occur.<br />
<br />
The following arguments may be used:<br />
<br />
{| class="wikitable progress"<br />
|-<br />
! Team<br />
! Argument<br />
! Spawnable?<br />
! Availability<br />
! Description<br />
|-<br />
! rowspan="10" | Aliens<br />
| <code>builder</code><br />
| rowspan="2" class="done" | Yes<br />
| rowspan="5" | Stage 1<br />
| [[Granger]]<br />
|-<br />
| <code>level0</code><br />
| [[Dretch]]<br />
|-<br />
| <code>level1</code><br />
| rowspan="3" class="none" | No<br />
| [[Basilisk]]<br />
|-<br />
| <code>level2</code><br />
| [[Marauder]]<br />
|-<br />
| <code>level3</code><br />
| [[Dragoon]]<br />
|-<br />
| <code>builderupg</code><br />
| class="done" | Yes<br />
| rowspan="4" | Stage 2<br />
| [[Advanced Granger]]<br />
|-<br />
| <code>level1upg</code><br />
| class="none" rowspan="4" | No<br />
| [[Advanced Basilisk]]<br />
|-<br />
| <code>level2upg</code><br />
| [[Advanced Marauder]]<br />
|-<br />
| <code>level3upg</code><br />
| [[Advanced Dragoon]]<br />
|-<br />
| <code>level4</code><br />
| Stage 3<br />
| [[Tyrant]]<br />
|-<br />
! rowspan="2" | Humans<br />
| <code>rifle</code><br />
| rowspan="2" class="done" | Yes<br />
| rowspan="2" | Stage 1<br />
| [[Rifle]]<br />
|-<br />
| <code>ckit</code><br />
| [[Construction Kit]]<br />
|-<br />
|}<br />
<br />
{{Note|content=<br />
For the aliens, when at a higher stage, you may still spawn as a non-advanced variant of any particular class. For example, if you type<br />
<br />
\class builder<br />
<br />
you will spawn as a normal Granger even when the Advanced Granger is available.<br />
}}<br />
<br />
==Configuration commands==<br />
<br />
===alias===<br />
<tt>alias NAME COMMAND [PARAMETERS…]</tt><br />
<br />
Create an alias for the given command. The alias is then useable as a command in its own right.<br />
<br />
===aliaslist===<br />
Lists available command aliases.<br />
<br />
===bind===<br />
<tt>bind KEY [COMMAND…]</tt><br />
Binds a command (or sequence of commands) to the given key, or lists the bindings for that key.<br />
<br />
All existing bindings on that key are lost.<br />
<br />
===clearaliases===<br />
Clears all command aliases.<br />
<br />
===cycle===<br />
<br />
===editbind===<br />
<tt>editbind [TEAM] KEY</tt><br />
<br />
This inserts a <tt>/bind</tt> or <tt>/teambind</tt> command into the in-game console, ready for editing. The console is opened if needed.<br />
<br />
<tt>TEAM</tt> is default, spectators, humans, or aliens. (Initial substrings are accepted.)<br />
<br />
===irc_connect===<br />
Start the ingame IRC client<br />
<br />
===irc_quit===<br />
Stop the ingame IRC client<br />
<br />
===irc_say===<br />
Say something in the desired IRC channel if connected to a server<br />
<br />
===listrotation===<br />
Lists the current map rotation. The current map is highlighted.<br />
<br />
===loadgame===<br />
<br />
===messagemode1===<br />
This command opens a general chat prompt.<br />
<br />
===messagemode2===<br />
This command opens a team-chat prompt.<br />
<br />
===messagemode3===<br />
This command opens an admin chat prompt.<br />
<br />
===messagemode4===<br />
This command opens a chat prompt for the built-in IRC client.<br />
<br />
===messagemodec===<br />
This command opens a command prompt.<br />
<br />
===modelist===<br />
<br />
===teambind===<br />
<tt>teambind TEAM KEY [COMMAND…]</tt><br />
Binds a command (or sequence of commands) to the given key for use when on the given team, or lists the binding for that key/team.<br />
<br />
<tt>TEAM</tt> is default, spectators, humans, or aliens. (Initial substrings are accepted.)<br />
<br />
===toggleConsole===<br />
Opens or closes the in-game console.<br />
<br />
===ui_restart===<br />
Reloads UI files.<br />
<br />
===unalias===<br />
<tt>unalias NAME</tt><br />
<br />
Removes the named alias.<br />
<br />
===unbind===<br />
<tt>unbind [TEAM] KEY</tt><br />
Removes either all bindings for the given key, or the binding for the given team on that key.<br />
<br />
<tt>TEAM</tt> is default, spectators, humans, or aliens. (Initial substrings are accepted.)<br />
<br />
===undelay===<br />
<br />
===undelayAll===<br />
<br />
===unregister===<br />
Removes registration of your GUID and name.<br />
<br />
==Condition handling==<br />
<br />
===if===<br />
<tt>if VALUE CONDITION VALUE THEN [ELSE]</tt><br />
<br />
<tt>if MODIFIERS THEN [ELSE]</tt><br />
<br />
; <tt>VALUE</tt> : a variable or number<br />
; <tt>CONDITION</tt> : comparison operator<br />
; <tt>MODIFIERS</tt> : comma-separated list of keyboard modifiers: Shift, Ctrl, Alt, Command (or Cmd), Mode, Super. Prefix any which must not be pressed with <kbd>!</kbd>.<br />
; <tt>THEN</tt> and <tt>ELSE</tt> : either a variable name or, if prefixed with <kbd>/</kbd> or <kbd>\</kbd>, a command string.<br />
<br />
Recognised numeric comparison operators:<br><br />
<tt> = != < <= > >= !=</tt><br />
<br />
Recognised string comparison operators:<br><br />
<tt> eq ne in !in</tt><br />
<br />
Either the <tt>THEN</tt> clause or the <tt>ELSE</tt> clause (if present) will be executed. If it is a variable name, its content will be executed.<br />
<br />
For example:<br />
<br />
<pre>/if shift "/echo Hello" "/echo Goodbye"<br />
/bind j "if \$team\$ eq aliens \"/class level1upg level1\""</pre><br />
<br />
(Note the escaping of the cvar <tt>team</tt>.)<br />
<br />
===modcase===<br />
<tt>modcase MODIFIERS THEN [MODIFIERS THEN]* [ELSE]</tt><br />
<br />
This works like <tt>if</tt>. The leftmost most-specific <tt>THEN</tt> whose modifier list matches is the one which is executed; if none match, then <tt>ELSE</tt> is executed if it is present.<br />
<br />
For example:<br />
<pre>/modcase shift "/echo 1" ctrl "/echo 2" shift,ctrl "/echo 3" shift,!alt "/echo 4"</pre><br />
works as follows:<br />
<br />
# if Shift and Alt (due to clause 4) but not Ctrl (due to clause 3) are pressed;<br />
# if Ctrl but not Shift (due to clause 3);<br />
# if Shift and Ctrl;<br />
# if Shift but neither Alt nor Ctrl.<br />
<br />
===strcmp===<br />
Compare the string values of two cvars. ''Obsolete.''<br />
<br />
==Admin commands==<br />
<br />
===allready===<br />
Quickly move to the next map. Used only during the intermission.<br />
<br />
===speclock===<br />
Prevents a player from joining a team for a given time or until the end of the current game.<br />
If necessary, the player is moved to spectators.<br />
<br />
===specunlock===<br />
Allows a player, previously locked, to join a team.<br />
<br />
==Utility commands==<br />
<br />
===calc===<br />
Do math calculations on cvars. Store the value to a cvar Useful in making scripts.<br />
<br />
===concat===<br />
Concatenate 2 cvars into a third.<br />
<br />
===delay===<br />
<br />
===glsl_restart===<br />
Development use. For recompiling the GLSL shader code.<br />
<br />
===grep===<br />
<tt>grep TEXT</tt><br />
<br />
Searches the in-game console for occurrences of <tt>TEXT</tt>. Matching lines are reprinted.<br />
<br />
===help===<br />
<br />
===math===<br />
Do math on cvars. Useful for scripts.<br />
<br />
===random===<br />
Generate a random number<br />
<br />
===reloadhud===<br />
Reload the HUD without a vid_restart<br />
<br />
===screenshotPNG===<br />
Saves a screenshot in the PNG format.<br />
<br />
===search===<br />
<tt>search TEXT</tt><br />
<br />
Searches back through the in-game console for <tt>TEXT</tt> and scrolls to it.<br />
<br />
===searchDown===<br />
<tt>searchDown TEXT</tt><br />
<br />
Searches forward through the in-game console for <tt>TEXT</tt> and scrolls to it.<br />
<br />
===snd_reload===<br />
Reload sounds (includes a vid_restart<br />
<br />
===wav_record===<br />
<br />
===wav_stoprecord===<br />
<br />
==Special uses==<br />
<br />
For commands relevant to development and testing purposes, please see the [[Testing]] page.<br />
<br />
===buildcubemaps===<br />
<br />
===cache_endgather===<br />
<br />
===cache_mapchange===<br />
<br />
===cache_setindex===<br />
<br />
===cache_startgather===<br />
<br />
===cache_usedfile===<br />
<br />
===fieldinfo===<br />
<br />
===gameCompleteStatus===<br />
<br />
===openurl===<br />
Open a URL inside the OS's default browser.<br />
<br />
===pubkey===<br />
Internal use.<br />
<br />
===pubkey_identify===<br />
Internal use.<br />
<br />
===setRecommended===<br />
<br />
===shaderexp===<br />
<br />
===spdevmap===<br />
Does nothing.<br />
<br />
===spmap===<br />
Does nothing.<br />
<br />
===updatehunkusage===<br />
<br />
===updatescreen===</div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Creating_custom_keybinds&diff=2051Creating custom keybinds2013-05-25T05:17:54Z<p>Velociostrich: Add documentation for the class command</p>
<hr />
<div>{| align="right"<br />
| __TOC__<br />
|}<br />
<br />
{{StatusWIP|The information on this page is incomplete.}}<br />
<br />
==Usage==<br />
<br />
Some simple bindings can be made via the configuration menus.<br />
<br />
For more complicated bindings and for team bindings, you need to use the console. For example, you could bind commands to set a team and to spawn:<br />
<br />
bind F9 "team a"<br />
bind F10 "team h"<br />
<br />
// attacking players<br />
teambind aliens F5 "class level0"<br />
teambind humans F5 "class rifle"<br />
<br />
// builders<br />
teambind aliens F6 "class builderupg builder"<br />
teambind humans F6 "class ckit"<br />
<br />
==Differences from Tremulous==<br />
<br />
A number of commands for keybinds have changed since Tremulous, so keybind configurations cannot be directly copied from Tremulous to Unvanquished.<br />
<br />
{| class="wikitable"<br />
! Tremulous || Unvanquished || Used for…<br />
|-<br />
| <code>+button2</code> || <code>+useitem</code> || Using an item; granger spit; dragoon barb<br />
|-<br />
| <code>+button3</code> || <code>+taunt</code> || “Come on!” etc.<br />
|-<br />
| <code>+button5</code> || <code>+attack2</code> || Secondary attack<br />
|-<br />
| <code>+button6</code> || <code>+dodge</code> || Dodging<br />
|-<br />
| <code>+button7</code> || <code>+activate</code> || Using a structure; evolving<br />
|-<br />
| <code>+button8</code> || <code>+sprint</code> || Sprinting<br />
|-<br />
|}<br />
<br />
As of alpha 3, the <code>+button''N''</code> commands are no longer present.<br />
<br />
You may want to bind the new [[Voice say system|vsays]] to different keys.<br />
==Gameplay commands==<br />
<br />
This is a partial list of commands added, using Tremulous GPP r2259 as a reference point. Not everything listed is actually useful.<br />
<br />
{{note|content=The game handles <tt>+</tt>commands specially, in a way which has implications concerning usage.<br />
<br />
There is one way to use them in bindings which works properly, and that's to use the command on its own.<br />
<br />
It is possible to have other commands following one of these ''but'' this is not well handled – the game appends information about when the key was pressed but, at present, assumes that there's just one command present in the binding. It also causes problems on key-up when the <tt>+</tt>command is the first command since, while the it will (correctly) be converted to a <tt>-</tt>command, any following commands will be executed unmodifed, except for the last one (which gets the timing information).<br />
<br />
If you need to use a binding which contains one of these with other commands then use something like “<samp>wait; +taunt; wait; -taunt</samp>”. Timing information will not be added; the server has information which allows it to calculate ‘close enough’ timing information, and there may be a knock-on effect on an immediately-following action.<br />
}}<br />
<br />
===+activate===<br />
Access an armoury; evolve.<br />
<br />
===+attack2===<br />
Secondary attack.<br />
<br />
===+dodge===<br />
Low jump sideways or backwards. (Humans only.)<br />
<br />
===+rally===<br />
“Come on!” etc., as in ‘follow me’.<br />
<br />
===+sprint===<br />
Run. (Humans only.)<br />
<br />
===+taunt===<br />
“Come on!” etc., as in ‘bring it on!’.<br />
<br />
===+useitem===<br />
Use the highlighted item; tertiary attack (granger spit, dragoon snipe).<br />
<br />
===buy===<br />
<br />
<i>(Changed in Alpha 15.)</i> This command can take multiple parameters. It can also be used to sell items.<br />
<br />
For example, if you want a sell-all bind, you would use “<samp>buy -all rifle</samp>” – this will get rid of all equipment and re-equip you with a rifle (though if you're building something, you won't lose your construction kit and consequently will not acquire a rifle).<br />
<br />
===say_area_team===<br />
Talk to all teammates within a server-set range.<br />
<br />
===sell===<br />
<br />
<i>(Changed in Alpha 15.)</i> This command can take multiple parameters.<br />
<br />
===class===<br />
<br />
This command behaves differently depending on which team you are on.<br />
<br />
* As a human or alien, when dead, this command will cause you to spawn with the desired class or weapon, respectively.<br />
* As an alien, this command will cause you to evolve to the class specified. You may not "evolve" into lower-level classes.<br />
<br />
Note that regardless of when you invoke this command, an argument '''must''' be supplied or no result will occur.<br />
<br />
The following arguments may be used:<br />
<br />
{| class="wikitable progress"<br />
|-<br />
! Team<br />
! Argument<br />
! Spawnable?<br />
! Availability<br />
! Description<br />
|-<br />
! rowspan="10" | Aliens<br />
| <code>builder</code><br />
| rowspan="2" class="done" | Yes<br />
| rowspan="5" | Stage 1<br />
| [[Granger]]<br />
|-<br />
| <code>level0</code><br />
| [[Dretch]]<br />
|-<br />
| <code>level1</code><br />
| rowspan="3" class="none" | No<br />
| [[Basilisk]]<br />
|-<br />
| <code>level2</code><br />
| [[Marauder]]<br />
|-<br />
| <code>level3</code><br />
| [[Dragoon]]<br />
|-<br />
| <code>builderupg</code><br />
| class="done" | Yes<br />
| rowspan="4" | Stage 2<br />
| [[Advanced Granger]]<br />
|-<br />
| <code>level1upg</code><br />
| class="none" rowspan="4" | No<br />
| [[Advanced Basilisk]]<br />
|-<br />
| <code>level2upg</code><br />
| [[Advanced Marauder]]<br />
|-<br />
| <code>level3upg</code><br />
| [[Advanced Dragoon]]<br />
|-<br />
| <code>level4</code><br />
| Stage 3<br />
| [[Tyrant]]<br />
|-<br />
! rowspan="2" | Humans<br />
| <code>rifle</code><br />
| rowspan="2" class="done" | Yes<br />
| rowspan="2" | Stage 1<br />
| [[Rifle]]<br />
|-<br />
| <code>ckit</code><br />
| [[Construction Kit]]<br />
|-<br />
|}<br />
<br />
{{Note|content=<br />
For the aliens, when at a higher stage, you may still spawn as a non-advanced variant of any particular class. For example, if you type<br />
<br />
\class builder<br />
<br />
you will spawn as a normal Granger even when the Advanced Granger is available.<br />
}}<br />
<br />
==Configuration commands==<br />
<br />
===alias===<br />
<tt>alias NAME COMMAND [PARAMETERS…]</tt><br />
<br />
Create an alias for the given command. The alias is then useable as a command in its own right.<br />
<br />
===aliaslist===<br />
Lists available command aliases.<br />
<br />
===bind===<br />
<tt>bind KEY [COMMAND…]</tt><br />
Binds a command (or sequence of commands) to the given key, or lists the bindings for that key.<br />
<br />
All existing bindings on that key are lost.<br />
<br />
===clearaliases===<br />
Clears all command aliases.<br />
<br />
===cycle===<br />
<br />
===editbind===<br />
<tt>editbind [TEAM] KEY</tt><br />
<br />
This inserts a <tt>/bind</tt> or <tt>/teambind</tt> command into the in-game console, ready for editing. The console is opened if needed.<br />
<br />
<tt>TEAM</tt> is default, spectators, humans, or aliens. (Initial substrings are accepted.)<br />
<br />
===irc_connect===<br />
Start the ingame IRC client<br />
<br />
===irc_quit===<br />
Stop the ingame IRC client<br />
<br />
===irc_say===<br />
Say something in the desired IRC channel if connected to a server<br />
<br />
===listrotation===<br />
Lists the current map rotation. The current map is highlighted.<br />
<br />
===loadgame===<br />
<br />
===messagemode1===<br />
This command opens a general chat prompt.<br />
<br />
===messagemode2===<br />
This command opens a team-chat prompt.<br />
<br />
===messagemode3===<br />
This command opens an admin chat prompt.<br />
<br />
===messagemode4===<br />
This command opens a chat prompt for the built-in IRC client.<br />
<br />
===messagemodec===<br />
This command opens a command prompt.<br />
<br />
===modelist===<br />
<br />
===teambind===<br />
<tt>teambind TEAM KEY [COMMAND…]</tt><br />
Binds a command (or sequence of commands) to the given key for use when on the given team, or lists the binding for that key/team.<br />
<br />
<tt>TEAM</tt> is default, spectators, humans, or aliens. (Initial substrings are accepted.)<br />
<br />
===toggleConsole===<br />
Opens or closes the in-game console.<br />
<br />
===ui_restart===<br />
Reloads UI files.<br />
<br />
===unalias===<br />
<tt>unalias NAME</tt><br />
<br />
Removes the named alias.<br />
<br />
===unbind===<br />
<tt>unbind [TEAM] KEY</tt><br />
Removes either all bindings for the given key, or the binding for the given team on that key.<br />
<br />
<tt>TEAM</tt> is default, spectators, humans, or aliens. (Initial substrings are accepted.)<br />
<br />
===undelay===<br />
<br />
===undelayAll===<br />
<br />
===unregister===<br />
Removes registration of your GUID and name.<br />
<br />
==Condition handling==<br />
<br />
===if===<br />
<tt>if VALUE CONDITION VALUE THEN [ELSE]</tt><br />
<br />
<tt>if MODIFIERS THEN [ELSE]</tt><br />
<br />
; <tt>VALUE</tt> : a variable or number<br />
; <tt>CONDITION</tt> : comparison operator<br />
; <tt>MODIFIERS</tt> : comma-separated list of keyboard modifiers: Shift, Ctrl, Alt, Command (or Cmd), Mode, Super. Prefix any which must not be pressed with <kbd>!</kbd>.<br />
; <tt>THEN</tt> and <tt>ELSE</tt> : either a variable name or, if prefixed with <kbd>/</kbd> or <kbd>\</kbd>, a command string.<br />
<br />
Recognised numeric comparison operators:<br><br />
<tt> = != < <= > >= !=</tt><br />
<br />
Recognised string comparison operators:<br><br />
<tt> eq ne in !in</tt><br />
<br />
Either the <tt>THEN</tt> clause or the <tt>ELSE</tt> clause (if present) will be executed. If it is a variable name, its content will be executed.<br />
<br />
For example:<br />
<br />
<pre>/if shift "/echo Hello" "/echo Goodbye"<br />
/bind j "if \$team\$ eq aliens \"/class level1upg level1\""</pre><br />
<br />
(Note the escaping of the cvar <tt>team</tt>.)<br />
<br />
===modcase===<br />
<tt>modcase MODIFIERS THEN [MODIFIERS THEN]* [ELSE]</tt><br />
<br />
This works like <tt>if</tt>. The leftmost most-specific <tt>THEN</tt> whose modifier list matches is the one which is executed; if none match, then <tt>ELSE</tt> is executed if it is present.<br />
<br />
For example:<br />
<pre>/modcase shift "/echo 1" ctrl "/echo 2" shift,ctrl "/echo 3" shift,!alt "/echo 4"</pre><br />
works as follows:<br />
<br />
# if Shift and Alt (due to clause 4) but not Ctrl (due to clause 3) are pressed;<br />
# if Ctrl but not Shift (due to clause 3);<br />
# if Shift and Ctrl;<br />
# if Shift but neither Alt nor Ctrl.<br />
<br />
===strcmp===<br />
Compare the string values of two cvars. ''Obsolete.''<br />
<br />
==Admin commands==<br />
<br />
===allready===<br />
Quickly move to the next map. Used only during the intermission.<br />
<br />
===speclock===<br />
Prevents a player from joining a team for a given time or until the end of the current game.<br />
If necessary, the player is moved to spectators.<br />
<br />
===specunlock===<br />
Allows a player, previously locked, to join a team.<br />
<br />
==Utility commands==<br />
<br />
===calc===<br />
Do math calculations on cvars. Store the value to a cvar Useful in making scripts.<br />
<br />
===concat===<br />
Concatenate 2 cvars into a third.<br />
<br />
===delay===<br />
<br />
===glsl_restart===<br />
Development use. For recompiling the GLSL shader code.<br />
<br />
===grep===<br />
<tt>grep TEXT</tt><br />
<br />
Searches the in-game console for occurrences of <tt>TEXT</tt>. Matching lines are reprinted.<br />
<br />
===help===<br />
<br />
===math===<br />
Do math on cvars. Useful for scripts.<br />
<br />
===random===<br />
Generate a random number<br />
<br />
===reloadhud===<br />
Reload the HUD without a vid_restart<br />
<br />
===screenshotPNG===<br />
Saves a screenshot in the PNG format.<br />
<br />
===search===<br />
<tt>search TEXT</tt><br />
<br />
Searches back through the in-game console for <tt>TEXT</tt> and scrolls to it.<br />
<br />
===searchDown===<br />
<tt>searchDown TEXT</tt><br />
<br />
Searches forward through the in-game console for <tt>TEXT</tt> and scrolls to it.<br />
<br />
===snd_reload===<br />
Reload sounds (includes a vid_restart<br />
<br />
===wav_record===<br />
<br />
===wav_stoprecord===<br />
<br />
==Special uses==<br />
<br />
===animationlist===<br />
<br />
===buildcubemaps===<br />
<br />
===cache_endgather===<br />
<br />
===cache_mapchange===<br />
<br />
===cache_setindex===<br />
<br />
===cache_startgather===<br />
<br />
===cache_usedfile===<br />
<br />
===fbolist===<br />
<br />
===fieldinfo===<br />
<br />
===gameCompleteStatus===<br />
<br />
===openurl===<br />
Open a URL inside the OS's default browser.<br />
<br />
===pubkey===<br />
Internal use.<br />
<br />
===pubkey_identify===<br />
Internal use.<br />
<br />
===setRecommended===<br />
<br />
===shaderexp===<br />
<br />
===spdevmap===<br />
Does nothing.<br />
<br />
===spmap===<br />
Does nothing.<br />
<br />
===updatehunkusage===<br />
<br />
===updatescreen===<br />
<br />
===vbolist===</div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Bug_reporting&diff=2015Bug reporting2013-05-18T13:39:54Z<p>Velociostrich: Expand the Do's and Don'ts section.</p>
<hr />
<div>Please file any bugs you find on GitHub using the appropriate issue tracker. Before filing a bug report, however, please check the [[troubleshooting]] page, browse the [http://unvanquished.net/forum/forumdisplay.php/6-Troubleshooting support forums], and search the relevant issue tracker to see if your issue has been noticed or reported before.<br />
<br />
Do note that there are separate issue trackers for separate parts of the game and the project:<br />
* [https://github.com/Unvanquished/Unvanquished/issues Game/engine]<br />
* [https://github.com/Unvanquished/Osavul/issues Server browser]<br />
* [https://github.com/Unvanquished/unvanquished-master/issues Master server]<br />
* [https://github.com/harmonise/BitRock/issues Installer]<br />
* [https://github.com/velociostrich/remapper/issues Archipelago]<br />
<br />
Please try to do the following when writing a bug report:<br />
* Describe the problem in detail. Carefully note what actually happens and what you expected to happen.<br />
* Describe how to reproduce the problem: i.e., steps that the developers can follow to cause it to happen.<br />
* Do not post console logs or error messages without any other accompanying explanation with the expectation that the developers will solve your problem for you; you must provide details!<br />
* If the problem is best explained with a picture or video, please, take a [[Taking_screenshots|screenshot]] and/or [[Recording_demos|record a demo]]!<br />
<br />
Please include hardware / software specs when you report your bug. Use the following template:<br />
<br />
<pre><br />
### Hardware / Software<br />
<br />
| Release | <br />
|:--|:--<br />
| Operating System | <br />
| Video Card | <br />
| Driver Type | <br />
| Driver Version | <br />
| OpenGL Version | <br />
| Map tested | <br />
| Renderer used | <br />
</pre><br />
<br />
If you are on Linux, please also include fields for your kernel version (which you can obtain from <code>uname</code>) and driver type (i.e., proprietary or open source).<br />
<br />
For example, your information might look like this:<br />
<br />
<pre><br />
### Hardware / Software<br />
<br />
| Release | v0.13.0<br />
|:--|:--<br />
| Operating System | Ubuntu 12.04 LTS<br />
| Kernel Version | 3.2.0-38-generic<br />
| Video Card | ATI Radeon HD 5670<br />
| Driver Type | Proprietary (fglrx)<br />
| Driver Version | 8.85-110419a118915C-ATI (Catalyst 11.5)<br />
| OpenGL Version | 4.2.11903 Compatibility Profile<br />
| Map tested | Star A.T.C.S.<br />
| Renderer used | GL3<br />
</pre><br />
<br />
which will produce a table like so:<br />
<br />
{| class="wikitable"<br />
|-<br />
! style="text-align:left;" | Release !! style="text-align:left;" | v0.13.0<br />
|-<br />
| Operating System || Ubuntu 12.04 LTS<br />
|-<br />
| Kernel Version || 3.2.0-38-generic<br />
|-<br />
| Video Card || ATI Radeon HD 5670<br />
|-<br />
| Driver Type || Proprietary (fglrx)<br />
|-<br />
| Driver Version || 8.85-110419a118915C-ATI (Catalyst 11.5)<br />
|-<br />
| OpenGL Version || 4.2.11903 Compatibility Profile<br />
|-<br />
| Map tested || Star A.T.C.S.<br />
|-<br />
| Renderer used || GL3<br />
|-<br />
|}<br />
<br />
==Do's and Don'ts==<br />
<br />
* '''Do''' include the requested information listed above.<br />
* '''Do''' describe the issue with the bug title. A title of just "Console", for example, does nothing to describe the issue at hand and, as such, makes the issue more difficult to return to for developers, as well as for developers to gauge the impact of the issue. Issues with titles such as "Opening the menu '''causes the game to crash'''" will be more likely to be read by a developer than the same issue titled "Menu bug", for example.<br />
* '''Do not''' refer to forum posts or similar anecdotally without providing a link.<br />
* '''Do not''' include extraneous information.<br />
* '''Do''' check to ensure that your grammar and spelling is correct.<br />
* '''Do''' use Markdown headers (begin a line with some number of pound signs, e.g., <code>###</code>) to delineate sections of your report.<br />
<br />
<span style="font-weight: bold; font-size: 18pt;">Above all, try to make your report as concise as possible while still including all the necessary information!</span><br />
<br />
==Formatting Tips & Tricks==<br />
<br />
===Code Blocks===<br />
<br />
To delineate a block of code (and enable special formatting such as syntax highlighting), begin and end the code block with four backticks (`):<br />
<br />
````<br />
/* code */<br />
````<br />
<br />
This makes reports with console output much easier to read and makes it unnecessary to rely on outside paste services.<br />
<br />
To enable syntax highlighting, you must specify a language following the first set of backticks:<br />
<br />
````diff<br />
/* code */<br />
````<br />
<br />
The following language keywords are known to work:<br />
<br />
* <code>diff</code><br />
* <code>javascript</code><br />
* <code>c</code><br />
* <code>c++</code><br />
* <code>python</code></div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Bug_reporting&diff=2014Bug reporting2013-05-18T13:35:07Z<p>Velociostrich: /* Do's and Don'ts */ Add a notice on making reports concise.</p>
<hr />
<div>Please file any bugs you find on GitHub using the appropriate issue tracker. Before filing a bug report, however, please check the [[troubleshooting]] page, browse the [http://unvanquished.net/forum/forumdisplay.php/6-Troubleshooting support forums], and search the relevant issue tracker to see if your issue has been noticed or reported before.<br />
<br />
Do note that there are separate issue trackers for separate parts of the game and the project:<br />
* [https://github.com/Unvanquished/Unvanquished/issues Game/engine]<br />
* [https://github.com/Unvanquished/Osavul/issues Server browser]<br />
* [https://github.com/Unvanquished/unvanquished-master/issues Master server]<br />
* [https://github.com/harmonise/BitRock/issues Installer]<br />
* [https://github.com/velociostrich/remapper/issues Archipelago]<br />
<br />
Please try to do the following when writing a bug report:<br />
* Describe the problem in detail. Carefully note what actually happens and what you expected to happen.<br />
* Describe how to reproduce the problem: i.e., steps that the developers can follow to cause it to happen.<br />
* Do not post console logs or error messages without any other accompanying explanation with the expectation that the developers will solve your problem for you; you must provide details!<br />
* If the problem is best explained with a picture or video, please, take a [[Taking_screenshots|screenshot]] and/or [[Recording_demos|record a demo]]!<br />
<br />
Please include hardware / software specs when you report your bug. Use the following template:<br />
<br />
<pre><br />
### Hardware / Software<br />
<br />
| Release | <br />
|:--|:--<br />
| Operating System | <br />
| Video Card | <br />
| Driver Type | <br />
| Driver Version | <br />
| OpenGL Version | <br />
| Map tested | <br />
| Renderer used | <br />
</pre><br />
<br />
If you are on Linux, please also include fields for your kernel version (which you can obtain from <code>uname</code>) and driver type (i.e., proprietary or open source).<br />
<br />
For example, your information might look like this:<br />
<br />
<pre><br />
### Hardware / Software<br />
<br />
| Release | v0.13.0<br />
|:--|:--<br />
| Operating System | Ubuntu 12.04 LTS<br />
| Kernel Version | 3.2.0-38-generic<br />
| Video Card | ATI Radeon HD 5670<br />
| Driver Type | Proprietary (fglrx)<br />
| Driver Version | 8.85-110419a118915C-ATI (Catalyst 11.5)<br />
| OpenGL Version | 4.2.11903 Compatibility Profile<br />
| Map tested | Star A.T.C.S.<br />
| Renderer used | GL3<br />
</pre><br />
<br />
which will produce a table like so:<br />
<br />
{| class="wikitable"<br />
|-<br />
! style="text-align:left;" | Release !! style="text-align:left;" | v0.13.0<br />
|-<br />
| Operating System || Ubuntu 12.04 LTS<br />
|-<br />
| Kernel Version || 3.2.0-38-generic<br />
|-<br />
| Video Card || ATI Radeon HD 5670<br />
|-<br />
| Driver Type || Proprietary (fglrx)<br />
|-<br />
| Driver Version || 8.85-110419a118915C-ATI (Catalyst 11.5)<br />
|-<br />
| OpenGL Version || 4.2.11903 Compatibility Profile<br />
|-<br />
| Map tested || Star A.T.C.S.<br />
|-<br />
| Renderer used || GL3<br />
|-<br />
|}<br />
<br />
==Do's and Don'ts==<br />
<br />
* '''Do''' include the requested information listed above.<br />
* '''Do not''' refer to forum posts or similar anecdotally without providing a link.<br />
* '''Do not''' include extraneous information.<br />
* '''Do''' check to ensure that your grammar and spelling is correct.<br />
* '''Do''' use Markdown headers (begin a line with some number of pound signs, e.g., <code>###</code>) to delineate sections of your report.<br />
<br />
<span style="font-weight: bold; font-size: 18pt;">Above all, try to make your report as concise as possible while still including all the necessary information!</span><br />
<br />
==Formatting Tips & Tricks==<br />
<br />
===Code Blocks===<br />
<br />
To delineate a block of code (and enable special formatting such as syntax highlighting), begin and end the code block with four backticks (`):<br />
<br />
````<br />
/* code */<br />
````<br />
<br />
This makes reports with console output much easier to read and makes it unnecessary to rely on outside paste services.<br />
<br />
To enable syntax highlighting, you must specify a language following the first set of backticks:<br />
<br />
````diff<br />
/* code */<br />
````<br />
<br />
The following language keywords are known to work:<br />
<br />
* <code>diff</code><br />
* <code>javascript</code><br />
* <code>c</code><br />
* <code>c++</code><br />
* <code>python</code></div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Bug_reporting&diff=2013Bug reporting2013-05-18T13:33:42Z<p>Velociostrich: Add some do's and don'ts to bug reporting.</p>
<hr />
<div>Please file any bugs you find on GitHub using the appropriate issue tracker. Before filing a bug report, however, please check the [[troubleshooting]] page, browse the [http://unvanquished.net/forum/forumdisplay.php/6-Troubleshooting support forums], and search the relevant issue tracker to see if your issue has been noticed or reported before.<br />
<br />
Do note that there are separate issue trackers for separate parts of the game and the project:<br />
* [https://github.com/Unvanquished/Unvanquished/issues Game/engine]<br />
* [https://github.com/Unvanquished/Osavul/issues Server browser]<br />
* [https://github.com/Unvanquished/unvanquished-master/issues Master server]<br />
* [https://github.com/harmonise/BitRock/issues Installer]<br />
* [https://github.com/velociostrich/remapper/issues Archipelago]<br />
<br />
Please try to do the following when writing a bug report:<br />
* Describe the problem in detail. Carefully note what actually happens and what you expected to happen.<br />
* Describe how to reproduce the problem: i.e., steps that the developers can follow to cause it to happen.<br />
* Do not post console logs or error messages without any other accompanying explanation with the expectation that the developers will solve your problem for you; you must provide details!<br />
* If the problem is best explained with a picture or video, please, take a [[Taking_screenshots|screenshot]] and/or [[Recording_demos|record a demo]]!<br />
<br />
Please include hardware / software specs when you report your bug. Use the following template:<br />
<br />
<pre><br />
### Hardware / Software<br />
<br />
| Release | <br />
|:--|:--<br />
| Operating System | <br />
| Video Card | <br />
| Driver Type | <br />
| Driver Version | <br />
| OpenGL Version | <br />
| Map tested | <br />
| Renderer used | <br />
</pre><br />
<br />
If you are on Linux, please also include fields for your kernel version (which you can obtain from <code>uname</code>) and driver type (i.e., proprietary or open source).<br />
<br />
For example, your information might look like this:<br />
<br />
<pre><br />
### Hardware / Software<br />
<br />
| Release | v0.13.0<br />
|:--|:--<br />
| Operating System | Ubuntu 12.04 LTS<br />
| Kernel Version | 3.2.0-38-generic<br />
| Video Card | ATI Radeon HD 5670<br />
| Driver Type | Proprietary (fglrx)<br />
| Driver Version | 8.85-110419a118915C-ATI (Catalyst 11.5)<br />
| OpenGL Version | 4.2.11903 Compatibility Profile<br />
| Map tested | Star A.T.C.S.<br />
| Renderer used | GL3<br />
</pre><br />
<br />
which will produce a table like so:<br />
<br />
{| class="wikitable"<br />
|-<br />
! style="text-align:left;" | Release !! style="text-align:left;" | v0.13.0<br />
|-<br />
| Operating System || Ubuntu 12.04 LTS<br />
|-<br />
| Kernel Version || 3.2.0-38-generic<br />
|-<br />
| Video Card || ATI Radeon HD 5670<br />
|-<br />
| Driver Type || Proprietary (fglrx)<br />
|-<br />
| Driver Version || 8.85-110419a118915C-ATI (Catalyst 11.5)<br />
|-<br />
| OpenGL Version || 4.2.11903 Compatibility Profile<br />
|-<br />
| Map tested || Star A.T.C.S.<br />
|-<br />
| Renderer used || GL3<br />
|-<br />
|}<br />
<br />
==Do's and Don'ts==<br />
<br />
* '''Do''' include the requested information listed above.<br />
* '''Do not''' refer to forum posts or similar anecdotally without providing a link.<br />
* '''Do not''' include extraneous information.<br />
* '''Do''' check to ensure that your grammar and spelling is correct.<br />
* '''Do''' use Markdown headers (begin a line with some number of pound signs, e.g., <code>###</code>) to delineate sections of your report.<br />
<br />
==Formatting Tips & Tricks==<br />
<br />
===Code Blocks===<br />
<br />
To delineate a block of code (and enable special formatting such as syntax highlighting), begin and end the code block with four backticks (`):<br />
<br />
````<br />
/* code */<br />
````<br />
<br />
This makes reports with console output much easier to read and makes it unnecessary to rely on outside paste services.<br />
<br />
To enable syntax highlighting, you must specify a language following the first set of backticks:<br />
<br />
````diff<br />
/* code */<br />
````<br />
<br />
The following language keywords are known to work:<br />
<br />
* <code>diff</code><br />
* <code>javascript</code><br />
* <code>c</code><br />
* <code>c++</code><br />
* <code>python</code></div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Development_environments&diff=2010Development environments2013-05-11T03:16:50Z<p>Velociostrich: /* Installing Meld on Windows */ Update Meld installation instructions and add instructions on creating a shortcut.</p>
<hr />
<div>The purpose of this page is to help developers set up the tools they need to get work done; basically, research into different tools has been done here for you.<br />
<br />
==Git Front-ends==<br />
<br />
The official Git project maintains a list of of [http://git-scm.com/downloads/guis front-ends].<br />
<br />
Some tools offer varying levels of git integration, as well:<br />
<!-- add others as appropriate --><br />
* Xcode 4<br />
* QtCreator<br />
<br />
==IDEs==<br />
<br />
Wikipedia has a [http://en.wikipedia.org/wiki/Comparison_of_integrated_development_environments#C.2FC.2B.2B comprehensive comparison of C/C++ IDEs], though certain IDEs are better suited for Unvanquished than others. Specifically, the following are used or have successfully been used by members of the team:<br />
<br />
{| class="wikitable"<br />
|-<br />
! Name<br />
! Supported OSes<br />
! Difficulty in setup<br />
|-<br />
| XCode 4<br />
|<br />
* Mac OS X 10.6+ 32/64-bit<sup>1</sup><br />
* Mac OS X 10.7+ 64-bit<br />
| Easy<br />
|-<br />
| QtCreator<br />
|<br />
* Mac OS X<sup>2</sup><br />
* Windows<br />
* Linux<br />
|<br />
* Mac OS X: Easy<br />
* Windows: Difficult<br />
* Linux: Easy<br />
|-<br />
| Code::Blocks<br />
|<br />
* Mac OS X<br />
* Windows<br />
* Linux<br />
|<br />
* Mac OS X: Easy<br />
* Windows: Difficult<br />
* Linux: Easy<br />
|-<br />
| Microsoft Visual Studio<br />
| Windows<br />
|<br />
|-<br />
|}<br />
<br />
Note:<br />
# The 32-bit version of XCode 4 for Mac OS X 10.6 and up was only very briefly available for Mac OS X some time in early 2011 for a small price; following the release of 10.7 (Lion), XCode became freely available once more, but only for 64-bit Lion systems.<br />
# Builds for older versions of Mac OS X are only available from [http://qt-project.org/downloads qt-project.org], the non-commercial Qt project.<br />
<br />
==File Comparison Tools==<br />
<br />
See [http://en.wikipedia.org/wiki/Comparison_of_file_comparison_tools Wikipedia's article] on the subject for a comparison.<br />
<br />
===Installing Meld on Windows===<br />
<br />
Meld is not officially supported for Windows, but can be made to work.<br />
<br />
# Download and install [http://www.python.org/ftp/python/2.7.4/python-2.7.4.msi Python 2.7.4], released 6 April 2013. (Newer versions may work as well. A listing of [http://www.python.org/ftp/python/ all available downloads] is available).<br />
# Download and install [http://ftp.gnome.org/pub/GNOME/binaries/win32/pygtk/2.24/pygtk-all-in-one-2.24.2.win32-py2.7.msi PyGtk for Windows] (version 2.24.2, released, 9 February 2012).<br />
# Download the [http://ftp.gnome.org/pub/GNOME/sources/meld/1.5/meld-1.5.4.tar.xz latest version] of Meld, at time of writing version 1.5.4, released 2 April 2012. You will need a file decompression tool like [http://www.7-zip.org/ 7-Zip] to extract the archive. Once extracted, for ease of use, you may want to place it in your program files directory.<br />
# Set the PATH variable to get Python to work:<br />
## Click Start.<br />
## Right click on "Computer" and select "Properties".<br />
## Click "Advanced System Settings" in the sidebar.<br />
## Click "Environment Variables".<br />
## Edit the <code>PATH</code> variable and append ";C:\Python27" The semicolon acts as a delimiter.<br />
<br />
To run Meld, you can use the following:<br />
<br />
> cd "<var>path\to\Meld</var>\bin"<br />
> python meld<br />
<br />
If you would like to create a shortcut, perform the following steps:<br />
<br />
# Navigate to wherever you extracted your copy of Meld, then to the <code>bin/</code> subdirectory.<br />
# Right click on <code>meld</code> and select "Send to" &rarr; "Desktop (create shortcut)"<br />
# On your desktop, right-click on the newly created icon and select "Properties".<br />
# Prepend the "Target" field with <code>python</code>, and click "OK".<br />
<br />
==Using vim==<br />
<br />
===Mac OS X===<br />
<br />
The easiest (and arguably best) way of getting Vim on Mac OS X is to use [http://code.google.com/p/macvim/ MacVim], which provides a native Mac OS X interface that supports most common Mac OS X shortcuts:<br />
<br />
{| class="wikitable"<br />
! Shortcut<br />
! Action<br />
|-<br />
| Command-S<br />
| Save the current file.<br />
|-<br />
| Command-W<br />
| Close the current tab or window.<br />
|-<br />
| Command-O<br />
| Opens a file in a new window.<br />
|-<br />
| Command-Z<br />
| Undoes the last action.<br />
|-<br />
| Shift-Command-Z<br />
| Redoes the last action.<br />
|-<br />
| Command-Shift-T<br />
| Opens a file in a new tab.<br />
|-<br />
| Shift-Command-[<br />
| Move to the tab left of the current tab, looping around to the rightmost tab if currently at the leftmost.<br />
|-<br />
| Shift-Command-]<br />
| Move to the tab right of the current tab, looping around to the leftmost tab if currently at the rightmost.<br />
|-<br />
|}<br />
<br />
===Installing GLSL syntax files===<br />
<br />
Download the latest version of the syntax file (<code>glsl.vim</code>) from the [http://www.vim.org/scripts/script.php?script_id=1002 official Vim scripts page].<br />
<br />
Linux and Mac OS X users, place the file in <code>~/.vim/syntax</code>. Windows users, place the file in <code>%HOMEPATH%\vimfiles\syntax\</code>.<br />
<br />
At this point, users of all systems may edit GLSL files with syntax highlighting by explicitly setting the filetype to GLSL of the open file:<br />
<br />
:set syntax=glsl<br />
<br />
For automatic filetype detection, create creating a file with the following text:<br />
<br />
au BufNewFile,BufRead *.frag,*.vert,*.fp,*.vp,*.glsl setf glsl<br />
<br />
and save it as <code>~/.vim/ftdetect/glsl.vim</code> for Mac OS X and Linux users or <code>%HOMEPATH%\vimfiles\ftdetect\glsl.vim</code> for Windows users.<br />
<br />
Linux and Mac OS X users may do everything on the command line easily:<br />
<br />
$ mkdir -p ~/.vim/{syntax,ftdetect}<br />
$ mv glsl.vim ~/.vim/syntax<br />
$ cat > ~/.vim/ftdetect/glsl.vim<br />
au BufNewFile,BufRead *.frag,*.vert,*.fp,*.vp,*.glsl setf glsl<br />
^d<br />
<br />
Note that <code>^d</code> indicates pressing <span class="key">Control</span>-<span class="key">D</span> on the keyboard.</div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=UI/Implementation&diff=2008UI/Implementation2013-05-11T03:04:43Z<p>Velociostrich: Clean up documentation some more.</p>
<hr />
<div>==Legacy==<br />
<br />
{{Note|content=<br />
Please be aware that the information in this section describes the legacy (menu file&ndash;based) GUI. <br />
}}<br />
<br />
User interface code runs in its own [[Virtual_machines|virtual machine]]. Source code for handling user interface controls and loading UI files may be found in <code>[https://github.com/Unvanquished/Unvanquished/tree/master/src/gamelogic/ui src/gamelogic/ui/]</code>; the actual UI content is controlled by configuration files found in <code>[https://github.com/Unvanquished/Unvanquished/tree/master/main/ui main/ui/]</code>. The list of menu files is found in <code>[https://github.com/Unvanquished/Unvanquished/tree/master/main/ui/menus.txt main/ui/menus.txt]</code>. The game will not run without this file present.<br />
<br />
===Editing tools===<br />
<br />
There is a Quake 3 HUD editor called [http://plrf.org/q3cpmahudeditor/ q3cmpa hud editor] (which is no longer maintained), and a newer version called [http://plrf.org/superhudeditor/ SuperHud Editor], which appears to be built using wxWidgets.<br />
<br />
===Troubleshooting===<br />
<br />
====Game crashes for an unknown reason====<br />
<br />
Your <code>[https://github.com/Unvanquished/Unvanquished/tree/master/main/ui/menudef.h main/ui/menudef.h]</code> file may be out of date. <!-- TODO: add bt to where this usually happens --><br />
<br />
==Implementation-Independent GUI Behavior==<br />
<br />
This information applies to both the legacy and libRocket GUI implementations.<br />
<br />
===Weapon icons===<br />
<br />
Weapon icons are controlled by the <code>icon</code> entry in the weapon's [[Exporting_Models#Weapons_2|configuration file]].<br />
<br />
==libRocket GUI==<br />
<br />
A move to use [http://librocket.com/ libRocket] has been planned with support underway. This middleware will allow creating the user interface using HTML and CSS. If you are interested in assisting with the transition, please [[Main_Page#Contributing|contact a member of the team]] to find out how to help.<br />
<br />
===libRocket Integration Progress===<br />
<br />
====General====<br />
<br />
* Get libRocket to play nicely with q3 shaders<br />
* Clean up the generic RocketElement class used to draw all the ownerdraws [50%]<br />
* Remove ui_shared.c cgame dependence [10%]<br />
* Analyze potential of adding future animations [waaaaaaaaaay in the future, if at all]<br />
<br />
====Data Sources (aka feeders)====<br />
<br />
{| class="wikitable progress"<br />
|-<br />
! Name<br />
! Description<br />
! Status<br />
|-<br />
| Resolutions<br />
| list of resolutions<br />
| class="done" | Implemented<br />
|-<br />
| VoIP Input<br />
| Input devices for OpenAL<br />
| class="done" | Implemented<br />
|-<br />
| AL Output<br />
| Output devices for OpenAL<br />
| class="done" | Implemented<br />
|-<br />
| HUDS<br />
| List of HUDs to choose from<br />
| class="none" | Not Implemented<br />
|-<br />
| Languages<br />
| List of languages<br />
| class="done" | Implemented<br />
|-<br />
| Mods<br />
| List of mods<br />
| class="done" | Implemented<br />
|-<br />
| Demos<br />
| List of demos<br />
| class="done" | Implemented<br />
|-<br />
| Maps<br />
| List of maps<br />
| class="none" | Not Implemented<br />
|-<br />
| Players on team<br />
| List of players on each team<br />
| class="none" | Not Implemented<br />
|-<br />
| Players<br />
| List of players. This and above can probably be combined.<br />
| class="none" | Not Implemented<br />
|-<br />
| Server status<br />
| Detailed information on a server // Probably can implement without a feeder.<br />
| class="none" | Not Implemented<br />
|-<br />
| Find player<br />
| Results for a multiserver player search.<br />
| class="none" | Not Implemented<br />
|-<br />
| Team list<br />
| List of available teams<br />
| class="none" | Not Implemented<br />
|-<br />
| Classes<br />
| List of classes per team<br />
| class="none" | Not Implemented<br />
|-<br />
| Items<br />
| List of available items per team<br />
| class="none" | Not Implemented<br />
|-<br />
| Armory items<br />
| List of items. Can probably be merged with above.<br />
| class="none" | Not Implemented<br />
|-<br />
| Alien evo classes<br />
| List of classes that can be evo'd to.<br />
| class="none" | Not Implemented<br />
|-<br />
| Buildable menu<br />
| List of buildables that can be built<br />
| class="none" | Not Implemented<br />
|-<br />
| Ignore<br />
| List of players/patterns player has ignored<br />
| class="none" | Not Implemented<br />
|-<br />
| Help<br />
| List of help topics<br />
| class="none" | Not Implemented<br />
|}<br />
<br />
====Missing Elements====<br />
* Chat field - Field for chat.<br />
* Selectable datagrid - Selectable table, essentially. Warsow has this. Can probably port.<br />
* Model view - Display a model. Low priority imo. Won't do unless there is demand.<br />
* Key select - Detect which key is pressed. For binds.<br />
<br />
====Ownerdraws====<br />
<br />
{{UIElement<br />
|Name=health<br />
|Description=Renders the player's current health.<br />
}}<br />
<br />
{{UIElement<br />
|Name=bar<br />
|Description=Draws a progress bar.<br />
|Attributes=<br />
{{UIAttribute|Name=item|Type=cvar|Description=The name of the cvar that determines the current value of the progress bar.}}<br />
{{UIAttribute|Name=maxValue|Type=cvar|Description=The name of the cvar that specifies the maximum value of the progress bar; when <code>item</code> reaches this value, the progress bar will be rendered completely full.}}<br />
{{UIAttribute|Name=img|Optional|Type=string|Description=If a solid bar is not desired, the image that will be used to render the bar.}}<br />
{{UIAttribute|Name=direction|Optional|Type=left{{!}}right{{!}}up{{!}}down|Description=The direction that the bar decreases.}}<br />
}}<br />
<br />
{{UIElement<br />
|Name=ammo<br />
|Description=Current ammo value.<br />
|Attributes=<br />
{{UIAttribute|Name=type|Type=all{{!}}clip|Description=Determines whether to show current clip's ammo or total ammo.}}<br />
}}<br />
<br />
{{UIElement<br />
|Name=clips<br />
|Description=Current number of clips<br />
}}<br />
<br />
{{UIElement<br />
|Name=btimer <br />
|Description=Displays a build timer.<br />
}}<br />
<br />
{{UIElement<br />
|Name=credits<br />
|Description=Credits/evos available.<br />
|Attributes=<br />
{{UIAttribute|Name=precision|Type=integer|Description=Determines the number of leading decimal places (?)}}<br />
}}<br />
<br />
{{UIElement<br />
|Name=stamina<br />
|Description=Available stamina<br />
}}<br />
<br />
{{UIElement<br />
|Name=boost<br />
|Description=Displays the current status of the [[Glossary#boost|boost]] and the time remaining before it is lost.<br />
}}<br />
<br />
{{UIElement<br />
|Name=selected<br />
|Description=Displays the icon of the currently selected item.<br />
}}<br />
<br />
{{UIElement<br />
|Name=weapon <br />
|Description=Displays the icon of the currently equipped weapon.<br />
}}<br />
<br />
{{UIElement<br />
|Name=wallclimb <br />
|Description=Wall climbing status indicator.<br />
}}<br />
<br />
{{UIElement<br />
|Name=alien_sense<br />
|Description=Alien radar.<br />
}}<br />
<br />
{{UIElement<br />
|Name=scanner<br />
|Description=Human radar.<br />
}}<br />
<br />
{{UIElement<br />
|Name=useable_buildable<br />
|Description=Indicates to the player when they are within range of a usable buildable.<br />
}}<br />
<br />
{{UIElement<br />
|Name=location <br />
|Description=Displays the name of the location in which the player is currently occupying, as set by the map author.<br />
}}<br />
<br />
{{UIElement<br />
|Name=team_overlay<br />
|Description=Team overlay which shows useful team info <!-- such as...? --><br />
}}<br />
<br />
{{UIElement<br />
|Name=fps<br />
|Description=Displays the current framerate, in frames per second.<br />
}}<br />
<br />
{{UIElement<br />
|Name=timer<br />
|Description=Displays the time since the game began.<br />
}}<br />
<br />
{{UIElement<br />
|Name=lagometer<br />
|Description=Displays a scrolling graph of the quality of the player's connection over time.<br />
}}<br />
<br />
{{UIElement<br />
|Name=speedometer<br />
|Description=Displays the player's current speed.<br />
}}<br />
<br />
{{UIElement<br />
|Name=crosshair_name<br />
|Description=Displays the name of the player currently in the crosshair, if it is appropriate to show.<br />
}}<br />
<br />
{{UIElement<br />
|Name=stage_report<br />
|Description=Indicates what percentage of map control is needed to advance to the next stage.<br />
}}<br />
<br />
{{UIElement<br />
|Name=demo<br />
|Description=Displays the state of demo recording or playback.<br />
}}</div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Template:Current&diff=1998Template:Current2013-05-07T00:54:08Z<p>Velociostrich: Bump version information.</p>
<hr />
<div><includeonly>{{#switch: {{{1}}}<br />
| BlogPost = http://unvanquished.net/news/58-alpha-15<br />
| Date = May 6<sup>th</sup><br />
| FullName = Alpha 15<br />
| MD5HashFile = md5sums0.15<br />
| Number = 15<br />
| PakFiles = pak{{lcb}}{0..9},{A..E}{{rcb}}.pk3<br />
| Tag = v0.15.0<br />
| Type = Alpha<br />
| Version = v0.15.0<br />
| VMPk3 = vms-0.15.0.pk3<br />
}}</includeonly><noinclude><br />
{{Documentation}}<br />
</noinclude></div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Getting_the_source&diff=1984Getting the source2013-04-23T02:37:30Z<p>Velociostrich: Add (very basic) instructions on keeping the source up-to-date.</p>
<hr />
<div>The [https://github.com/Unvanquished/Unvanquished Unvanquished source code] is hosted on GitHub. You can either download a snapshot of the source code in [https://github.com/Unvanquished/Unvanquished/zipball/master ZIP archive form], or you can use Git to clone the repository.<br />
<br />
==Installing Git==<br />
<br />
If you already have Git installed, you can skip this step.<br />
<br />
===Windows===<br />
<br />
Windows users can acquire Git from the [http://code.google.com/p/msysgit/ MSysGit project]. If you would prefer a graphical front-end, there is [http://code.google.com/p/tortoisegit/ TortoiseGit], but MSysGit must be installed regardless.<br />
<br />
===Mac OS X===<br />
<br />
Apple has included Git with Xcode since version 4. You may download [https://developer.apple.com/xcode/ Xcode] from Apple's developer website. Please note that while XCode 4 was available for a very brief time for 32-bit and Snow Leopard users for a small price ($5 from the Mac App Store), this is no longer the case; it is now free, but available only to 64-bit Lion users. Snow Leopard (10.6) users and prior may now only use XCode 3, which does not include Git. If you are one of these users, you may [http://git-scm.com/download/mac acquire a copy of Git] from its site. A [http://git-scm.com/download/gui/mac selection of GUIs for Git] is also available.<br />
<br />
===Linux===<br />
<br />
====Debian & Ubuntu====<br />
<br />
Install Git using the package manager:<br />
<br />
$ sudo apt-get install git<br />
<br />
====Gentoo====<br />
<br />
The ebuilds for Unvanquished (games-fps/unvanquished) and the assets (games-fps/unvanquished-data) are available from the [https://github.com/hasufell/hasufell-overlay ''hasufell''] overlay.<br />
If you don't have layman installed, you can install it with<br />
<br />
$ emerge layman<br />
<br />
Then, adding the overlay and installing should be trivial.<br />
<br />
$ layman -a hasufell<br />
$ emerge unvanquished<br />
<br />
See [https://bugs.gentoo.org/show_bug.cgi?id=419421 the entry on bugs.gentoo.org] for additional comments about the ebuilds.<br />
<br />
==Downloading the source==<br />
<br />
===Command line===<br />
<br />
The following commands will work on any platform.<br />
<br />
$ git clone https://github.com/Unvanquished/Unvanquished.git<br />
<br />
This will create a directory called ''Unvanquished''.<br />
<br />
If you would like to get the source for a particular version, [http://git-scm.com/docs/git-checkout check out] the associated [http://git-scm.com/book/en/Git-Basics-Tagging tag]:<br />
<br />
$ git checkout {{CurrentVersion|Tag}}<br />
<br />
To see the list of tags available to check out,<br />
<br />
$ git tag<br />
<br />
will produce a list.<br />
<br />
===Linux===<br />
<br />
Please see the [[#Command_line|command line]] instructions.<br />
<br />
===Mac OS X===<br />
<br />
====Command Line====<br />
<br />
Open a Terminal (<code>/Applications/Utilities/Terminal</code>) and follow the [[#Command_line|command line]] instructions.<br />
<br />
====Xcode 4====<br />
<br />
# Start Xcode.<br />
# Open the Organizer window (Window &rarr; Organizer or {{Hotkey|Shift}}{{Hotkey|MacCommand}}{{Hotkey|2}})<br />
# Hit the "Repositories" button on the top bar.<br />
# Hit the "+" button in the lower-left corner, and choose "Checkout or Clone Repository&hellip;".<br />
# In the rollout sheet that appears, enter <code>https://github.com/Unvanquished/Unvanquished.git</code> into the "Location" field, and hit "Next".<br />
# Enter "Unvanquished" into the "Name" field, ensure that the "Type" combo box is set to "Git", and hit "Clone".<br />
# You will be prompted where to save the repository. Choose a location and hit "Clone".<br />
<br />
===Windows===<br />
<br />
====TortoiseGIT====<br />
<br />
# Make and enter a new folder to store the source code in<br />
# Right click the inside of the folder &rarr; Git Clone...<br />
# In the Url textbox enter: <code>https://github.com/Unvanquished/Unvanquished.git</code><br />
# Hit OK.<br />
<br />
====Command Line====<br />
<br />
Open the MsysGit terminal and and follow the [[#Command_line|command line]] instructions.<br />
<br />
==Keeping your copy of the source up-to-date==<br />
<br />
For more information on using git, an excellent resource is the official [http://git-scm.com/book git book], available to read online for free.<br />
<br />
===TortoiseGit===<br />
<br />
# Right-click somewhere in the source directory, and choose "Git Sync". <!-- TODO: finish instructions --><br />
<br />
===Command-line (All platforms)===<br />
<br />
{{Note|content=<br />
If you have checked out a particular commit or tag (e.g., <code>{{CurrentVersion|Tag}}</code>), git will inform you afterwards that you are in what it refers to as a "detached head" state. Before you update your copy of the source, you should check out the master branch first:<br />
<br />
$ git checkout master<br />
}}<br />
<br />
To pull (i.e., fetch and merge) changes made since you checked out the source&mdash;that is, to update your working copy to match the current state of the official repository&mdash;you (typically) need only run one command:<br />
<br />
$ git pull origin master<br />
<br />
==Compiling==<br />
<br />
After getting the source code, you can [[Compiling the source|compile]] it.</div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Technical_Documentation&diff=1976Technical Documentation2013-04-18T13:21:18Z<p>Velociostrich: Add information for new people, misc. cleanup</p>
<hr />
<div>If you have a question that is not answered here, you can always hop on the [http://unvanquished.net/forum/forumdisplay.php/30-Programming programming sub-forums] or [[IRC]].<br />
<br />
==Getting Started==<br />
<br />
If you have not already, go [[Getting_the_source|get the code]], read up on your options for [[development environments]], and [[Compiling_the_source|compile it]]. Instructions are available for a variety of platforms. If your platform of choice is not listed, you are welcome to add instructions for it.<br />
<br />
From there, play the game! The [[Running the game]] page contains documentation on all the most commonly used and user-accessible commands and console variables. If you have trouble, see the [[troubleshooting]] page for possible solutions. Additional documentation is available on console variables:<br />
* [[New_Cvars|Cvars that are new to Daemon]]<br />
* [[Renderer_Status|Cvars for the renderer]] &mdash; This page also lists information on what renderer features are known to have issues.<br />
<br />
There are also very detailed instructions on [[Testing|testing the game]], which includes information on using sophisticated profiling tools such as apitrace, GPUPerfStudio, gDEBugger, valgrind, and clang-analyzer.<br />
<br />
===Need something to work on?===<br />
<br />
There's lots of places to look for work to do:<br />
<br />
* You are always welcome to fix any [https://github.com/Unvanquished/Unvanquished/issues issues reported on the bug tracker]. Just either leave a comment on the issue you're interested in or drop in [[IRC]] beforehand to let us know that you're working on it, so we don't try to work on it at the same time. Do be aware that we have several sub-projects, each with their own bug tracker, which are all listed on the [[Bug reporting|Bug Reporting]] page.<br />
* Quick and easy tasks are listed on the [[Contributor Quickies]] page.<br />
* More involved tasks are listed on the [[Programming Task List]].<br />
* The most daunting challenges are listed on the [[Feature Proposals]] page. '''Be sure to communicate with us if you intend on working on one of these features!'''<br />
<br />
===Giving Back===<br />
<br />
You are welcome to contribute in any way possible! We have [[Contributing_code|guidelines for contributing code]] as well as documentation on [[Coding_convention|coding conventions]].<br />
<br />
==Branches==<br />
<br />
The following branches are under active development and may be of interest:<br />
<br />
* <code>librocket</code> &mdash; Work to integrate libRocket is being done on this branch. libRocket is a library that will allow us to create user interfaces using dialects of HTML and CSS.<br />
* <code>bots2</code> &mdash; New bot code, using behavior trees.<br />
<br />
==Language Oddities==<br />
<br />
<ul><br />
<li>You must use the <code>INLINE</code> macro instead of <code>inline</code>.<br />
<li>You must cast integers that are being used as enum values to an enum type. For example:<br />
<pre><br />
BG_Class ( ( class_t ) self->client->ps.stats[ STAT_CLASS ] )<br />
</pre><br />
</li><br />
</ul><br />
<br />
==Source Code &amp; Data Structure==<br />
<br />
* <code>main/</code> Data associated with the game.<br />
** <code>def/</code> Entity definitions for [[Mapping|Radiant]].<br />
** <code>fonts/</code><br />
** <code>gfx/</code><br />
** <code>glsl/</code> OpenGL shader code.<br />
** <code>lights/</code><br />
** <code>models/</code><br />
** <code>scripts/</code><br />
** <code>sound/</code><br />
** <code>translation/</code><br />
** <code>ui/</code><br />
* <code>src/</code><br />
** <code>engine/</code> Engine source code.<br />
*** <code>asm/</code><br />
*** <code>client/</code><br />
*** <code>null/</code><br />
*** <code>qcommon/</code> Common code: utility functions, typedefs, macros, and the like.<br />
*** <code>renderer/</code> Vanilla (fixed-function pipeline) renderer<br />
*** <code>rendererGL/</code> Modern XReal-based renderer<br />
*** <code>server/</code><br />
*** <code>sys/</code><br />
** <code>gamelogic/</code> Code that falls outside the scope of the core engine. These are all run in separate [[virtual machines]].<br />
*** <code>cgame/</code> Client-side game code.<br />
*** <code>game/</code> Server-side game code.<br />
*** <code>ui/</code> User interface code.<br />
<br />
==Program Entry Point==<br />
<br />
The <code>main</code> function may be found at around line 591 of {{SourceFile|src/engine/sys/sys_main.c}}. Note that some magic happens on the Mac in {{SourceFile|src/engine/sys/SDLMain.m}}.<br />
<br />
==Lag Compensation==<br />
<br />
Daemon uses Neil "haste" Toronto's [http://www.ra.is/unlagged/ Unlagged mod].<br />
<br />
==Data Files==<br />
<br />
Daemon uses a variety of file formats. Many of these formats are custom. <!-- just try and provide a dump of all configuration files, then I'll reorganize them --><br />
<br />
* Bot behavior trees<br />
* Player configuration files<br />
** Crosshair configuration<br />
** Pubkey<br />
** GUID<br />
* Server configuration files<br />
** [[Map_layouts|Map layouts]]<br />
** Map rotations<br />
* Particle & trail system files<br />
* Sound configurations<br />
** [[Music_and_sounds#Buildables|Buildables]]<br />
* Model data ([[Exporting_Models#What_is_MD5.3F|discussion of supported formats]])<br />
** Skins<br />
** [[Exporting_Models#MD3_3|MD3 animation configuration files]] &mdash; specify which frames are for which animations<br />
** Configuration files<br />
*** [[Exporting_Models#Buildables_2|Buildables]]<br />
*** [[Exporting_Models#Weapons_2|Weapons]]<br />
*** [[Exporting_Models#Player_models_2|Player models]]<br />
* Map data<br />
** Map geometry (BSPs)<br />
** Color grading configurations<br />
<br />
==Game Logic==<br />
<br />
Game logic is split into three areas: user interface, server-side, and client-side. Each runs in its own [[Virtual_machines|virtual machine]].<br />
<br />
==Client-Side==<br />
<br />
Buildable information is encapsulated in the <code>cg_buildables</code> array (declared in {{SourceFile|src/gamelogic/cgame/cg_main.c|cg_main.c}})<br />
<br />
Constants used to define gamelogic variables are in {{SourceFile|src/gamelogic/game/tremulous.h}}.<br />
<br />
Types:<br />
* <code>buildableInfo_t</code> &mdash; Encapsulates data associated with buildables (sounds, animations, etc.).<br />
* <code>buildable_t</code> &mdash; An enumeration of all buildable types.<br />
* <code>buildableAttributes_t</code> &mdash; Encapsulates gameplay information associated with buildables. There is an array of these called <code>bg_buildableList</code>.<br />
<br />
==Server-Side==<br />
<br />
Server game state initialization occurs in <code>G_InitGame()</code> in {{SourceFile|src/gamelogic/game/g_main.c}}.<br />
<br />
==Particle &amp; Trail System==<br />
<br />
For now, please see the [http://tremulous.net/manual/#x1-130003.2 Tremulous documentation].<br />
<br />
==GL3 Renderer==<br />
<br />
Source code for the modern OpenGL renderer is located in {{SourceFile|src/engine/rendererGL}}. This renderer is often referred to as the "GL3" renderer, whereas the legacy renderer (found in {{SourceFile|src/engine/renderer}}) is often referred to as the "vanilla" renderer.<br />
<br />
===Notes===<br />
<br />
* There is some (highly experimental and untested) Direct X code mixed in the modern OpenGL renderer code.<br />
Shaders are implemented as subclasses of the <code>GLShader</code> class. All are defined in {{SourceFile|src/engine/rendererGL/gl_shader.h}}.<br />
* Compiled GLSL shader files (located in the hard-coded location <code>"glsl/"</code> with the <code>.bin</code> filename extension) are read by <code>GLShader::LoadShaderBinary()</code>.<br />
* All possible parameters (what OpenGL calls [http://www.opengl.org/sdk/docs/man4/xhtml/glUniform.xml "uniform variables"]) that may be passed to a shader are enumerated in the <code>shaderProgram_t</code> structure in {{SourceFile|src/engine/rendererGL/tr_local.h}}.<br />
* Shaders with duplicate functionality is achieved with multiple inheritance. E.g., <code>gl_genericShader</code> is of type <code>GLShader_generic*</code> which derives from the following classes:<br />
** <code>GLShader</code><br />
** <code>u_ColorMap</code><br />
** <code>u_ColorTextureMatrix</code><br />
** <code>u_ViewOrigin</code><br />
** <code>u_AlphaTest</code><br />
** <code>u_ModelMatrix</code><br />
** <code>u_ModelViewProjectionMatrix</code><br />
** <code>u_ColorModulate</code><br />
** <code>u_Color</code><br />
** <code>u_BoneMatrix</code><br />
** <code>u_VertexInterpolation</code><br />
** <code>u_PortalPlane</code><br />
** <code>GLDeformStage</code><br />
** <code>GLCompileMacro_USE_PORTAL_CLIPPING</code><br />
** <code>GLCompileMacro_USE_ALPHA_TESTING</code><br />
** <code>GLCompileMacro_USE_VERTEX_SKINNING</code><br />
** <code>GLCompileMacro_USE_VERTEX_ANIMATION</code><br />
** <code>GLCompileMacro_USE_DEFORM_VERTEXES</code><br />
** <code>GLCompileMacro_USE_TCGEN_ENVIRONMENT</code><br />
** <code>GLCompileMacro_USE_TCGEN_LIGHTMAP</code><br />
* GLSL shaders may be found in <code>main/glsl/</code>. Please see the [[GLSL Shaders|full article]] for a complete listing.<br />
<br />
===Helper Classes===<br />
<br />
As mentioned above, shader classes make use of multiple inheritance to give them the relevant methods for controlling their behavior.<br />
<br />
====Uniform Variables====<br />
<br />
Uniform variables are enumerated in the <code>shaderProgram_t</code> structure in {{SourceFile|src/engine/rendererGL/tr_local.h}}, and are controlled by classes beginning with the <code>u_</code> prefix:<br />
<br />
* u_BoneMatrix &mdash; Provides the convenience method <code>SetUniform_BoneMatrix</code>.<br />
<br />
====Compile Macros====<br />
<br />
* <code>GLCompileMacro_USE_ALPHA_TESTING</code><br />
* <code>GLCompileMacro_USE_PORTAL_CLIPPING</code><br />
* <code>GLCompileMacro_USE_FRUSTUM_CLIPPING</code><br />
* <code>GLCompileMacro_USE_VERTEX_SKINNING</code><br />
* <code>GLCompileMacro_USE_VERTEX_ANIMATION</code><br />
* <code>GLCompileMacro_USE_DEFORM_VERTEXES</code><br />
* <code>GLCompileMacro_USE_TCGEN_ENVIRONMENT</code><br />
* <code>GLCompileMacro_USE_TCGEN_LIGHTMAP</code><br />
* <code>GLCompileMacro_USE_NORMAL_MAPPING</code><br />
* <code>GLCompileMacro_USE_PARALLAX_MAPPING</code><br />
* <code>GLCompileMacro_USE_REFLECTIVE_SPECULAR</code><br />
* <code>GLCompileMacro_TWOSIDED</code><br />
* <code>GLCompileMacro_EYE_OUTSIDE</code><br />
* <code>GLCompileMacro_BRIGHTPASS_FILTER</code><br />
* <code>GLCompileMacro_LIGHT_DIRECTIONAL</code><br />
* <code>GLCompileMacro_USE_SHADOWING</code><br />
* <code>GLCompileMacro_USE_GBUFFER</code><br />
<br />
===Resources===<br />
<br />
Mac OS X users with XCode installed can access OpenGL man pages via the terminal. <!-- TODO: discuss how to get these on windows or linux? --><br />
<br />
Alternatively, OpenGL API reference documentation is available online:<br />
* [http://www.opengl.org/sdk/docs/man3/ OpenGL 3.3 Reference Pages]<br />
* [http://www.opengl.org/sdk/docs/manglsl/ OpenGL Shading Language (GLSL) Reference Pages]<br />
* [http://www.khronos.org/files/opengl-quick-reference-card.pdf OpenGL 3.3 &amp; GLSL Quick Reference Card]<br />
<br />
==Valgrind and fglrx==<br />
<br />
fglrx drivers cause Valgrind to spew out a lot of false errors. You can suppress these by using the --suppressions=/path/to/file.supp flag. You must pass the full path (no use of the tilde symbol). The following [http://www.mediafire.com/?z6ehwrxpw2m469h file] can be used as a template for your suppression file. Keep in mind that the location of the fglrx library may need to be changed.<br />
<br />
==Resources==<br />
<br />
===Publications===<br />
<br />
<ul><br />
<li>[http://halo.bungie.net/Inside/publications.aspx Bungie, Inc.] &mdash; creators of the Marathon, Myth, and Halo franchises.</li><br />
<li>[http://dice.se/publications/ DICE SE] &mdash; creators of the Battlefield franchise.</li><br />
<li>[http://www.guerrilla-games.com/publications/ Guerilla Games] &mdash; creators of the Killzone franchise.<br />
<p>Also of interest is the "Making of Killzone 2" video series, not listed on their site:</p><br />
* [http://www.ign.com/videos/2009/01/27/killzone-2-ps3-the-making-of-killzone-2-part-1?objectid=748475 Part 1]<br />
* [http://www.ign.com/videos/2009/01/27/killzone-2-ps3-the-making-of-killzone-2-part-2?objectid=748475 Part 2]<br />
* [http://www.ign.com/videos/2009/01/27/killzone-2-ps3-the-making-of-killzone-2-part-3?objectid=748475 Part 3]<br />
* [http://www.ign.com/videos/2009/01/27/killzone-2-ps3-the-making-of-killzone-2-part-4?objectid=748475 Part 4]<br />
</li><br />
<li>[http://www.valvesoftware.com/company/publications.html Valve Software] &mdash; creators of the Half-Life franchise.</li><br />
</ul><br />
<br />
===General Game Development===<br />
<br />
* [http://devmaster.net/ Devmaster.net]<br />
<br />
===OpenGL===<br />
<br />
* [http://www.opengl.org/ Official OpenGL page]<br />
* [http://www.opengl.org/sdk/docs/man3/ OpenGL 3.3 Reference Pages]<br />
* [http://www.opengl.org/sdk/docs/manglsl/ OpenGL Shading Language Reference Pages]<br />
* [http://arcsynthesis.org/gltut/ Learning Modern 3D Graphics Programming]<br />
<br />
===Quake===<br />
<br />
* [http://fd.fabiensanglard.net/doom3/pdfs/johnc-plan_1999.pdf John Carmack's notes from development]<br />
* "Looking at the Quake 3 Source"<br />
** [http://element61.blogspot.com/2005/08/looking-at-quake-3-source-part-1.html Part 1]<br />
** [http://element61.blogspot.com/2005/08/looking-at-quake-3-source-part-2.html Part 2]<br />
** [http://element61.blogspot.com/2005/09/looking-at-quake-3-source-part-3.html Part 3]<br />
* [http://www.quakewiki.net/archives/code3arena/ Code3Arena]<br />
* [http://www.modwiki.net/wiki/MD5_(file_format) MD5 file format]<br />
* [http://tfc.duke.free.fr/coding/md5-specs-en.html Another MD5 format article]<br />
* [http://fabiensanglard.net/quake3/index.php Quake 3 Source Code Review]<br />
* [http://www.quake3world.com/forum/index.php Quake3World Discussion Forums]<br />
* [http://wiki.ioquake3.org/ ioquake3 project wiki] &mdash; Primarily oriented for users, developers and server administrators.</div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Tools&diff=1975Tools2013-04-17T00:32:38Z<p>Velociostrich: Add information pertaining to other software packages.</p>
<hr />
<div>Unvanquished has a number of tools to assist developers in creating content.<br />
<br />
* {{Subpage|Chameleon}} is a stand-alone application to assist mappers in changing textures. (Work in progress)<br />
* {{Subpage|Archipelago}} is a web-based utility to rearrange UV islands in a model either to minimize texture sheet usage or to make room for new geometry. (Work in progress)<br />
<br />
In addition to these tools, information pertinent to using third-party tools to create content for Unvanquished is available on this wiki as well:<br />
<br />
* [[Blender]]<br />
* [[Mapping|Radiant]] (all variants)<br />
<br />
Documentation for the following tools as is relevant to creating content for Unvanquished may be written at some point in the future:<br />
<br />
* 3ds Max<br />
* The GIMP<br />
* Maya<br />
* Photoshop<br />
* ZBrush<br />
<br />
These tools are currently being used by or have been used by members of the team in the past for work on Unvanquished. It is less likely that documentation will be written for proprietary software packages due to typically steep licensing fees.</div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Tech_overview&diff=1974Tech overview2013-04-17T00:29:21Z<p>Velociostrich: /* What engine do we use? */ Add some other Q3-based games to the list</p>
<hr />
<div>This page provides an overview of the engine to give artists a basic understanding of how the engine works, with an emphasis of how the engine's capabilities affects their workflow.<br />
<br />
==General information==<br />
<br />
===What engine do we use?===<br />
<br />
Unvanquished uses the Daemon engine, which is a fork of OpenWolf, which is a fork of ET:XreaL, which is in turn a fork of XreaL, which is in turn a fork of ioQuake3, which is in turn a fork of Quake 3. While you do not need to know all this, the important thing to take away is that if you find information about any of these engines, the same information probably also applies here. <br />
<br />
The following games also use a Quake 3 derived engine for which mod tools are available:<br />
<br />
* Call of Duty<br />
* Call of Duty: United Offensive<br />
* Call of Duty 2<br />
* Call of Duty 4: Modern Warfare<br />
* Call of Duty: World at War<br />
* Call of Duty: Black Ops<br />
* Return to Castle Wolfenstein<br />
* Soldier of Fortune II: Double Helix<br />
* Tremulous<br />
* Urban Terror<br />
* Wolfenstein: Enemy Territory<br />
<br />
As such, information on these games may apply here as well.<br />
<br />
It is important to note that in inheriting from XreaL, our engine has a modern rendering architecture. While not all features of this architecture are stable or fully implemented, you should keep this in mind when creating content. Polygon counts and texture sizes, for example, may be larger than if you were creating content for Quake 3.<br />
<br />
===How does the engine load data?===<br />
<br />
Data is stored in pk3 files, directories with a <code>.pk3dir</code> extension, or ordinary directories.<br />
<br />
This is discussed in the [[Packaging game data]] page.<br />
<br />
==Modeling==<br />
<br />
===What model formats are supported?===<br />
<br />
{{SupportedModelFormats}}<br />
<br />
===How do I get a model into the game?===<br />
<br />
Please see the [[Exporting_Models|exporting guide]].<br />
<br />
==What sound formats are supported?==<br />
<br />
Sound file locations are dependent on the type of sound that is being added to the game. Some of these sounds are fixed whereas others are set by configuration files. Please see the [[Music and sounds]] page for more information.<br />
<br />
==Texturing==<br />
<br />
===What texture formats are supported?===<br />
<br />
Please see the [[Texture creation]] page for more information.</div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Compiling_the_source&diff=1973Compiling the source2013-04-16T00:16:19Z<p>Velociostrich: /* Instructions */ Correct the information on DLL dependencies.</p>
<hr />
<div>==Mac OS X==<br />
<br />
First, you need to [[Getting_the_source|acquire the source code]].<br />
<br />
Regardless of what interface you may use to compile the source, you will need [http://www.cmake.org/cmake/resources/software.html CMake] to generate makefiles. You will also need to install [https://developer.apple.com/xcode/ Xcode] (making sure to choose to install the command-line utilities when prompted by the installer).<br />
<br />
Then, you will need to acquire (and in some cases, manually compile) at a minimum the [[#Dependencies|necessary libraries]].<br />
<br />
Once you have the source code and the libraries installed, you may actually proceed to compile the source. You have several options:<br />
* '''Compile the source at the command line'''. This is the easiest if you would just like to compile the game to use yourself and you do not intend to work on the code.<br />
* '''Compile the source using an IDE'''. This is preferred if you intend on developing the source.<br />
** Xcode is Apple's flagship IDE and you should have installed to compile the source regardless of which method you use.<br />
** [http://qt-project.org/downloads QtCreator] is cross-platform and provides real-time feedback of syntax errors, a Vim mode, as well as other features.<br />
** [http://www.codeblocks.org/ Code::Blcoks] is also cross-platform but lacks some of the features of Xcode and QtCreator.<br />
<br />
===Dependencies===<br />
<br />
You only need to use one of the following methods (HomeBrew or compiling by hand). Please try and avoid mixing methods as this may produce unexpected results.<br />
<br />
Unvanquished requires the following libraries:<br />
* [[#JPEG|JPEG]], version 8 or higher. (Version 6 was known to have problems)<br />
* [[#Simple_DirectMedia_Layer_.28SDL.29|Simple DirectMedia Layer]] (The binary provided by libsdl.org causes graphical corruptions. Compile from source or use homebrew/macports)<br />
* [[#The_OpenGL_Extension_Wrangler_Library_.28GLEW.29|The OpenGL Extension Wrangler Library]]<br />
* CuRL<br />
* [[#The_GNU_MP_Bignum_Library_.28libgmp.29|GMP]]<br />
* [[#WebP|WebP]] (v0.2.0 or newer)<br />
<br />
The following libraries are optional:<br />
* Theora<br />
* Speex<br />
* [[#Ogg|Ogg]]<br />
* [[#Vorbis|Vorbis]]<br />
<br />
====HomeBrew====<br />
Install [http://mxcl.github.com/homebrew/ HomeBrew] and then run the following command<br />
<br />
$ brew install nettle libjpeg curl sdl webp xvid gmp glew speex libvorbis theora<br />
<br />
All the necessary libraries should now have been installed.<br />
<br />
====Compiling by hand====<br />
The following are shell scripts that download, compile, and install various libraries. This is more time consuming then other methods but might be useful if you need more control over your libraries<br />
<br />
=====JPEG=====<br />
<br />
$ curl http://www.ijg.org/files/jpegsrc.v8d.tar.gz > jpegsrc.v8d.tar.gz<br />
$ tar xvzf jpegsrc.v8d.tar.gz<br />
$ cd jpeg-8d<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The OpenGL Extension Wrangler Library (GLEW)=====<br />
<br />
$ curl -L https://sourceforge.net/projects/glew/files/glew/1.7.0/glew-1.7.0.tgz/download > glew-1.7.0.tgz<br />
$ tar xvzf glew-1.7.0.tgz<br />
$ cd glew-1.7.0<br />
$ make<br />
$ sudo make install<br />
<br />
=====Simple DirectMedia Layer (SDL)=====<br />
<br />
Do not use the binaries provided by libsdl.org, as these are known to cause issues with gamma and color display. Instead, compile your own:<br />
<br />
$ curl http://www.libsdl.org/release/SDL-1.2.15.tar.gz > SDL-1.2.15.tar.gz<br />
$ tar xvzf SDL-1.2.15.tar.gz<br />
$ cd SDL-1.2.15<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The GNU MP Bignum Library (libgmp)=====<br />
<br />
$ curl ftp://ftp.gmplib.org/pub/gmp-5.0.5/gmp-5.0.5.tar.bz2 > gmp-5.0.5.tar.bz2<br />
$ tar xvjf gmp-5.0.5.tar.bz2<br />
$ cd gmp-5.0.5<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Ogg=====<br />
<br />
$ curl http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz > libogg-1.3.0.tar.gz<br />
$ tar xvzf libogg-1.3.0.tar.gz<br />
$ cd libogg-1.3.0<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Vorbis=====<br />
<br />
$ curl http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz > libvorbis-1.3.3.tar.gz<br />
$ tar xvzf libvorbis-1.3.3.tar.gz<br />
$ cd libvorbis-1.3.3<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====WebP=====<br />
<br />
You do not need to compile WebP by hand; Google provides binaries for Mac OS X available from their [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0-mac-10.5.tar.gz project page]. You will need version 0.2.0 or newer.<br />
<br />
Once downloaded, you must still install the header files and the binary:<br />
<br />
$ curl https://webp.googlecode.com/files/libwebp-0.2.0-mac-10.5.tar.gz > libwebp-0.2.0-mac-10.5.tar.gz<br />
$ tar xvzf libwebp-0.2.0-mac-10.5.tar.gz<br />
$ cd libwebp-0.2.0-mac-10.5<br />
$ sudo cp include/webp /usr/local/include<br />
$ sudo cp lib/libwebp.a /usr/local/lib<br />
<br />
===Configuring with CMake===<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 should be a different directory.<br />
# Hit "Configure". You will be prompted as to which generator you would like to use. If you have Xcode installed, choose that. Wait while the configuration process runs. You may have to set the following:<br />
## If CMake did not find your jpeg headers for some reason, set <code>JPEG_INCLUDE_DIR</code> to <code>/path/to/Unvanquished/src/libs/jpeg</code>.<br />
## Check <code>USE_INTERNAL_CRYPTO</code> to avoid having to compile nettle and hogweed yourself.<br />
## Check <code>USE_INTERNAL_SPEEX</code> to avoid having to compile Speex yourself.<br />
## Uncheck <code>USE_CIN_THEORA</code> and <code>USE_CIN_XVID</code> to avoid having to compile Theora or Xvid. (At present, there are not cutscenes or any such that require it.)<br />
## '''You will probably not be able to compile with the GLSL optimizer enabled; uncheck <code>USE_GLSL_OPTIMIZER</code>'''<br />
## If you have selected to generate Xcode project files, make the <code>SDLMAIN_LIBRARY</code> field blank. This option is not available if you have the generator set to Unix makefiles.<br />
# Hit "Generate".<br />
# You may now close CMake.<br />
<br />
===Compiling===<br />
<br />
====With Xcode====<br />
<br />
<ol><br />
<li>Compilation will fail unless you manually create certain directories needed by the build scripts:<br />
<pre><br />
$ cd /path/to/build/dir/CMakeFiles<br />
$ mkdir gpp{game,trem,ui}-qvm.dir<br />
</pre><br />
This is a workaround to {{Issue|101}}.<br />
</li><br />
<li>Either start Xcode and open the project file (in the build directory you specified) or double-click the project file in Finder.</li><br />
<li>Open the project file created by CMake, which should be in the build directory you specified.</li><br />
<li>Change the active target to "ALL_BUILD" and click Product&rarr;Build.</li><br />
</ol><br />
<br />
====With Unix Makefiles====<br />
<br />
<ul><br />
<li>Start Terminal (Applications &rarr; Utilities &rarr; Terminal).</li><br />
<li>Input the following commands:<br />
<pre><br />
$ cd /path/to/Unvanquished-build<br />
$ make<br />
</pre><br />
If you are on a multi-core or multi-processor machine, you may speed up the process by passing the <code>-j</code> argument followed by the number of available cores to <code>make</code>; e.g., <code>make -j4</code>. Note that doing so makes reading error messages more difficult, as multiple instances of the compiler will print to the screen at once, causing information to appear out of order.<br />
</li><br />
</ul><br />
<br />
===Testing the build===<br />
<br />
====With Xcode 4====<br />
<br />
To test the game, select the "client" scheme from the combo box on the toolbar, and click the run button or press {{Hotkey|MacCommand}}{{Hotkey|R}}.<br />
<br />
====With Unix Makefiles====<br />
<br />
After compiling, you'll have to place the data files in the <code>main</code> directory in your build directory. [[#Acquiring the Game Files|For download instructions, see below.]]<br />
<br />
Your file structure should look as follows:<br />
<br />
[[File:Build_dir_Mac_OS_X.png]]<br />
<br />
You may now start the application as such:<br />
<br />
$ ./daemon.i386<br />
<br />
Note that older machines will not support the new OpenGL 3 renderer, and must be started specifying the "vanilla" (aka "GL") renderer:<br />
<br />
$ ./daemon.i386 +set cl_renderer GL<br />
<br />
===Bundling the Application===<br />
<br />
====With CPack====<br />
<br />
CPack is able to create standalone bundles (as well as many other types of installers). However you must generate the files using Unix Makefiles instead of Xcode.<br />
<br />
$ cd /path/to/Unvanquished-build<br />
$ cpack -G Bundle<br />
<br />
Some warnings will be printed however these can be safely ignored. There should be a file called Unvanquished.dmg in the Unvanquished-build folder.<br />
<br />
====Manually====<br />
<br />
{{Note|header=Important|content=<br />
Please be aware that these instructions are very much out of date, and may not work. Also note that the dynamic library bundler does '''not''' work as intended and although you will be able to run your build on your machine, it will most likely not work on other machines. It is strongly suggested that you compile the source using Xcode.<br />
}}<br />
<br />
You'll find the Mac [http://macdylibbundler.sourceforge.net/ dynamic library bundler] to be quite useful (you must generate the files using Unix Makefiles instead of Xcode):<br />
<br />
$ curl -L http://sourceforge.net/projects/macdylibbundler/files/macdylibbundler/0.4.1/dylibbundler0.4.1.zip/download > \<br />
dylibbundler0.4.1.zip<br />
$ unzip dylibbundler0.4.1.zip<br />
$ cd dylibbundler<br />
$ make<br />
$ sudo make install<br />
<br />
Once you've done that, you can proceed to create the application bundle. Note that these steps assume that you have downloaded the data files to <code>main/</code> as shown above:<br />
<br />
<pre><br />
$ git=/path/to/Unvanquished-git-repo<br />
$ build=/path/to/Unvanquished-build-dir<br />
$ mkdir -pv Unvanquished.app/Contents/{libs,MacOS,Resources,Frameworks}<br />
$ cp -r $build/main Unvanquished.app/Contents/MacOS<br />
$ sips -s format tiff $git/debian/unvanquished.png --out temp.tiff<br />
$ tiff2icns temp.tiff Unvanquished.app/Contents/Resources/Unvanquished.icns<br />
$ rm temp.tiff<br />
$ cp $build/daemon{,ded}.i386 $build/*.dylib Unvanquished.app/Contents/MacOS<br />
$ cp -r /Library/Frameworks/SDL.framework Unvanquished.app/Contents/Frameworks<br />
$ install_name_tool -id \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/Frameworks/SDL.framework/Versions/A/SDL<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGLi386.dylib<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGL3i386.dylib<br />
$ for binary in Unvanquished.app/Contents/MacOS/*.{i386,dylib}; do<br />
dylibbundler -b -x $binary -d $dest/Unvanquished.app/Contents/libs/; done<br />
$ cp /usr/lib/libGLEW.1.7.0.dylib ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ chmod +w ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -id @executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -change /usr/lib/libGLEW.1.7.0.dylib \<br />
@executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ cat > Unvanquished.app/Contents/Info.plist<br />
<?xml version="1.0" encoding="UTF-8"?><br />
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"<br />
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"><br />
<plist version="1.0"><br />
<dict><br />
<key>CFBundleName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleDisplayName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleExecutable</key><br />
<string>daemon.i386</string><br />
<key>CFBundleIconFile</key><br />
<string>Unvanquished.icns</string><br />
<key>CFBundleIdentifier</key><br />
<string>net.Unvanquished</string><br />
<key>CFBundleInfoDictionaryVersion</key><br />
<string>6.0</string><br />
<key>CFBundlePackageType</key><br />
<string>APPL</string><br />
<key>CFBundleShortVersionString</key><br />
<string>0.4.0</string><br />
<key>CFBundleVersion</key><br />
<string>0.4.0</string><br />
</dict><br />
</plist><br />
^d<br />
</pre><br />
<br />
Note: <code>^d</code> indicates pressing {{Hotkey|Ctrl}}{{Hotkey|D}} on the keyboard.<br />
<br />
The contents of the completed application bundle should look like this:<br />
<br />
[[File:Bundle_dir_Mac_OS_X.png]]<br />
<br />
'''Note''': If you compiled SDL from source, you will not see a directory titled <code>SDL.framework</code>.<br />
<br />
==Windows==<br />
<br />
===Visual Studio===<br />
<br />
CMake can generate Visual Studio projects for Unvanquished.<br />
<br />
# Run the <code>Visual_Studio32.bat</code> batch script in your source directory by double-clicking it. Alternatively, you may use the <code>Visual_Studio64.bat</code> shell script if you have the [http://www.microsoft.com/en-us/download/details.aspx?id=8279 Windows 7 SDK] installed and a 64-bit system.<br />
# Open <code>build-32/Daemon.sln</code> in Visual Studio 2010.<br />
# In the two text boxes in the toolbar, select "Release" or "Debug" in the first one and Win32 in the second one<br />
# Press {{Hotkey|F5}} to build solution and run application, or just use Build &rarr; Build Solution to compile the code.<br />
<br />
====Important Notes====<br />
<br />
* LLVM is disabled and does not work correctly with CMake generated Visual Studio projects.<br />
* ncurses is not supported under Visual Studio.<br />
* The path to the build folder must not have any spaces otherwise generation of QVMs will fail. See {{Issue|102}}.<br />
* Due to limitations with CMake, neither the startup project nor the working directory can be specified. These must be set manually to debug the client with Visual Studio:<br />
** Right click on client and select "Set as StartUp project".<br />
** Right click on client, select properties, select Debugging and set "Working Directory" to <code>$(TargetPath)\..</code>.<br />
<br />
===MinGW===<br />
<br />
It is possible to build Unvanquished with MinGW, although the process is rather arduous compared to Visual Studio or compiling for other platforms. Currently, you will also need [http://cygwin.com/setup.exe Cygwin] to build the GMP library as well.<br />
<br />
====Notes====<br />
<br />
* The easiest way to acquire and install MinGW is with the graphical [http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/ mingw-get-inst installer]. At a minimum, you will need to install the C and C++ compilers. <!-- TODO: maybe walk the user through the installer? --><br />
* When configuring the build with CMake, you will find that you will have to set a number of libraries manually. You can find precompiled DLLs for most of the dependencies; those that are not pre-compiled can be built with the corresponding <code>USE_INTERNAL_</code> setting.<br />
* '''The build will fail during QVM compilation if your source or build directories contain spaces.''' This is due to a bug with lcc. If your home directory contains a space, you may want to create source and build directories at the root of one of your drives (e.g., <code>C:\Unvanquished\Source</code> and <code>C:\Unvanquished\Build</code>.)<br />
<br />
====Instructions====<br />
<br />
The easiest way to get a build up (at the time of writing) is as follows:<br />
<br />
{{Note|content=Although there are 64-bit binaries of most of the libraries required to build the game, these do not work with MinGW at present, so the following instructions all use the 32-bit binaries.}}<br />
<br />
<ol><br />
<li>You will need to download and install some version of the DirectX SDK to compile the source. You may download the June 2010 release from [http://www.microsoft.com/en-us/download/details.aspx?id=6812 Microsoft].</li><br />
<li>Although there are binaries of gmp distributed with the source, they have are dependent on Visual Studio's implementations of <code>_ftol2_sse</code> and <code>_alloca_probe_16</code>. A fix may be found on [http://stackoverflow.com/questions/6753111/static-linking-with-openssl Stack Exchange], but requires that Visual Studio be installed, which defeats the purpose of attempting to use MinGW to compile the source. You can build gmp yourself:<br />
<ol><br />
<li>Download and extract the latest version of the [http://gmplib.org/ GNU MP Bignum Library (GMP)]. (You will need either cygwin with tar and bz2 installed or 7-zip to extract the archive.)</li><br />
<li>Install the following Cygwin packages if you have not already:<br />
* binutils<br />
* gcc<br />
* gcc-g++<br />
* m4<br />
* make<br />
</li><br />
<li>As part of the GMP compilation process, a file called <code>gen-fib.c</code> generates a table of numbers in the Fibonacci sequence. The generated file does not play nicely with Cygwin or MinGW, so you must fix it. Edit <code>gen-fib.c</code>, and at around line 100, change these lines<br />
<pre><br />
for (i = 0; i < fnum; i++)<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
printf ("), /* %d */\n", i-1);<br />
}<br />
printf ("};\n");<br />
</pre><br />
to look like this:<br />
<pre><br />
for (i = 0; i < fnum; i++)<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
printf (")%c /* %d */\n", (i == (fnum-1)) ? ' ' : ',', i-1);<br />
}<br />
printf ("};\n");<br />
</pre><br />
The patch file looks like this:<br />
<pre><br />
@@ -100,7 +100,7 @@<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
- printf ("), /* %d */\n", i-1);<br />
+ printf (")%c /* %d */\n", (i == (fnum-1)) ? ' ' : ',', i-1);<br />
}<br />
printf ("};\n");<br />
}<br />
</pre><br />
</li><br />
<li>Compiling with MinGW does not work, so you will need to compile with Cygwin. At the prompt:<br />
<pre><br />
$ ./configure --disable-static --enable-shared<br />
$ make<br />
</pre><br />
The <code>--disable-static</code> and <code>--enable-shared</code> flags configure GMP to build a DLL instead of a static library. You may optionally perform <code>make install</code>. Additional compilation instructions [http://www.cs.nyu.edu/exact/core/gmp/ are available].<br />
<p>If you experience difficulties with compilation and it appears that MinGW gcc is being detected by <code>configure</code> and not Cygwin gcc, you can try editing your <code>PATH</code> variable:</p><br />
<pre><br />
$ export PATH=`echo $PATH | sed "s|/cygdrive/c/MinGW/bin:||"`<br />
</pre><br />
Re-run <code>configure</code> and <code>make</code> afterwards.<br />
</ol><br />
</li><br />
<li>Download the [http://www.libsdl.org/release/SDL-1.2.15-win32.zip latest stable version] of SDL for Windows. Extract the archive and copy <code>SDL.dll</code> from it to the root of your build directory.</li><br />
<li>Set the following CMake flags:<br />
{| class="wikitable"<br />
! Setting<br />
! Description<br />
! Type<br />
! Value<br />
|-<br />
| <code>USE_INTERNAL_CRYPTO</code><br />
| Use the provided copies of crypto libraries. <!-- FIXME: I think these are nettle and something else --><br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_GLEW</code><br />
| Use the provided copy of GLEW.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_JPEG</code><br />
| Use the provided copy of JPEG.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SDL</code><br />
| Use the provided copy of SDL.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SPEEX</code><br />
| Use the provided copy of Speex.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_WEBP</code><br />
| Use the provided copy of WebP.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_CURSES</code><br />
| Enables/disables curses.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>PNG_LIBRARY</code><br />
| Path to the PNG library DLL.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng/libs/win32/libpng.lib</code><br />
|-<br />
| <code>PNG_PNG_INCLUDE_DIR</code><br />
| Path to the PNG library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng</code><br />
|-<br />
| <code>FREETYPE_LIBRARY</code><br />
| Path to the compiled FreeType library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/lib/freetype.lib</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_freetype2</code><br />
| Path to the FreeType library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/freetype2</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_ft2build</code><br />
| Path to the FreeType library file "ftbuild.h".<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/</code><br />
|-<br />
| <code>GMP_INCLUDE_DIR</code><br />
| Path to the GMP library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/gmp/include</code><br />
|-<br />
| <code>GMP_LIBRARY</code><br />
| Path to the GMP library.<br />
| <code>FILEPATH</code><br />
| <code><var>path/to/compiled/gmp/</var>.libs/cyggmp-10.dll</code><br />
|-<br />
| <code>ZLIB_INCLUDE_DIR</code><br />
| Path to the zlib library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/include</code><br />
|-<br />
| <code>ZLIB_LIBRARY</code><br />
| Path to the zlib library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/lib/x32/zlib1.dll</code><br />
|-<br />
| <code>CURL_LIBRARY</code><br />
| Path to the CURL library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/lib/win32/release/libcurl.dll</code><br />
|-<br />
| <code>CURL_INCLUDE_DIR</code><br />
| Path to the zlib library.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/include/curl</code><br />
|-<br />
| <code>USE_OPENAL</code><br />
| Enables/disables OpenAL support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_THEORA</code><br />
| Enables/disables Theora support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_XVID</code><br />
| Enables/disables Xvid support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CODEC_THEORA</code><br />
| Enables/disables Ogg support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>SDL_LIBRARY</code><br />
| The path to the SDL DLL.<br />
| <code>FILEPATH</code><br />
| <code><var>BuildPath</var>/SDL.dll</code><br />
|-<br />
| <code>SDLMAIN_LIBRARY</code><br />
| Enables/disables Ogg support.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code><br />
|-<br />
|}<br />
Do note that CMake is slash-direction&ndash;agnostic; it can handle both forward- and backslashes on Windows.<br />
<p>If you would like to compile a debug build, change <code>CMAKE_RELEASE_TYPE</code> from <code>Release</code> to <code>Debug</code>.</p><br />
</li><br />
<li>Open <code><var>SourcePath</var>/CMakeLists.txt</code> and edit the line<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi z )<br />
</pre><br />
(around line 1040) to look like this:<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi )<br />
</pre><br />
Also edit around line 1700:<br />
<pre><br />
###########################<br />
#Configure Download Script#<br />
###########################<br />
<br />
if( NOT MSVC )<br />
</pre><br />
to look like this:<br />
<pre><br />
###########################<br />
#Configure Download Script#<br />
###########################<br />
<br />
if( NOT WIN32 )<br />
</pre><br />
</li><br />
<li>Open <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code> and edit the lines:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "SDL.h"<br />
#include "SDL_main.h"<br />
</pre><br />
to look like:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "../../../include/SDL.h"<br />
#include "../../../include/SDL_main.h"<br />
</pre><br />
<li>Open a command prompt and <code>cd</code> to your source directory.</li><br />
<li>Run <code>make</code>:<br />
<pre><br />
> mingw32-make<br />
</pre><br />
If you would like verbose output, set the <code>VERBOSE</code> environment variable before running <code>make</code>.<br />
<pre><br />
> set VERBOSE=1<br />
</pre><br />
To make it easier to build the source, you can create a batch file (call it something like <code>compile.bat</code>) and place it in your build directory:<br />
<pre><br />
@echo off<br />
<br />
set RETURN=compile<br />
<br />
:get_time<br />
:: Thank you, Rob van der Woude:<br />
:: (http://www.robvanderwoude.com/datetimentparse.php)<br />
FOR /F "tokens=1,2,3 delims=:." %%A IN ("%Time%") DO (<br />
SET /A HOURS = 100%%A %% 100<br />
SET /A MINUTES = 100%%B %% 100<br />
SET /A SECONDS = 100%%C %% 100<br />
)<br />
SET /A TICKS=( %HOURS% * 3600 ) + ( %MINUTES% * 60 ) + %SECONDS%<br />
GOTO %RETURN%<br />
<br />
:compile<br />
SET START_TICKS=%TICKS%<br />
<br />
SET VERBOSE=1<br />
:: mingw32-make clean<br />
mingw32-make -j4<br />
<br />
set RETURN=finish<br />
GOTO get_time<br />
<br />
:finish<br />
SET /A COMPILE_TIME=%TICKS% - %START_TICKS%<br />
SET /A MINUTES=%COMPILE_TIME% / 60<br />
SET /A SECONDS=%COMPILE_TIME% %% 60<br />
ECHO.<br />
ECHO Compilation took %MINUTES%m %SECONDS%s.<br />
PAUSE<br />
</pre><br />
</li><br />
<li>Once compilation finishes, you will find that the game will fail to run due to DLL dependencies. To resolve these:<br />
<ul><br />
<li>You will need to move <code>INTERNAL_GLEW</code> from the <code>Release/</code> folder of the build directory to the root of the build directory.</li><br />
<li>You will need to place the following other DLLs in your build directory:<br />
* freetype6.dll<br />
* libcurl.dll<br />
* libpng14-14.dll<br />
* zlib1.dll<br />
If the renderer's DLL dependencies are not met, you will be informed that the game failed to load a renderer. If you receive an error stating that the application failed to start at all, then you are likely missing some version of the Microsoft Visual C runtime redistributable.<br />
<p>You may find that you also need these DLLs (if you configured your build differently):</p><br />
* libbz2.dll<br />
* libogg.dll<br />
* libtheora.dll<br />
* libvorbis.dll<br />
* libvorbisfile.dll<br />
* msvcr100.dll<br />
* msvcr100d.dll<br />
* zlibwapi.dll<br />
The easiest way to obtain these DLLs is by copying them from the installation directory of an [http://sourceforge.net/projects/unvanquished/files/latest/download official release] of Unvanquished.<br />
</li><br />
<li>You will need to copy your compiled DLL of GMP to your build directory. It may be found in <code><var>path/to/compiled/gmp/</var>.libs/cyggmp-10.dll</code>.</li><br />
<li>As you compiled GMP with Cygwin, it in turn depends on <code>cygwin1.dll</code>, which may typically be found in <code>C:\cygwin\bin\</code>. Copy and paste it into your build directory.</li><br />
</ul><br />
Once you have completed these steps, you should never have to do them again.<br />
</li><br />
</ol><br />
<br />
====Notes====<br />
<br />
* If you would like to use curses, try using [http://sourceforge.net/projects/pdcurses/files/pdcurses PDCurses].<br />
<br />
===QtCreator===<br />
<br />
# Install MinGW and follow the above instructions, except select Code::Blocks as the generator.<br />
# Start QtCreator, and select "Open File or Project&hellip;" from the File menu.<br />
# Navigate to your source directory and open CMakeLists.txt.<br />
# At the CMake Wizard, select the same build directory you already configured using CMake. (If you did not chose Code::Blocks as the generator, you will have to start over again, as QtCreator requires a Code::Blocks project file in order to compile the source.)<br />
# Ensure that a generator is selected in the combo box, and click "Run CMake". If there is no generator listed, see the [[#Troubleshooting|troubleshooting]] section below.<br />
# Click "Finish" to close the wizard.<br />
<br />
You should now be able to compile, run, and debug the code using QtCreator.<br />
<br />
====Troubleshooting====<br />
<br />
If at the "Run CMake" prompt of the the CMake Wizard, select "Run CMake" and are warned that no generator was selected, and notice that there are no generators in the combo box, you will likely have to [http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html manually configure your toolchain]. Select "Options&hellip;" from the "Tools" menu, then navigate to "Build &amp; Run".<br />
<br />
At the options window,<br />
* Go to the "Kits" tab, and mouse over the "Desktop (default)" kit under "Manual". If there were any errors in configuring this kit, they will be displayed in the tool tip. If there are problems, select the kit. You may need to manually specify the location of the MinGW debugger, for example, which is typically <code>C:\MinGW\bin\gdb.exe</code>.<br />
* Go to the "Compilers" tab, and ensure that MinGW is present. If not, you will need to add it manually.<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 />
libgmp3-dev libjpeg8-dev libncurses5-dev libogg-dev libopenal-dev \<br />
libpng12-dev libsdl1.2-dev libvorbis-dev zlib1g-dev nettle-dev \<br />
libwebp-dev libspeexdsp-dev libtheora-dev<br />
<br />
If the version of WebP supplied by your version of Debian or Ubuntu is older than v0.2.0, you will need to [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0.tar.gz download] and [https://developers.google.com/speed/webp/docs/compiling#unix compile it from source]. After compiling and installing with <code>sudo make install</code>, in CMake, you'll need to set <code>WEBP_INCLUDE_DIR</code> to <code>/usr/local/include/webp</code> and <code>WEBP_LIBRARY</code> to <code>/usr/local/lib/libwebp.so</code>.<br />
<br />
'''We currently provide a ready-to-use libwebp-dev in our [http://{{SERVERNAME}}/index.php/Download#ubuntu Debian and Ubuntu repositories], alongside .debs of the game and server.'''<br />
<br />
Actual dev package names may vary, e.g. libgmp-dev instead of libgmp3-dev and libglew-dev or libglew1.7-dev instead of libglew1.5-dev.<br />
<br />
Since we have a debian directory in the source, you can also to check what's needed then install the listed packages (choosing from alternatives as needed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ dpkg-checkbuilddeps<br />
…<br />
$ sudo apt-get install <var>package(s)</var><br />
<br />
If dpkg-checkbuilddeps produces no output, you have all necessary build dependencies. Also, debhelper's only needed if you're building .debs.<br />
<br />
====Gentoo====<br />
<br />
$ emerge curl freetype glew gmp jpeg ncurses libogg openal libpng libsdl libvorbis zlib<br />
<br />
====openSUSE====<br />
<br />
$ sudo install zypper gcc gcc-c++ Mesa-libGL-devel SDL-devel libjpeg8-devel \<br />
libpng12-devel glew-devel webp-devel ncurses-devel gmp-devel libcurl-devel \<br />
libnettle-devel openal-soft-devel speex-devel libvorbis-devel \<br />
libtheora-devel<br />
<br />
The latest version of WebP must be installed manually:<br />
<br />
$ wget https://webp.googlecode.com/files/libwebp-0.2.1.tar.gz<br />
$ tar xvzf libwebp-0.2.1.tar.gz<br />
$ cd libwebp-0.2.1<br />
$ ./configure && make<br />
$ sudo make install<br />
<br />
You must disable curses (set <code>USE_CURSES</code> appropriately in CMake) as failing to do so will cause Unvanquished to crash on startup.<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 />
On Debian or 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 />
Or, in Debian or Ubuntu, you can build a package (but you'll need to have devscripts and fakeroot installed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ fakeroot dpkg-buildpackage -b -uc<br />
$ sudo dpkg -i <var>../unvanquished_*.deb</var><br />
<br />
Once in <code>ccmake</code>, use the following keys:<br />
<br />
* Press {{Hotkey|c}} to configure. If an error occurs during this phase, make note of it and press {{Hotkey|e}} to dismiss it.<br />
* Use the up and down arrow keys to navigate the compilation options.<br />
* Press {{Hotkey|Enter}} to enable or disable boolean options (i.e., on/off) or to edit textual options.<br />
** Press {{Hotkey|Esc}} when editing a textual option to cancel the change.<br />
<br />
Once you have finished the configuration process, press {{Hotkey|C}} again, then {{Hotkey|G}} 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=====<br />
<br />
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_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 />
* <code>USE_CIN_THEORA</code> &mdash; Disabling this prevents videos from being recorded in Theora.<br />
* <code>USE_CIN_XVID</code> &mdash; Disabling this prevents videos from being recorded in Xvid.<br />
* <code>USE_VOIP</code> &mdash; Disabling this removes VOIP support. Alternatively enabling <code>USE_INTERNAL_SPEEX</code> will use the libraries distributed with Unvanquished for VoIP<br />
* <code>USE_INTERNAL_CRYPTO</code> &mdash; Enable this to use the crypto libraries provided by Unvanquished.<br />
<br />
===Compiling===<br />
<br />
$ cd <var>path/to/unvanquished/build</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 />
===Acquiring mandatory game files===<br />
<br />
The game files are not in the Git repository, and must be downloaded separately. This may be done on the command line or from your web browser. The downloads may be found on [http://sourceforge.net/projects/unvanquished/files/Assets SourceForge.net]. If you download the files from your browser, just download the files named "pak*.pk3", and save them to the [[Running_the_game#Data_locations|data location]] for your system.<br />
<br />
On Linux, this may be done as follows:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
wget -O $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On FreeBSD, using the <code>sh</code> shell:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
fetch -r -o $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On Mac OS X:<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
curl -L "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download" > $file<br />
fi<br />
done<br />
<br />
Linux users may also use the <code>download-pk3.sh</code> script that is distributed with the source code, which requires that curl be installed:<br />
<br />
$ cd <var>[path to Unvanquished source code]</var><br />
$ mkdir -p ~/.Unvanquished/main<br />
$ ./download-pk3.sh ~/.Unvanquished/main<br />
<br />
===Downloading the map pack===<br />
<br />
The map pack exists only for convenience; if you do not download the map pack, Unvanquished will automatically download maps as needed when you attempt to play online.<br />
<br />
To download the map pack on Linux:<br />
<br />
$ wget -O maps.7z "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z"; done<br />
<br />
To download the map pack on Mac OS X:<br />
<br />
$ curl -L "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z" > maps.7z; done<br />
<br />
Note that you will need to unzip the map pack on either system as it is compressed with LZMA. Mac users can use the [http://wakaba.c3.cx/s/apps/unarchiver.html Unarchiver]. Uncompressing the archive on Linux is highly dependent on your distribution.<br />
<br />
===Verifying the Files===<br />
<br />
Download the latest [http://sourceforge.net/projects/unvanquished/files/Assets/{{CurrentVersion|MD5HashFile}} MD5 hash file] and save it to your system's [[Running_the_game#Data_directory|data location]].<br />
<br />
On systems with the <code>md5</code> command (Mac OS X):<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ cat {{CurrentVersion|MD5HashFile}} | while read line; do<br />
file="`echo "$line" | sed -E "s/^[a-fA-F0-9]+ +\*?//"`"<br />
if [ -e "$file" ]; then<br />
if [ `md5 -r "$file" | cut -d\ -f1` = "`echo "$line" | cut -d\ -f1`" ]<br />
then echo "File \"$file\" appears okay."<br />
else echo "File \"$file\" is corrupt"'!' >&2<br />
fi; fi; done<br />
<br />
On systems with the <code>md5sum</code> command (most Linux distributions):<br />
<br />
$ cd <var>[[Running_the_game#Data_directory|/path/to/data/files]]</var><br />
$ md5sum -c {{CurrentVersion|MD5HashFile}} 2>&1 | grep -v "open or read\|file or directory"<br />
<br />
The <code>grep</code> invocation is used to strip output complaining about missing files.<br />
<br />
Any files that are found to be corrupt should be replaced; just download a [http://sourceforge.net/projects/unvanquished/files/Assets new copy] of the affected file(s).<br />
<br />
==Errors==<br />
<br />
===CMake cannot locate Newton===<br />
<br />
If CMake cannot find Newton, you'll need to set it up yourself.<br />
<br />
It should be in <code><var>/path/to/Unvanquished</var>/src/libs/libnewton/libs/<var>your_os</var>/libNewton.so</code>.<br />
Be sure to replace <var>your_os</var> with the proper directory name.<br />
<br />
Use CMake as before to change the <code>NEWTON_LIBRARY</code> build setting to the said path:<br />
<br />
# Start the CMake configurator:<pre>$ ccmake ..</pre><br />
# Scroll down and highlight <code>NEWTON_LIBRARY</code>.<br />
# Press {{Hotkey|Enter}} to begin editing and input in the path.<br />
# Press {{Hotkey|C}} to configure and {{Hotkey|G}} to generate the new makefiles.<br />
# Press {{Hotkey|Q}} to quit.<br />
# Recompile the source:<pre>$ make</pre><br />
<br />
===The C Compiler is not able to compile a simple test program===<br />
<br />
When attempting to generate a solution for Xcode CMake fails with the following error<br />
-- Check for working C compiler using: Xcode -- broken<br />
CMake Error at /Applications/CMake 2.8-8.app/Contents/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):<br />
The C compiler "/usr/bin/gcc" is not able to compile a simple test program.<br />
<br />
It fails with the following output:<br />
<br />
Change Dir: /Users/danielmaloney/Documents/Unvanquished/build-xcode/CMakeFiles/CMakeTmp<br />
<br />
<br />
<br />
Run Build Command:/Applications/CMake\ 2.8-8.app/Contents/bin/cmakexbuild<br />
-project CMAKE_TRY_COMPILE.xcodeproj build -target<br />
cmTryCompileExec1400153232 -configuration Debug<br />
<br />
Error: No developer directory found at /Developer. Run<br />
/usr/bin/xcode-select to update the developer directory path.<br />
<br />
<br />
<br />
<br />
<br />
CMake will not be able to correctly generate this project.<br />
Call Stack (most recent call first):<br />
CMakeLists.txt:19 (project)<br />
<br />
This is due to Xcode 4.3 having a different directory structure to previous versions. Simply running the following command will correct this error:<br />
sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer/</div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Compiling_the_source&diff=1972Compiling the source2013-04-15T22:18:25Z<p>Velociostrich: /* MinGW */ Move the note about downloading DirectX to the compilation instructions, add a note on what compiler components must be installed.</p>
<hr />
<div>==Mac OS X==<br />
<br />
First, you need to [[Getting_the_source|acquire the source code]].<br />
<br />
Regardless of what interface you may use to compile the source, you will need [http://www.cmake.org/cmake/resources/software.html CMake] to generate makefiles. You will also need to install [https://developer.apple.com/xcode/ Xcode] (making sure to choose to install the command-line utilities when prompted by the installer).<br />
<br />
Then, you will need to acquire (and in some cases, manually compile) at a minimum the [[#Dependencies|necessary libraries]].<br />
<br />
Once you have the source code and the libraries installed, you may actually proceed to compile the source. You have several options:<br />
* '''Compile the source at the command line'''. This is the easiest if you would just like to compile the game to use yourself and you do not intend to work on the code.<br />
* '''Compile the source using an IDE'''. This is preferred if you intend on developing the source.<br />
** Xcode is Apple's flagship IDE and you should have installed to compile the source regardless of which method you use.<br />
** [http://qt-project.org/downloads QtCreator] is cross-platform and provides real-time feedback of syntax errors, a Vim mode, as well as other features.<br />
** [http://www.codeblocks.org/ Code::Blcoks] is also cross-platform but lacks some of the features of Xcode and QtCreator.<br />
<br />
===Dependencies===<br />
<br />
You only need to use one of the following methods (HomeBrew or compiling by hand). Please try and avoid mixing methods as this may produce unexpected results.<br />
<br />
Unvanquished requires the following libraries:<br />
* [[#JPEG|JPEG]], version 8 or higher. (Version 6 was known to have problems)<br />
* [[#Simple_DirectMedia_Layer_.28SDL.29|Simple DirectMedia Layer]] (The binary provided by libsdl.org causes graphical corruptions. Compile from source or use homebrew/macports)<br />
* [[#The_OpenGL_Extension_Wrangler_Library_.28GLEW.29|The OpenGL Extension Wrangler Library]]<br />
* CuRL<br />
* [[#The_GNU_MP_Bignum_Library_.28libgmp.29|GMP]]<br />
* [[#WebP|WebP]] (v0.2.0 or newer)<br />
<br />
The following libraries are optional:<br />
* Theora<br />
* Speex<br />
* [[#Ogg|Ogg]]<br />
* [[#Vorbis|Vorbis]]<br />
<br />
====HomeBrew====<br />
Install [http://mxcl.github.com/homebrew/ HomeBrew] and then run the following command<br />
<br />
$ brew install nettle libjpeg curl sdl webp xvid gmp glew speex libvorbis theora<br />
<br />
All the necessary libraries should now have been installed.<br />
<br />
====Compiling by hand====<br />
The following are shell scripts that download, compile, and install various libraries. This is more time consuming then other methods but might be useful if you need more control over your libraries<br />
<br />
=====JPEG=====<br />
<br />
$ curl http://www.ijg.org/files/jpegsrc.v8d.tar.gz > jpegsrc.v8d.tar.gz<br />
$ tar xvzf jpegsrc.v8d.tar.gz<br />
$ cd jpeg-8d<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The OpenGL Extension Wrangler Library (GLEW)=====<br />
<br />
$ curl -L https://sourceforge.net/projects/glew/files/glew/1.7.0/glew-1.7.0.tgz/download > glew-1.7.0.tgz<br />
$ tar xvzf glew-1.7.0.tgz<br />
$ cd glew-1.7.0<br />
$ make<br />
$ sudo make install<br />
<br />
=====Simple DirectMedia Layer (SDL)=====<br />
<br />
Do not use the binaries provided by libsdl.org, as these are known to cause issues with gamma and color display. Instead, compile your own:<br />
<br />
$ curl http://www.libsdl.org/release/SDL-1.2.15.tar.gz > SDL-1.2.15.tar.gz<br />
$ tar xvzf SDL-1.2.15.tar.gz<br />
$ cd SDL-1.2.15<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The GNU MP Bignum Library (libgmp)=====<br />
<br />
$ curl ftp://ftp.gmplib.org/pub/gmp-5.0.5/gmp-5.0.5.tar.bz2 > gmp-5.0.5.tar.bz2<br />
$ tar xvjf gmp-5.0.5.tar.bz2<br />
$ cd gmp-5.0.5<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Ogg=====<br />
<br />
$ curl http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz > libogg-1.3.0.tar.gz<br />
$ tar xvzf libogg-1.3.0.tar.gz<br />
$ cd libogg-1.3.0<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Vorbis=====<br />
<br />
$ curl http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz > libvorbis-1.3.3.tar.gz<br />
$ tar xvzf libvorbis-1.3.3.tar.gz<br />
$ cd libvorbis-1.3.3<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====WebP=====<br />
<br />
You do not need to compile WebP by hand; Google provides binaries for Mac OS X available from their [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0-mac-10.5.tar.gz project page]. You will need version 0.2.0 or newer.<br />
<br />
Once downloaded, you must still install the header files and the binary:<br />
<br />
$ curl https://webp.googlecode.com/files/libwebp-0.2.0-mac-10.5.tar.gz > libwebp-0.2.0-mac-10.5.tar.gz<br />
$ tar xvzf libwebp-0.2.0-mac-10.5.tar.gz<br />
$ cd libwebp-0.2.0-mac-10.5<br />
$ sudo cp include/webp /usr/local/include<br />
$ sudo cp lib/libwebp.a /usr/local/lib<br />
<br />
===Configuring with CMake===<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 should be a different directory.<br />
# Hit "Configure". You will be prompted as to which generator you would like to use. If you have Xcode installed, choose that. Wait while the configuration process runs. You may have to set the following:<br />
## If CMake did not find your jpeg headers for some reason, set <code>JPEG_INCLUDE_DIR</code> to <code>/path/to/Unvanquished/src/libs/jpeg</code>.<br />
## Check <code>USE_INTERNAL_CRYPTO</code> to avoid having to compile nettle and hogweed yourself.<br />
## Check <code>USE_INTERNAL_SPEEX</code> to avoid having to compile Speex yourself.<br />
## Uncheck <code>USE_CIN_THEORA</code> and <code>USE_CIN_XVID</code> to avoid having to compile Theora or Xvid. (At present, there are not cutscenes or any such that require it.)<br />
## '''You will probably not be able to compile with the GLSL optimizer enabled; uncheck <code>USE_GLSL_OPTIMIZER</code>'''<br />
## If you have selected to generate Xcode project files, make the <code>SDLMAIN_LIBRARY</code> field blank. This option is not available if you have the generator set to Unix makefiles.<br />
# Hit "Generate".<br />
# You may now close CMake.<br />
<br />
===Compiling===<br />
<br />
====With Xcode====<br />
<br />
<ol><br />
<li>Compilation will fail unless you manually create certain directories needed by the build scripts:<br />
<pre><br />
$ cd /path/to/build/dir/CMakeFiles<br />
$ mkdir gpp{game,trem,ui}-qvm.dir<br />
</pre><br />
This is a workaround to {{Issue|101}}.<br />
</li><br />
<li>Either start Xcode and open the project file (in the build directory you specified) or double-click the project file in Finder.</li><br />
<li>Open the project file created by CMake, which should be in the build directory you specified.</li><br />
<li>Change the active target to "ALL_BUILD" and click Product&rarr;Build.</li><br />
</ol><br />
<br />
====With Unix Makefiles====<br />
<br />
<ul><br />
<li>Start Terminal (Applications &rarr; Utilities &rarr; Terminal).</li><br />
<li>Input the following commands:<br />
<pre><br />
$ cd /path/to/Unvanquished-build<br />
$ make<br />
</pre><br />
If you are on a multi-core or multi-processor machine, you may speed up the process by passing the <code>-j</code> argument followed by the number of available cores to <code>make</code>; e.g., <code>make -j4</code>. Note that doing so makes reading error messages more difficult, as multiple instances of the compiler will print to the screen at once, causing information to appear out of order.<br />
</li><br />
</ul><br />
<br />
===Testing the build===<br />
<br />
====With Xcode 4====<br />
<br />
To test the game, select the "client" scheme from the combo box on the toolbar, and click the run button or press {{Hotkey|MacCommand}}{{Hotkey|R}}.<br />
<br />
====With Unix Makefiles====<br />
<br />
After compiling, you'll have to place the data files in the <code>main</code> directory in your build directory. [[#Acquiring the Game Files|For download instructions, see below.]]<br />
<br />
Your file structure should look as follows:<br />
<br />
[[File:Build_dir_Mac_OS_X.png]]<br />
<br />
You may now start the application as such:<br />
<br />
$ ./daemon.i386<br />
<br />
Note that older machines will not support the new OpenGL 3 renderer, and must be started specifying the "vanilla" (aka "GL") renderer:<br />
<br />
$ ./daemon.i386 +set cl_renderer GL<br />
<br />
===Bundling the Application===<br />
<br />
====With CPack====<br />
<br />
CPack is able to create standalone bundles (as well as many other types of installers). However you must generate the files using Unix Makefiles instead of Xcode.<br />
<br />
$ cd /path/to/Unvanquished-build<br />
$ cpack -G Bundle<br />
<br />
Some warnings will be printed however these can be safely ignored. There should be a file called Unvanquished.dmg in the Unvanquished-build folder.<br />
<br />
====Manually====<br />
<br />
{{Note|header=Important|content=<br />
Please be aware that these instructions are very much out of date, and may not work. Also note that the dynamic library bundler does '''not''' work as intended and although you will be able to run your build on your machine, it will most likely not work on other machines. It is strongly suggested that you compile the source using Xcode.<br />
}}<br />
<br />
You'll find the Mac [http://macdylibbundler.sourceforge.net/ dynamic library bundler] to be quite useful (you must generate the files using Unix Makefiles instead of Xcode):<br />
<br />
$ curl -L http://sourceforge.net/projects/macdylibbundler/files/macdylibbundler/0.4.1/dylibbundler0.4.1.zip/download > \<br />
dylibbundler0.4.1.zip<br />
$ unzip dylibbundler0.4.1.zip<br />
$ cd dylibbundler<br />
$ make<br />
$ sudo make install<br />
<br />
Once you've done that, you can proceed to create the application bundle. Note that these steps assume that you have downloaded the data files to <code>main/</code> as shown above:<br />
<br />
<pre><br />
$ git=/path/to/Unvanquished-git-repo<br />
$ build=/path/to/Unvanquished-build-dir<br />
$ mkdir -pv Unvanquished.app/Contents/{libs,MacOS,Resources,Frameworks}<br />
$ cp -r $build/main Unvanquished.app/Contents/MacOS<br />
$ sips -s format tiff $git/debian/unvanquished.png --out temp.tiff<br />
$ tiff2icns temp.tiff Unvanquished.app/Contents/Resources/Unvanquished.icns<br />
$ rm temp.tiff<br />
$ cp $build/daemon{,ded}.i386 $build/*.dylib Unvanquished.app/Contents/MacOS<br />
$ cp -r /Library/Frameworks/SDL.framework Unvanquished.app/Contents/Frameworks<br />
$ install_name_tool -id \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/Frameworks/SDL.framework/Versions/A/SDL<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGLi386.dylib<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGL3i386.dylib<br />
$ for binary in Unvanquished.app/Contents/MacOS/*.{i386,dylib}; do<br />
dylibbundler -b -x $binary -d $dest/Unvanquished.app/Contents/libs/; done<br />
$ cp /usr/lib/libGLEW.1.7.0.dylib ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ chmod +w ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -id @executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -change /usr/lib/libGLEW.1.7.0.dylib \<br />
@executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ cat > Unvanquished.app/Contents/Info.plist<br />
<?xml version="1.0" encoding="UTF-8"?><br />
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"<br />
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"><br />
<plist version="1.0"><br />
<dict><br />
<key>CFBundleName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleDisplayName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleExecutable</key><br />
<string>daemon.i386</string><br />
<key>CFBundleIconFile</key><br />
<string>Unvanquished.icns</string><br />
<key>CFBundleIdentifier</key><br />
<string>net.Unvanquished</string><br />
<key>CFBundleInfoDictionaryVersion</key><br />
<string>6.0</string><br />
<key>CFBundlePackageType</key><br />
<string>APPL</string><br />
<key>CFBundleShortVersionString</key><br />
<string>0.4.0</string><br />
<key>CFBundleVersion</key><br />
<string>0.4.0</string><br />
</dict><br />
</plist><br />
^d<br />
</pre><br />
<br />
Note: <code>^d</code> indicates pressing {{Hotkey|Ctrl}}{{Hotkey|D}} on the keyboard.<br />
<br />
The contents of the completed application bundle should look like this:<br />
<br />
[[File:Bundle_dir_Mac_OS_X.png]]<br />
<br />
'''Note''': If you compiled SDL from source, you will not see a directory titled <code>SDL.framework</code>.<br />
<br />
==Windows==<br />
<br />
===Visual Studio===<br />
<br />
CMake can generate Visual Studio projects for Unvanquished.<br />
<br />
# Run the <code>Visual_Studio32.bat</code> batch script in your source directory by double-clicking it. Alternatively, you may use the <code>Visual_Studio64.bat</code> shell script if you have the [http://www.microsoft.com/en-us/download/details.aspx?id=8279 Windows 7 SDK] installed and a 64-bit system.<br />
# Open <code>build-32/Daemon.sln</code> in Visual Studio 2010.<br />
# In the two text boxes in the toolbar, select "Release" or "Debug" in the first one and Win32 in the second one<br />
# Press {{Hotkey|F5}} to build solution and run application, or just use Build &rarr; Build Solution to compile the code.<br />
<br />
====Important Notes====<br />
<br />
* LLVM is disabled and does not work correctly with CMake generated Visual Studio projects.<br />
* ncurses is not supported under Visual Studio.<br />
* The path to the build folder must not have any spaces otherwise generation of QVMs will fail. See {{Issue|102}}.<br />
* Due to limitations with CMake, neither the startup project nor the working directory can be specified. These must be set manually to debug the client with Visual Studio:<br />
** Right click on client and select "Set as StartUp project".<br />
** Right click on client, select properties, select Debugging and set "Working Directory" to <code>$(TargetPath)\..</code>.<br />
<br />
===MinGW===<br />
<br />
It is possible to build Unvanquished with MinGW, although the process is rather arduous compared to Visual Studio or compiling for other platforms. Currently, you will also need [http://cygwin.com/setup.exe Cygwin] to build the GMP library as well.<br />
<br />
====Notes====<br />
<br />
* The easiest way to acquire and install MinGW is with the graphical [http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/ mingw-get-inst installer]. At a minimum, you will need to install the C and C++ compilers. <!-- TODO: maybe walk the user through the installer? --><br />
* When configuring the build with CMake, you will find that you will have to set a number of libraries manually. You can find precompiled DLLs for most of the dependencies; those that are not pre-compiled can be built with the corresponding <code>USE_INTERNAL_</code> setting.<br />
* '''The build will fail during QVM compilation if your source or build directories contain spaces.''' This is due to a bug with lcc. If your home directory contains a space, you may want to create source and build directories at the root of one of your drives (e.g., <code>C:\Unvanquished\Source</code> and <code>C:\Unvanquished\Build</code>.)<br />
<br />
====Instructions====<br />
<br />
The easiest way to get a build up (at the time of writing) is as follows:<br />
<br />
{{Note|content=Although there are 64-bit binaries of most of the libraries required to build the game, these do not work with MinGW at present, so the following instructions all use the 32-bit binaries.}}<br />
<br />
<ol><br />
<li>You will need to download and install some version of the DirectX SDK to compile the source. You may download the June 2010 release from [http://www.microsoft.com/en-us/download/details.aspx?id=6812 Microsoft].</li><br />
<li>Although there are binaries of gmp distributed with the source, they have are dependent on Visual Studio's implementations of <code>_ftol2_sse</code> and <code>_alloca_probe_16</code>. A fix may be found on [http://stackoverflow.com/questions/6753111/static-linking-with-openssl Stack Exchange], but requires that Visual Studio be installed, which defeats the purpose of attempting to use MinGW to compile the source. You can build gmp yourself:<br />
<ol><br />
<li>Download and extract the latest version of the [http://gmplib.org/ GNU MP Bignum Library (GMP)]. (You will need either cygwin with tar and bz2 installed or 7-zip to extract the archive.)</li><br />
<li>Install the following Cygwin packages if you have not already:<br />
* binutils<br />
* gcc<br />
* gcc-g++<br />
* m4<br />
* make<br />
</li><br />
<li>As part of the GMP compilation process, a file called <code>gen-fib.c</code> generates a table of numbers in the Fibonacci sequence. The generated file does not play nicely with Cygwin or MinGW, so you must fix it. Edit <code>gen-fib.c</code>, and at around line 100, change these lines<br />
<pre><br />
for (i = 0; i < fnum; i++)<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
printf ("), /* %d */\n", i-1);<br />
}<br />
printf ("};\n");<br />
</pre><br />
to look like this:<br />
<pre><br />
for (i = 0; i < fnum; i++)<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
printf (")%c /* %d */\n", (i == (fnum-1)) ? ' ' : ',', i-1);<br />
}<br />
printf ("};\n");<br />
</pre><br />
The patch file looks like this:<br />
<pre><br />
@@ -100,7 +100,7 @@<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
- printf ("), /* %d */\n", i-1);<br />
+ printf (")%c /* %d */\n", (i == (fnum-1)) ? ' ' : ',', i-1);<br />
}<br />
printf ("};\n");<br />
}<br />
</pre><br />
</li><br />
<li>Compiling with MinGW does not work, so you will need to compile with Cygwin. At the prompt:<br />
<pre><br />
$ ./configure --disable-static --enable-shared<br />
$ make<br />
</pre><br />
The <code>--disable-static</code> and <code>--enable-shared</code> flags configure GMP to build a DLL instead of a static library. You may optionally perform <code>make install</code>. Additional compilation instructions [http://www.cs.nyu.edu/exact/core/gmp/ are available].<br />
<p>If you experience difficulties with compilation and it appears that MinGW gcc is being detected by <code>configure</code> and not Cygwin gcc, you can try editing your <code>PATH</code> variable:</p><br />
<pre><br />
$ export PATH=`echo $PATH | sed "s|/cygdrive/c/MinGW/bin:||"`<br />
</pre><br />
Re-run <code>configure</code> and <code>make</code> afterwards.<br />
</ol><br />
</li><br />
<li>Download the [http://www.libsdl.org/release/SDL-1.2.15-win32.zip latest stable version] of SDL for Windows. Extract the archive and copy <code>SDL.dll</code> from it to the root of your build directory.</li><br />
<li>Set the following CMake flags:<br />
{| class="wikitable"<br />
! Setting<br />
! Description<br />
! Type<br />
! Value<br />
|-<br />
| <code>USE_INTERNAL_CRYPTO</code><br />
| Use the provided copies of crypto libraries. <!-- FIXME: I think these are nettle and something else --><br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_GLEW</code><br />
| Use the provided copy of GLEW.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_JPEG</code><br />
| Use the provided copy of JPEG.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SDL</code><br />
| Use the provided copy of SDL.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SPEEX</code><br />
| Use the provided copy of Speex.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_WEBP</code><br />
| Use the provided copy of WebP.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_CURSES</code><br />
| Enables/disables curses.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>PNG_LIBRARY</code><br />
| Path to the PNG library DLL.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng/libs/win32/libpng.lib</code><br />
|-<br />
| <code>PNG_PNG_INCLUDE_DIR</code><br />
| Path to the PNG library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng</code><br />
|-<br />
| <code>FREETYPE_LIBRARY</code><br />
| Path to the compiled FreeType library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/lib/freetype.lib</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_freetype2</code><br />
| Path to the FreeType library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/freetype2</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_ft2build</code><br />
| Path to the FreeType library file "ftbuild.h".<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/</code><br />
|-<br />
| <code>GMP_INCLUDE_DIR</code><br />
| Path to the GMP library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/gmp/include</code><br />
|-<br />
| <code>GMP_LIBRARY</code><br />
| Path to the GMP library.<br />
| <code>FILEPATH</code><br />
| <code><var>path/to/compiled/gmp/</var>.libs/cyggmp-10.dll</code><br />
|-<br />
| <code>ZLIB_INCLUDE_DIR</code><br />
| Path to the zlib library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/include</code><br />
|-<br />
| <code>ZLIB_LIBRARY</code><br />
| Path to the zlib library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/lib/x32/zlib1.dll</code><br />
|-<br />
| <code>CURL_LIBRARY</code><br />
| Path to the CURL library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/lib/win32/release/libcurl.dll</code><br />
|-<br />
| <code>CURL_INCLUDE_DIR</code><br />
| Path to the zlib library.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/include/curl</code><br />
|-<br />
| <code>USE_OPENAL</code><br />
| Enables/disables OpenAL support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_THEORA</code><br />
| Enables/disables Theora support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_XVID</code><br />
| Enables/disables Xvid support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CODEC_THEORA</code><br />
| Enables/disables Ogg support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>SDL_LIBRARY</code><br />
| The path to the SDL DLL.<br />
| <code>FILEPATH</code><br />
| <code><var>BuildPath</var>/SDL.dll</code><br />
|-<br />
| <code>SDLMAIN_LIBRARY</code><br />
| Enables/disables Ogg support.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code><br />
|-<br />
|}<br />
Do note that CMake is slash-direction&ndash;agnostic; it can handle both forward- and backslashes on Windows.<br />
<p>If you would like to compile a debug build, change <code>CMAKE_RELEASE_TYPE</code> from <code>Release</code> to <code>Debug</code>.</p><br />
</li><br />
<li>Open <code><var>SourcePath</var>/CMakeLists.txt</code> and edit the line<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi z )<br />
</pre><br />
(around line 1040) to look like this:<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi )<br />
</pre><br />
Also edit around line 1700:<br />
<pre><br />
###########################<br />
#Configure Download Script#<br />
###########################<br />
<br />
if( NOT MSVC )<br />
</pre><br />
to look like this:<br />
<pre><br />
###########################<br />
#Configure Download Script#<br />
###########################<br />
<br />
if( NOT WIN32 )<br />
</pre><br />
</li><br />
<li>Open <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code> and edit the lines:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "SDL.h"<br />
#include "SDL_main.h"<br />
</pre><br />
to look like:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "../../../include/SDL.h"<br />
#include "../../../include/SDL_main.h"<br />
</pre><br />
<li>Open a command prompt and <code>cd</code> to your source directory.</li><br />
<li>Run <code>make</code>:<br />
<pre><br />
> mingw32-make<br />
</pre><br />
If you would like verbose output, set the <code>VERBOSE</code> environment variable before running <code>make</code>.<br />
<pre><br />
> set VERBOSE=1<br />
</pre><br />
To make it easier to build the source, you can create a batch file (call it something like <code>compile.bat</code>) and place it in your build directory:<br />
<pre><br />
@echo off<br />
<br />
set RETURN=compile<br />
<br />
:get_time<br />
:: Thank you, Rob van der Woude:<br />
:: (http://www.robvanderwoude.com/datetimentparse.php)<br />
FOR /F "tokens=1,2,3 delims=:." %%A IN ("%Time%") DO (<br />
SET /A HOURS = 100%%A %% 100<br />
SET /A MINUTES = 100%%B %% 100<br />
SET /A SECONDS = 100%%C %% 100<br />
)<br />
SET /A TICKS=( %HOURS% * 3600 ) + ( %MINUTES% * 60 ) + %SECONDS%<br />
GOTO %RETURN%<br />
<br />
:compile<br />
SET START_TICKS=%TICKS%<br />
<br />
SET VERBOSE=1<br />
:: mingw32-make clean<br />
mingw32-make -j4<br />
<br />
set RETURN=finish<br />
GOTO get_time<br />
<br />
:finish<br />
SET /A COMPILE_TIME=%TICKS% - %START_TICKS%<br />
SET /A MINUTES=%COMPILE_TIME% / 60<br />
SET /A SECONDS=%COMPILE_TIME% %% 60<br />
ECHO.<br />
ECHO Compilation took %MINUTES%m %SECONDS%s.<br />
PAUSE<br />
</pre><br />
</li><br />
<li>Once compilation finishes, you will find that the game will fail to run due to DLL dependencies. To resolve these:<br />
<ul><br />
<li>You will need to move <code>INTERNAL_GLEW</code> from the <code>Release/</code> folder of the build directory to the root of the build directory.</li><br />
<li>You will need to place the following other DLLs in your build directory:<br />
* freetype6.dll<br />
* libbz2.dll<br />
* libcurl.dll<br />
* libogg.dll<br />
* libpng14-14.dll<br />
* libtheora.dll<br />
* libvorbis.dll<br />
* libvorbisfile.dll<br />
* msvcr100.dll<br />
* msvcr100d.dll<br />
* zlib1.dll<br />
* zlibwapi.dll<br />
The easiest way to obtain these DLLs is by copying them from the installation directory of an [http://sourceforge.net/projects/unvanquished/files/latest/download official release] of Unvanquished.<br />
</li><br />
<li>You will need to copy your compiled DLL of GMP to your build directory. It may be found in <code><var>path/to/compiled/gmp/</var>.libs/cyggmp-10.dll</code>.</li><br />
<li>As you compiled GMP with Cygwin, it in turn depends on <code>cygwin1.dll</code>, which may typically be found in <code>C:\cygwin\bin\</code>. Copy and paste it into your build directory.</li><br />
</ul><br />
Once you have completed these steps, you should never have to do them again.<br />
</li><br />
</ol><br />
<br />
====Notes====<br />
<br />
* If you would like to use curses, try using [http://sourceforge.net/projects/pdcurses/files/pdcurses PDCurses].<br />
<br />
===QtCreator===<br />
<br />
# Install MinGW and follow the above instructions, except select Code::Blocks as the generator.<br />
# Start QtCreator, and select "Open File or Project&hellip;" from the File menu.<br />
# Navigate to your source directory and open CMakeLists.txt.<br />
# At the CMake Wizard, select the same build directory you already configured using CMake. (If you did not chose Code::Blocks as the generator, you will have to start over again, as QtCreator requires a Code::Blocks project file in order to compile the source.)<br />
# Ensure that a generator is selected in the combo box, and click "Run CMake". If there is no generator listed, see the [[#Troubleshooting|troubleshooting]] section below.<br />
# Click "Finish" to close the wizard.<br />
<br />
You should now be able to compile, run, and debug the code using QtCreator.<br />
<br />
====Troubleshooting====<br />
<br />
If at the "Run CMake" prompt of the the CMake Wizard, select "Run CMake" and are warned that no generator was selected, and notice that there are no generators in the combo box, you will likely have to [http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html manually configure your toolchain]. Select "Options&hellip;" from the "Tools" menu, then navigate to "Build &amp; Run".<br />
<br />
At the options window,<br />
* Go to the "Kits" tab, and mouse over the "Desktop (default)" kit under "Manual". If there were any errors in configuring this kit, they will be displayed in the tool tip. If there are problems, select the kit. You may need to manually specify the location of the MinGW debugger, for example, which is typically <code>C:\MinGW\bin\gdb.exe</code>.<br />
* Go to the "Compilers" tab, and ensure that MinGW is present. If not, you will need to add it manually.<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 />
libgmp3-dev libjpeg8-dev libncurses5-dev libogg-dev libopenal-dev \<br />
libpng12-dev libsdl1.2-dev libvorbis-dev zlib1g-dev nettle-dev \<br />
libwebp-dev libspeexdsp-dev libtheora-dev<br />
<br />
If the version of WebP supplied by your version of Debian or Ubuntu is older than v0.2.0, you will need to [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0.tar.gz download] and [https://developers.google.com/speed/webp/docs/compiling#unix compile it from source]. After compiling and installing with <code>sudo make install</code>, in CMake, you'll need to set <code>WEBP_INCLUDE_DIR</code> to <code>/usr/local/include/webp</code> and <code>WEBP_LIBRARY</code> to <code>/usr/local/lib/libwebp.so</code>.<br />
<br />
'''We currently provide a ready-to-use libwebp-dev in our [http://{{SERVERNAME}}/index.php/Download#ubuntu Debian and Ubuntu repositories], alongside .debs of the game and server.'''<br />
<br />
Actual dev package names may vary, e.g. libgmp-dev instead of libgmp3-dev and libglew-dev or libglew1.7-dev instead of libglew1.5-dev.<br />
<br />
Since we have a debian directory in the source, you can also to check what's needed then install the listed packages (choosing from alternatives as needed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ dpkg-checkbuilddeps<br />
…<br />
$ sudo apt-get install <var>package(s)</var><br />
<br />
If dpkg-checkbuilddeps produces no output, you have all necessary build dependencies. Also, debhelper's only needed if you're building .debs.<br />
<br />
====Gentoo====<br />
<br />
$ emerge curl freetype glew gmp jpeg ncurses libogg openal libpng libsdl libvorbis zlib<br />
<br />
====openSUSE====<br />
<br />
$ sudo install zypper gcc gcc-c++ Mesa-libGL-devel SDL-devel libjpeg8-devel \<br />
libpng12-devel glew-devel webp-devel ncurses-devel gmp-devel libcurl-devel \<br />
libnettle-devel openal-soft-devel speex-devel libvorbis-devel \<br />
libtheora-devel<br />
<br />
The latest version of WebP must be installed manually:<br />
<br />
$ wget https://webp.googlecode.com/files/libwebp-0.2.1.tar.gz<br />
$ tar xvzf libwebp-0.2.1.tar.gz<br />
$ cd libwebp-0.2.1<br />
$ ./configure && make<br />
$ sudo make install<br />
<br />
You must disable curses (set <code>USE_CURSES</code> appropriately in CMake) as failing to do so will cause Unvanquished to crash on startup.<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 />
On Debian or 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 />
Or, in Debian or Ubuntu, you can build a package (but you'll need to have devscripts and fakeroot installed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ fakeroot dpkg-buildpackage -b -uc<br />
$ sudo dpkg -i <var>../unvanquished_*.deb</var><br />
<br />
Once in <code>ccmake</code>, use the following keys:<br />
<br />
* Press {{Hotkey|c}} to configure. If an error occurs during this phase, make note of it and press {{Hotkey|e}} to dismiss it.<br />
* Use the up and down arrow keys to navigate the compilation options.<br />
* Press {{Hotkey|Enter}} to enable or disable boolean options (i.e., on/off) or to edit textual options.<br />
** Press {{Hotkey|Esc}} when editing a textual option to cancel the change.<br />
<br />
Once you have finished the configuration process, press {{Hotkey|C}} again, then {{Hotkey|G}} 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=====<br />
<br />
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_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 />
* <code>USE_CIN_THEORA</code> &mdash; Disabling this prevents videos from being recorded in Theora.<br />
* <code>USE_CIN_XVID</code> &mdash; Disabling this prevents videos from being recorded in Xvid.<br />
* <code>USE_VOIP</code> &mdash; Disabling this removes VOIP support. Alternatively enabling <code>USE_INTERNAL_SPEEX</code> will use the libraries distributed with Unvanquished for VoIP<br />
* <code>USE_INTERNAL_CRYPTO</code> &mdash; Enable this to use the crypto libraries provided by Unvanquished.<br />
<br />
===Compiling===<br />
<br />
$ cd <var>path/to/unvanquished/build</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 />
===Acquiring mandatory game files===<br />
<br />
The game files are not in the Git repository, and must be downloaded separately. This may be done on the command line or from your web browser. The downloads may be found on [http://sourceforge.net/projects/unvanquished/files/Assets SourceForge.net]. If you download the files from your browser, just download the files named "pak*.pk3", and save them to the [[Running_the_game#Data_locations|data location]] for your system.<br />
<br />
On Linux, this may be done as follows:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
wget -O $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On FreeBSD, using the <code>sh</code> shell:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
fetch -r -o $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On Mac OS X:<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
curl -L "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download" > $file<br />
fi<br />
done<br />
<br />
Linux users may also use the <code>download-pk3.sh</code> script that is distributed with the source code, which requires that curl be installed:<br />
<br />
$ cd <var>[path to Unvanquished source code]</var><br />
$ mkdir -p ~/.Unvanquished/main<br />
$ ./download-pk3.sh ~/.Unvanquished/main<br />
<br />
===Downloading the map pack===<br />
<br />
The map pack exists only for convenience; if you do not download the map pack, Unvanquished will automatically download maps as needed when you attempt to play online.<br />
<br />
To download the map pack on Linux:<br />
<br />
$ wget -O maps.7z "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z"; done<br />
<br />
To download the map pack on Mac OS X:<br />
<br />
$ curl -L "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z" > maps.7z; done<br />
<br />
Note that you will need to unzip the map pack on either system as it is compressed with LZMA. Mac users can use the [http://wakaba.c3.cx/s/apps/unarchiver.html Unarchiver]. Uncompressing the archive on Linux is highly dependent on your distribution.<br />
<br />
===Verifying the Files===<br />
<br />
Download the latest [http://sourceforge.net/projects/unvanquished/files/Assets/{{CurrentVersion|MD5HashFile}} MD5 hash file] and save it to your system's [[Running_the_game#Data_directory|data location]].<br />
<br />
On systems with the <code>md5</code> command (Mac OS X):<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ cat {{CurrentVersion|MD5HashFile}} | while read line; do<br />
file="`echo "$line" | sed -E "s/^[a-fA-F0-9]+ +\*?//"`"<br />
if [ -e "$file" ]; then<br />
if [ `md5 -r "$file" | cut -d\ -f1` = "`echo "$line" | cut -d\ -f1`" ]<br />
then echo "File \"$file\" appears okay."<br />
else echo "File \"$file\" is corrupt"'!' >&2<br />
fi; fi; done<br />
<br />
On systems with the <code>md5sum</code> command (most Linux distributions):<br />
<br />
$ cd <var>[[Running_the_game#Data_directory|/path/to/data/files]]</var><br />
$ md5sum -c {{CurrentVersion|MD5HashFile}} 2>&1 | grep -v "open or read\|file or directory"<br />
<br />
The <code>grep</code> invocation is used to strip output complaining about missing files.<br />
<br />
Any files that are found to be corrupt should be replaced; just download a [http://sourceforge.net/projects/unvanquished/files/Assets new copy] of the affected file(s).<br />
<br />
==Errors==<br />
<br />
===CMake cannot locate Newton===<br />
<br />
If CMake cannot find Newton, you'll need to set it up yourself.<br />
<br />
It should be in <code><var>/path/to/Unvanquished</var>/src/libs/libnewton/libs/<var>your_os</var>/libNewton.so</code>.<br />
Be sure to replace <var>your_os</var> with the proper directory name.<br />
<br />
Use CMake as before to change the <code>NEWTON_LIBRARY</code> build setting to the said path:<br />
<br />
# Start the CMake configurator:<pre>$ ccmake ..</pre><br />
# Scroll down and highlight <code>NEWTON_LIBRARY</code>.<br />
# Press {{Hotkey|Enter}} to begin editing and input in the path.<br />
# Press {{Hotkey|C}} to configure and {{Hotkey|G}} to generate the new makefiles.<br />
# Press {{Hotkey|Q}} to quit.<br />
# Recompile the source:<pre>$ make</pre><br />
<br />
===The C Compiler is not able to compile a simple test program===<br />
<br />
When attempting to generate a solution for Xcode CMake fails with the following error<br />
-- Check for working C compiler using: Xcode -- broken<br />
CMake Error at /Applications/CMake 2.8-8.app/Contents/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):<br />
The C compiler "/usr/bin/gcc" is not able to compile a simple test program.<br />
<br />
It fails with the following output:<br />
<br />
Change Dir: /Users/danielmaloney/Documents/Unvanquished/build-xcode/CMakeFiles/CMakeTmp<br />
<br />
<br />
<br />
Run Build Command:/Applications/CMake\ 2.8-8.app/Contents/bin/cmakexbuild<br />
-project CMAKE_TRY_COMPILE.xcodeproj build -target<br />
cmTryCompileExec1400153232 -configuration Debug<br />
<br />
Error: No developer directory found at /Developer. Run<br />
/usr/bin/xcode-select to update the developer directory path.<br />
<br />
<br />
<br />
<br />
<br />
CMake will not be able to correctly generate this project.<br />
Call Stack (most recent call first):<br />
CMakeLists.txt:19 (project)<br />
<br />
This is due to Xcode 4.3 having a different directory structure to previous versions. Simply running the following command will correct this error:<br />
sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer/</div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Compiling_the_source&diff=1971Compiling the source2013-04-15T22:11:46Z<p>Velociostrich: /* Manually */ Make note of the fact that the build instructions are outdated.</p>
<hr />
<div>==Mac OS X==<br />
<br />
First, you need to [[Getting_the_source|acquire the source code]].<br />
<br />
Regardless of what interface you may use to compile the source, you will need [http://www.cmake.org/cmake/resources/software.html CMake] to generate makefiles. You will also need to install [https://developer.apple.com/xcode/ Xcode] (making sure to choose to install the command-line utilities when prompted by the installer).<br />
<br />
Then, you will need to acquire (and in some cases, manually compile) at a minimum the [[#Dependencies|necessary libraries]].<br />
<br />
Once you have the source code and the libraries installed, you may actually proceed to compile the source. You have several options:<br />
* '''Compile the source at the command line'''. This is the easiest if you would just like to compile the game to use yourself and you do not intend to work on the code.<br />
* '''Compile the source using an IDE'''. This is preferred if you intend on developing the source.<br />
** Xcode is Apple's flagship IDE and you should have installed to compile the source regardless of which method you use.<br />
** [http://qt-project.org/downloads QtCreator] is cross-platform and provides real-time feedback of syntax errors, a Vim mode, as well as other features.<br />
** [http://www.codeblocks.org/ Code::Blcoks] is also cross-platform but lacks some of the features of Xcode and QtCreator.<br />
<br />
===Dependencies===<br />
<br />
You only need to use one of the following methods (HomeBrew or compiling by hand). Please try and avoid mixing methods as this may produce unexpected results.<br />
<br />
Unvanquished requires the following libraries:<br />
* [[#JPEG|JPEG]], version 8 or higher. (Version 6 was known to have problems)<br />
* [[#Simple_DirectMedia_Layer_.28SDL.29|Simple DirectMedia Layer]] (The binary provided by libsdl.org causes graphical corruptions. Compile from source or use homebrew/macports)<br />
* [[#The_OpenGL_Extension_Wrangler_Library_.28GLEW.29|The OpenGL Extension Wrangler Library]]<br />
* CuRL<br />
* [[#The_GNU_MP_Bignum_Library_.28libgmp.29|GMP]]<br />
* [[#WebP|WebP]] (v0.2.0 or newer)<br />
<br />
The following libraries are optional:<br />
* Theora<br />
* Speex<br />
* [[#Ogg|Ogg]]<br />
* [[#Vorbis|Vorbis]]<br />
<br />
====HomeBrew====<br />
Install [http://mxcl.github.com/homebrew/ HomeBrew] and then run the following command<br />
<br />
$ brew install nettle libjpeg curl sdl webp xvid gmp glew speex libvorbis theora<br />
<br />
All the necessary libraries should now have been installed.<br />
<br />
====Compiling by hand====<br />
The following are shell scripts that download, compile, and install various libraries. This is more time consuming then other methods but might be useful if you need more control over your libraries<br />
<br />
=====JPEG=====<br />
<br />
$ curl http://www.ijg.org/files/jpegsrc.v8d.tar.gz > jpegsrc.v8d.tar.gz<br />
$ tar xvzf jpegsrc.v8d.tar.gz<br />
$ cd jpeg-8d<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The OpenGL Extension Wrangler Library (GLEW)=====<br />
<br />
$ curl -L https://sourceforge.net/projects/glew/files/glew/1.7.0/glew-1.7.0.tgz/download > glew-1.7.0.tgz<br />
$ tar xvzf glew-1.7.0.tgz<br />
$ cd glew-1.7.0<br />
$ make<br />
$ sudo make install<br />
<br />
=====Simple DirectMedia Layer (SDL)=====<br />
<br />
Do not use the binaries provided by libsdl.org, as these are known to cause issues with gamma and color display. Instead, compile your own:<br />
<br />
$ curl http://www.libsdl.org/release/SDL-1.2.15.tar.gz > SDL-1.2.15.tar.gz<br />
$ tar xvzf SDL-1.2.15.tar.gz<br />
$ cd SDL-1.2.15<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The GNU MP Bignum Library (libgmp)=====<br />
<br />
$ curl ftp://ftp.gmplib.org/pub/gmp-5.0.5/gmp-5.0.5.tar.bz2 > gmp-5.0.5.tar.bz2<br />
$ tar xvjf gmp-5.0.5.tar.bz2<br />
$ cd gmp-5.0.5<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Ogg=====<br />
<br />
$ curl http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz > libogg-1.3.0.tar.gz<br />
$ tar xvzf libogg-1.3.0.tar.gz<br />
$ cd libogg-1.3.0<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Vorbis=====<br />
<br />
$ curl http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz > libvorbis-1.3.3.tar.gz<br />
$ tar xvzf libvorbis-1.3.3.tar.gz<br />
$ cd libvorbis-1.3.3<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====WebP=====<br />
<br />
You do not need to compile WebP by hand; Google provides binaries for Mac OS X available from their [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0-mac-10.5.tar.gz project page]. You will need version 0.2.0 or newer.<br />
<br />
Once downloaded, you must still install the header files and the binary:<br />
<br />
$ curl https://webp.googlecode.com/files/libwebp-0.2.0-mac-10.5.tar.gz > libwebp-0.2.0-mac-10.5.tar.gz<br />
$ tar xvzf libwebp-0.2.0-mac-10.5.tar.gz<br />
$ cd libwebp-0.2.0-mac-10.5<br />
$ sudo cp include/webp /usr/local/include<br />
$ sudo cp lib/libwebp.a /usr/local/lib<br />
<br />
===Configuring with CMake===<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 should be a different directory.<br />
# Hit "Configure". You will be prompted as to which generator you would like to use. If you have Xcode installed, choose that. Wait while the configuration process runs. You may have to set the following:<br />
## If CMake did not find your jpeg headers for some reason, set <code>JPEG_INCLUDE_DIR</code> to <code>/path/to/Unvanquished/src/libs/jpeg</code>.<br />
## Check <code>USE_INTERNAL_CRYPTO</code> to avoid having to compile nettle and hogweed yourself.<br />
## Check <code>USE_INTERNAL_SPEEX</code> to avoid having to compile Speex yourself.<br />
## Uncheck <code>USE_CIN_THEORA</code> and <code>USE_CIN_XVID</code> to avoid having to compile Theora or Xvid. (At present, there are not cutscenes or any such that require it.)<br />
## '''You will probably not be able to compile with the GLSL optimizer enabled; uncheck <code>USE_GLSL_OPTIMIZER</code>'''<br />
## If you have selected to generate Xcode project files, make the <code>SDLMAIN_LIBRARY</code> field blank. This option is not available if you have the generator set to Unix makefiles.<br />
# Hit "Generate".<br />
# You may now close CMake.<br />
<br />
===Compiling===<br />
<br />
====With Xcode====<br />
<br />
<ol><br />
<li>Compilation will fail unless you manually create certain directories needed by the build scripts:<br />
<pre><br />
$ cd /path/to/build/dir/CMakeFiles<br />
$ mkdir gpp{game,trem,ui}-qvm.dir<br />
</pre><br />
This is a workaround to {{Issue|101}}.<br />
</li><br />
<li>Either start Xcode and open the project file (in the build directory you specified) or double-click the project file in Finder.</li><br />
<li>Open the project file created by CMake, which should be in the build directory you specified.</li><br />
<li>Change the active target to "ALL_BUILD" and click Product&rarr;Build.</li><br />
</ol><br />
<br />
====With Unix Makefiles====<br />
<br />
<ul><br />
<li>Start Terminal (Applications &rarr; Utilities &rarr; Terminal).</li><br />
<li>Input the following commands:<br />
<pre><br />
$ cd /path/to/Unvanquished-build<br />
$ make<br />
</pre><br />
If you are on a multi-core or multi-processor machine, you may speed up the process by passing the <code>-j</code> argument followed by the number of available cores to <code>make</code>; e.g., <code>make -j4</code>. Note that doing so makes reading error messages more difficult, as multiple instances of the compiler will print to the screen at once, causing information to appear out of order.<br />
</li><br />
</ul><br />
<br />
===Testing the build===<br />
<br />
====With Xcode 4====<br />
<br />
To test the game, select the "client" scheme from the combo box on the toolbar, and click the run button or press {{Hotkey|MacCommand}}{{Hotkey|R}}.<br />
<br />
====With Unix Makefiles====<br />
<br />
After compiling, you'll have to place the data files in the <code>main</code> directory in your build directory. [[#Acquiring the Game Files|For download instructions, see below.]]<br />
<br />
Your file structure should look as follows:<br />
<br />
[[File:Build_dir_Mac_OS_X.png]]<br />
<br />
You may now start the application as such:<br />
<br />
$ ./daemon.i386<br />
<br />
Note that older machines will not support the new OpenGL 3 renderer, and must be started specifying the "vanilla" (aka "GL") renderer:<br />
<br />
$ ./daemon.i386 +set cl_renderer GL<br />
<br />
===Bundling the Application===<br />
<br />
====With CPack====<br />
<br />
CPack is able to create standalone bundles (as well as many other types of installers). However you must generate the files using Unix Makefiles instead of Xcode.<br />
<br />
$ cd /path/to/Unvanquished-build<br />
$ cpack -G Bundle<br />
<br />
Some warnings will be printed however these can be safely ignored. There should be a file called Unvanquished.dmg in the Unvanquished-build folder.<br />
<br />
====Manually====<br />
<br />
{{Note|header=Important|content=<br />
Please be aware that these instructions are very much out of date, and may not work. Also note that the dynamic library bundler does '''not''' work as intended and although you will be able to run your build on your machine, it will most likely not work on other machines. It is strongly suggested that you compile the source using Xcode.<br />
}}<br />
<br />
You'll find the Mac [http://macdylibbundler.sourceforge.net/ dynamic library bundler] to be quite useful (you must generate the files using Unix Makefiles instead of Xcode):<br />
<br />
$ curl -L http://sourceforge.net/projects/macdylibbundler/files/macdylibbundler/0.4.1/dylibbundler0.4.1.zip/download > \<br />
dylibbundler0.4.1.zip<br />
$ unzip dylibbundler0.4.1.zip<br />
$ cd dylibbundler<br />
$ make<br />
$ sudo make install<br />
<br />
Once you've done that, you can proceed to create the application bundle. Note that these steps assume that you have downloaded the data files to <code>main/</code> as shown above:<br />
<br />
<pre><br />
$ git=/path/to/Unvanquished-git-repo<br />
$ build=/path/to/Unvanquished-build-dir<br />
$ mkdir -pv Unvanquished.app/Contents/{libs,MacOS,Resources,Frameworks}<br />
$ cp -r $build/main Unvanquished.app/Contents/MacOS<br />
$ sips -s format tiff $git/debian/unvanquished.png --out temp.tiff<br />
$ tiff2icns temp.tiff Unvanquished.app/Contents/Resources/Unvanquished.icns<br />
$ rm temp.tiff<br />
$ cp $build/daemon{,ded}.i386 $build/*.dylib Unvanquished.app/Contents/MacOS<br />
$ cp -r /Library/Frameworks/SDL.framework Unvanquished.app/Contents/Frameworks<br />
$ install_name_tool -id \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/Frameworks/SDL.framework/Versions/A/SDL<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGLi386.dylib<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGL3i386.dylib<br />
$ for binary in Unvanquished.app/Contents/MacOS/*.{i386,dylib}; do<br />
dylibbundler -b -x $binary -d $dest/Unvanquished.app/Contents/libs/; done<br />
$ cp /usr/lib/libGLEW.1.7.0.dylib ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ chmod +w ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -id @executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -change /usr/lib/libGLEW.1.7.0.dylib \<br />
@executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ cat > Unvanquished.app/Contents/Info.plist<br />
<?xml version="1.0" encoding="UTF-8"?><br />
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"<br />
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"><br />
<plist version="1.0"><br />
<dict><br />
<key>CFBundleName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleDisplayName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleExecutable</key><br />
<string>daemon.i386</string><br />
<key>CFBundleIconFile</key><br />
<string>Unvanquished.icns</string><br />
<key>CFBundleIdentifier</key><br />
<string>net.Unvanquished</string><br />
<key>CFBundleInfoDictionaryVersion</key><br />
<string>6.0</string><br />
<key>CFBundlePackageType</key><br />
<string>APPL</string><br />
<key>CFBundleShortVersionString</key><br />
<string>0.4.0</string><br />
<key>CFBundleVersion</key><br />
<string>0.4.0</string><br />
</dict><br />
</plist><br />
^d<br />
</pre><br />
<br />
Note: <code>^d</code> indicates pressing {{Hotkey|Ctrl}}{{Hotkey|D}} on the keyboard.<br />
<br />
The contents of the completed application bundle should look like this:<br />
<br />
[[File:Bundle_dir_Mac_OS_X.png]]<br />
<br />
'''Note''': If you compiled SDL from source, you will not see a directory titled <code>SDL.framework</code>.<br />
<br />
==Windows==<br />
<br />
===Visual Studio===<br />
<br />
CMake can generate Visual Studio projects for Unvanquished.<br />
<br />
# Run the <code>Visual_Studio32.bat</code> batch script in your source directory by double-clicking it. Alternatively, you may use the <code>Visual_Studio64.bat</code> shell script if you have the [http://www.microsoft.com/en-us/download/details.aspx?id=8279 Windows 7 SDK] installed and a 64-bit system.<br />
# Open <code>build-32/Daemon.sln</code> in Visual Studio 2010.<br />
# In the two text boxes in the toolbar, select "Release" or "Debug" in the first one and Win32 in the second one<br />
# Press {{Hotkey|F5}} to build solution and run application, or just use Build &rarr; Build Solution to compile the code.<br />
<br />
====Important Notes====<br />
<br />
* LLVM is disabled and does not work correctly with CMake generated Visual Studio projects.<br />
* ncurses is not supported under Visual Studio.<br />
* The path to the build folder must not have any spaces otherwise generation of QVMs will fail. See {{Issue|102}}.<br />
* Due to limitations with CMake, neither the startup project nor the working directory can be specified. These must be set manually to debug the client with Visual Studio:<br />
** Right click on client and select "Set as StartUp project".<br />
** Right click on client, select properties, select Debugging and set "Working Directory" to <code>$(TargetPath)\..</code>.<br />
<br />
===MinGW===<br />
<br />
It is possible to build Unvanquished with MinGW, although the process is rather arduous compared to Visual Studio or compiling for other platforms.<br />
<br />
====Notes====<br />
<br />
* The easiest way to acquire and install MinGW is with the graphical [http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/ mingw-get-inst installer]. <!-- TODO: maybe walk the user through the installer? --><br />
* When configuring the build with CMake, you will find that you will have to set a number of libraries manually. You can find precompiled DLLs for most of the dependencies; those that are not pre-compiled can be built with the corresponding <code>USE_INTERNAL_</code> setting.<br />
* On Windows, SDL requires that the Direct X SDK can be installed. You may download the June 2010 release from [http://www.microsoft.com/en-us/download/details.aspx?id=6812 Microsoft's site].<br />
* '''The build will fail during QVM compilation if your source or build directories contain spaces.''' This is due to a bug with lcc. If your home directory contains a space, you may want to create source and build directories at the root of one of your drives (e.g., <code>C:\Unvanquished\Source</code> and <code>C:\Unvanquished\Build</code>.)<br />
<br />
====Instructions====<br />
<br />
The easiest way to get a build up (at the time of writing) is as follows:<br />
<br />
{{Note|content=Although there are 64-bit binaries of most of the libraries required to build the game, these do not work with MinGW at present, so the following instructions all use the 32-bit binaries.}}<br />
<br />
<ol><br />
<li>Although there are binaries of gmp distributed with the source, they have are dependent on Visual Studio's implementations of <code>_ftol2_sse</code> and <code>_alloca_probe_16</code>. A fix may be found on [http://stackoverflow.com/questions/6753111/static-linking-with-openssl Stack Exchange], but requires that Visual Studio be installed, which defeats the purpose of attempting to use MinGW to compile the source. You can build gmp yourself:<br />
<ol><br />
<li>Download and extract the latest version of the [http://gmplib.org/ GNU MP Bignum Library (GMP)]. (You will need either cygwin with tar and bz2 installed or 7-zip to extract the archive.)</li><br />
<li>Install the following Cygwin packages if you have not already:<br />
* binutils<br />
* gcc<br />
* gcc-g++<br />
* m4<br />
* make<br />
</li><br />
<li>As part of the GMP compilation process, a file called <code>gen-fib.c</code> generates a table of numbers in the Fibonacci sequence. The generated file does not play nicely with Cygwin or MinGW, so you must fix it. Edit <code>gen-fib.c</code>, and at around line 100, change these lines<br />
<pre><br />
for (i = 0; i < fnum; i++)<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
printf ("), /* %d */\n", i-1);<br />
}<br />
printf ("};\n");<br />
</pre><br />
to look like this:<br />
<pre><br />
for (i = 0; i < fnum; i++)<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
printf (")%c /* %d */\n", (i == (fnum-1)) ? ' ' : ',', i-1);<br />
}<br />
printf ("};\n");<br />
</pre><br />
The patch file looks like this:<br />
<pre><br />
@@ -100,7 +100,7 @@<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
- printf ("), /* %d */\n", i-1);<br />
+ printf (")%c /* %d */\n", (i == (fnum-1)) ? ' ' : ',', i-1);<br />
}<br />
printf ("};\n");<br />
}<br />
</pre><br />
</li><br />
<li>Compiling with MinGW does not work, so you will need to compile with Cygwin. At the prompt:<br />
<pre><br />
$ ./configure --disable-static --enable-shared<br />
$ make<br />
</pre><br />
The <code>--disable-static</code> and <code>--enable-shared</code> flags configure GMP to build a DLL instead of a static library. You may optionally perform <code>make install</code>. Additional compilation instructions [http://www.cs.nyu.edu/exact/core/gmp/ are available].<br />
<p>If you experience difficulties with compilation and it appears that MinGW gcc is being detected by <code>configure</code> and not Cygwin gcc, you can try editing your <code>PATH</code> variable:</p><br />
<pre><br />
$ export PATH=`echo $PATH | sed "s|/cygdrive/c/MinGW/bin:||"`<br />
</pre><br />
Re-run <code>configure</code> and <code>make</code> afterwards.<br />
</ol><br />
</li><br />
<li>Download the [http://www.libsdl.org/release/SDL-1.2.15-win32.zip latest stable version] of SDL for Windows. Extract the archive and copy <code>SDL.dll</code> from it to the root of your build directory.</li><br />
<li>Set the following CMake flags:<br />
{| class="wikitable"<br />
! Setting<br />
! Description<br />
! Type<br />
! Value<br />
|-<br />
| <code>USE_INTERNAL_CRYPTO</code><br />
| Use the provided copies of crypto libraries. <!-- FIXME: I think these are nettle and something else --><br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_GLEW</code><br />
| Use the provided copy of GLEW.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_JPEG</code><br />
| Use the provided copy of JPEG.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SDL</code><br />
| Use the provided copy of SDL.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SPEEX</code><br />
| Use the provided copy of Speex.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_WEBP</code><br />
| Use the provided copy of WebP.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_CURSES</code><br />
| Enables/disables curses.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>PNG_LIBRARY</code><br />
| Path to the PNG library DLL.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng/libs/win32/libpng.lib</code><br />
|-<br />
| <code>PNG_PNG_INCLUDE_DIR</code><br />
| Path to the PNG library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng</code><br />
|-<br />
| <code>FREETYPE_LIBRARY</code><br />
| Path to the compiled FreeType library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/lib/freetype.lib</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_freetype2</code><br />
| Path to the FreeType library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/freetype2</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_ft2build</code><br />
| Path to the FreeType library file "ftbuild.h".<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/</code><br />
|-<br />
| <code>GMP_INCLUDE_DIR</code><br />
| Path to the GMP library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/gmp/include</code><br />
|-<br />
| <code>GMP_LIBRARY</code><br />
| Path to the GMP library.<br />
| <code>FILEPATH</code><br />
| <code><var>path/to/compiled/gmp/</var>.libs/cyggmp-10.dll</code><br />
|-<br />
| <code>ZLIB_INCLUDE_DIR</code><br />
| Path to the zlib library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/include</code><br />
|-<br />
| <code>ZLIB_LIBRARY</code><br />
| Path to the zlib library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/lib/x32/zlib1.dll</code><br />
|-<br />
| <code>CURL_LIBRARY</code><br />
| Path to the CURL library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/lib/win32/release/libcurl.dll</code><br />
|-<br />
| <code>CURL_INCLUDE_DIR</code><br />
| Path to the zlib library.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/include/curl</code><br />
|-<br />
| <code>USE_OPENAL</code><br />
| Enables/disables OpenAL support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_THEORA</code><br />
| Enables/disables Theora support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_XVID</code><br />
| Enables/disables Xvid support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CODEC_THEORA</code><br />
| Enables/disables Ogg support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>SDL_LIBRARY</code><br />
| The path to the SDL DLL.<br />
| <code>FILEPATH</code><br />
| <code><var>BuildPath</var>/SDL.dll</code><br />
|-<br />
| <code>SDLMAIN_LIBRARY</code><br />
| Enables/disables Ogg support.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code><br />
|-<br />
|}<br />
Do note that CMake is slash-direction&ndash;agnostic; it can handle both forward- and backslashes on Windows.<br />
<p>If you would like to compile a debug build, change <code>CMAKE_RELEASE_TYPE</code> from <code>Release</code> to <code>Debug</code>.</p><br />
</li><br />
<li>Open <code><var>SourcePath</var>/CMakeLists.txt</code> and edit the line<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi z )<br />
</pre><br />
(around line 1040) to look like this:<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi )<br />
</pre><br />
Also edit around line 1700:<br />
<pre><br />
###########################<br />
#Configure Download Script#<br />
###########################<br />
<br />
if( NOT MSVC )<br />
</pre><br />
to look like this:<br />
<pre><br />
###########################<br />
#Configure Download Script#<br />
###########################<br />
<br />
if( NOT WIN32 )<br />
</pre><br />
</li><br />
<li>Open <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code> and edit the lines:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "SDL.h"<br />
#include "SDL_main.h"<br />
</pre><br />
to look like:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "../../../include/SDL.h"<br />
#include "../../../include/SDL_main.h"<br />
</pre><br />
<li>Open a command prompt and <code>cd</code> to your source directory.</li><br />
<li>Run <code>make</code>:<br />
<pre><br />
> mingw32-make<br />
</pre><br />
If you would like verbose output, set the <code>VERBOSE</code> environment variable before running <code>make</code>.<br />
<pre><br />
> set VERBOSE=1<br />
</pre><br />
To make it easier to build the source, you can create a batch file (call it something like <code>compile.bat</code>) and place it in your build directory:<br />
<pre><br />
@echo off<br />
<br />
set RETURN=compile<br />
<br />
:get_time<br />
:: Thank you, Rob van der Woude:<br />
:: (http://www.robvanderwoude.com/datetimentparse.php)<br />
FOR /F "tokens=1,2,3 delims=:." %%A IN ("%Time%") DO (<br />
SET /A HOURS = 100%%A %% 100<br />
SET /A MINUTES = 100%%B %% 100<br />
SET /A SECONDS = 100%%C %% 100<br />
)<br />
SET /A TICKS=( %HOURS% * 3600 ) + ( %MINUTES% * 60 ) + %SECONDS%<br />
GOTO %RETURN%<br />
<br />
:compile<br />
SET START_TICKS=%TICKS%<br />
<br />
SET VERBOSE=1<br />
:: mingw32-make clean<br />
mingw32-make -j4<br />
<br />
set RETURN=finish<br />
GOTO get_time<br />
<br />
:finish<br />
SET /A COMPILE_TIME=%TICKS% - %START_TICKS%<br />
SET /A MINUTES=%COMPILE_TIME% / 60<br />
SET /A SECONDS=%COMPILE_TIME% %% 60<br />
ECHO.<br />
ECHO Compilation took %MINUTES%m %SECONDS%s.<br />
PAUSE<br />
</pre><br />
</li><br />
<li>Once compilation finishes, you will find that the game will fail to run due to DLL dependencies. To resolve these:<br />
<ul><br />
<li>You will need to move <code>INTERNAL_GLEW</code> from the <code>Release/</code> folder of the build directory to the root of the build directory.</li><br />
<li>You will need to place the following other DLLs in your build directory:<br />
* freetype6.dll<br />
* libbz2.dll<br />
* libcurl.dll<br />
* libogg.dll<br />
* libpng14-14.dll<br />
* libtheora.dll<br />
* libvorbis.dll<br />
* libvorbisfile.dll<br />
* msvcr100.dll<br />
* msvcr100d.dll<br />
* zlib1.dll<br />
* zlibwapi.dll<br />
The easiest way to obtain these DLLs is by copying them from the installation directory of an [http://sourceforge.net/projects/unvanquished/files/latest/download official release] of Unvanquished.<br />
</li><br />
<li>You will need to copy your compiled DLL of GMP to your build directory. It may be found in <code><var>path/to/compiled/gmp/</var>.libs/cyggmp-10.dll</code>.</li><br />
<li>As you compiled GMP with Cygwin, it in turn depends on <code>cygwin1.dll</code>, which may typically be found in <code>C:\cygwin\bin\</code>. Copy and paste it into your build directory.</li><br />
</ul><br />
Once you have completed these steps, you should never have to do them again.<br />
</li><br />
</ol><br />
<br />
====Notes====<br />
<br />
* If you would like to use curses, try using [http://sourceforge.net/projects/pdcurses/files/pdcurses PDCurses].<br />
<br />
===QtCreator===<br />
<br />
# Install MinGW and follow the above instructions, except select Code::Blocks as the generator.<br />
# Start QtCreator, and select "Open File or Project&hellip;" from the File menu.<br />
# Navigate to your source directory and open CMakeLists.txt.<br />
# At the CMake Wizard, select the same build directory you already configured using CMake. (If you did not chose Code::Blocks as the generator, you will have to start over again, as QtCreator requires a Code::Blocks project file in order to compile the source.)<br />
# Ensure that a generator is selected in the combo box, and click "Run CMake". If there is no generator listed, see the [[#Troubleshooting|troubleshooting]] section below.<br />
# Click "Finish" to close the wizard.<br />
<br />
You should now be able to compile, run, and debug the code using QtCreator.<br />
<br />
====Troubleshooting====<br />
<br />
If at the "Run CMake" prompt of the the CMake Wizard, select "Run CMake" and are warned that no generator was selected, and notice that there are no generators in the combo box, you will likely have to [http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html manually configure your toolchain]. Select "Options&hellip;" from the "Tools" menu, then navigate to "Build &amp; Run".<br />
<br />
At the options window,<br />
* Go to the "Kits" tab, and mouse over the "Desktop (default)" kit under "Manual". If there were any errors in configuring this kit, they will be displayed in the tool tip. If there are problems, select the kit. You may need to manually specify the location of the MinGW debugger, for example, which is typically <code>C:\MinGW\bin\gdb.exe</code>.<br />
* Go to the "Compilers" tab, and ensure that MinGW is present. If not, you will need to add it manually.<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 />
libgmp3-dev libjpeg8-dev libncurses5-dev libogg-dev libopenal-dev \<br />
libpng12-dev libsdl1.2-dev libvorbis-dev zlib1g-dev nettle-dev \<br />
libwebp-dev libspeexdsp-dev libtheora-dev<br />
<br />
If the version of WebP supplied by your version of Debian or Ubuntu is older than v0.2.0, you will need to [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0.tar.gz download] and [https://developers.google.com/speed/webp/docs/compiling#unix compile it from source]. After compiling and installing with <code>sudo make install</code>, in CMake, you'll need to set <code>WEBP_INCLUDE_DIR</code> to <code>/usr/local/include/webp</code> and <code>WEBP_LIBRARY</code> to <code>/usr/local/lib/libwebp.so</code>.<br />
<br />
'''We currently provide a ready-to-use libwebp-dev in our [http://{{SERVERNAME}}/index.php/Download#ubuntu Debian and Ubuntu repositories], alongside .debs of the game and server.'''<br />
<br />
Actual dev package names may vary, e.g. libgmp-dev instead of libgmp3-dev and libglew-dev or libglew1.7-dev instead of libglew1.5-dev.<br />
<br />
Since we have a debian directory in the source, you can also to check what's needed then install the listed packages (choosing from alternatives as needed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ dpkg-checkbuilddeps<br />
…<br />
$ sudo apt-get install <var>package(s)</var><br />
<br />
If dpkg-checkbuilddeps produces no output, you have all necessary build dependencies. Also, debhelper's only needed if you're building .debs.<br />
<br />
====Gentoo====<br />
<br />
$ emerge curl freetype glew gmp jpeg ncurses libogg openal libpng libsdl libvorbis zlib<br />
<br />
====openSUSE====<br />
<br />
$ sudo install zypper gcc gcc-c++ Mesa-libGL-devel SDL-devel libjpeg8-devel \<br />
libpng12-devel glew-devel webp-devel ncurses-devel gmp-devel libcurl-devel \<br />
libnettle-devel openal-soft-devel speex-devel libvorbis-devel \<br />
libtheora-devel<br />
<br />
The latest version of WebP must be installed manually:<br />
<br />
$ wget https://webp.googlecode.com/files/libwebp-0.2.1.tar.gz<br />
$ tar xvzf libwebp-0.2.1.tar.gz<br />
$ cd libwebp-0.2.1<br />
$ ./configure && make<br />
$ sudo make install<br />
<br />
You must disable curses (set <code>USE_CURSES</code> appropriately in CMake) as failing to do so will cause Unvanquished to crash on startup.<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 />
On Debian or 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 />
Or, in Debian or Ubuntu, you can build a package (but you'll need to have devscripts and fakeroot installed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ fakeroot dpkg-buildpackage -b -uc<br />
$ sudo dpkg -i <var>../unvanquished_*.deb</var><br />
<br />
Once in <code>ccmake</code>, use the following keys:<br />
<br />
* Press {{Hotkey|c}} to configure. If an error occurs during this phase, make note of it and press {{Hotkey|e}} to dismiss it.<br />
* Use the up and down arrow keys to navigate the compilation options.<br />
* Press {{Hotkey|Enter}} to enable or disable boolean options (i.e., on/off) or to edit textual options.<br />
** Press {{Hotkey|Esc}} when editing a textual option to cancel the change.<br />
<br />
Once you have finished the configuration process, press {{Hotkey|C}} again, then {{Hotkey|G}} 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=====<br />
<br />
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_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 />
* <code>USE_CIN_THEORA</code> &mdash; Disabling this prevents videos from being recorded in Theora.<br />
* <code>USE_CIN_XVID</code> &mdash; Disabling this prevents videos from being recorded in Xvid.<br />
* <code>USE_VOIP</code> &mdash; Disabling this removes VOIP support. Alternatively enabling <code>USE_INTERNAL_SPEEX</code> will use the libraries distributed with Unvanquished for VoIP<br />
* <code>USE_INTERNAL_CRYPTO</code> &mdash; Enable this to use the crypto libraries provided by Unvanquished.<br />
<br />
===Compiling===<br />
<br />
$ cd <var>path/to/unvanquished/build</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 />
===Acquiring mandatory game files===<br />
<br />
The game files are not in the Git repository, and must be downloaded separately. This may be done on the command line or from your web browser. The downloads may be found on [http://sourceforge.net/projects/unvanquished/files/Assets SourceForge.net]. If you download the files from your browser, just download the files named "pak*.pk3", and save them to the [[Running_the_game#Data_locations|data location]] for your system.<br />
<br />
On Linux, this may be done as follows:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
wget -O $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On FreeBSD, using the <code>sh</code> shell:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
fetch -r -o $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On Mac OS X:<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
curl -L "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download" > $file<br />
fi<br />
done<br />
<br />
Linux users may also use the <code>download-pk3.sh</code> script that is distributed with the source code, which requires that curl be installed:<br />
<br />
$ cd <var>[path to Unvanquished source code]</var><br />
$ mkdir -p ~/.Unvanquished/main<br />
$ ./download-pk3.sh ~/.Unvanquished/main<br />
<br />
===Downloading the map pack===<br />
<br />
The map pack exists only for convenience; if you do not download the map pack, Unvanquished will automatically download maps as needed when you attempt to play online.<br />
<br />
To download the map pack on Linux:<br />
<br />
$ wget -O maps.7z "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z"; done<br />
<br />
To download the map pack on Mac OS X:<br />
<br />
$ curl -L "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z" > maps.7z; done<br />
<br />
Note that you will need to unzip the map pack on either system as it is compressed with LZMA. Mac users can use the [http://wakaba.c3.cx/s/apps/unarchiver.html Unarchiver]. Uncompressing the archive on Linux is highly dependent on your distribution.<br />
<br />
===Verifying the Files===<br />
<br />
Download the latest [http://sourceforge.net/projects/unvanquished/files/Assets/{{CurrentVersion|MD5HashFile}} MD5 hash file] and save it to your system's [[Running_the_game#Data_directory|data location]].<br />
<br />
On systems with the <code>md5</code> command (Mac OS X):<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ cat {{CurrentVersion|MD5HashFile}} | while read line; do<br />
file="`echo "$line" | sed -E "s/^[a-fA-F0-9]+ +\*?//"`"<br />
if [ -e "$file" ]; then<br />
if [ `md5 -r "$file" | cut -d\ -f1` = "`echo "$line" | cut -d\ -f1`" ]<br />
then echo "File \"$file\" appears okay."<br />
else echo "File \"$file\" is corrupt"'!' >&2<br />
fi; fi; done<br />
<br />
On systems with the <code>md5sum</code> command (most Linux distributions):<br />
<br />
$ cd <var>[[Running_the_game#Data_directory|/path/to/data/files]]</var><br />
$ md5sum -c {{CurrentVersion|MD5HashFile}} 2>&1 | grep -v "open or read\|file or directory"<br />
<br />
The <code>grep</code> invocation is used to strip output complaining about missing files.<br />
<br />
Any files that are found to be corrupt should be replaced; just download a [http://sourceforge.net/projects/unvanquished/files/Assets new copy] of the affected file(s).<br />
<br />
==Errors==<br />
<br />
===CMake cannot locate Newton===<br />
<br />
If CMake cannot find Newton, you'll need to set it up yourself.<br />
<br />
It should be in <code><var>/path/to/Unvanquished</var>/src/libs/libnewton/libs/<var>your_os</var>/libNewton.so</code>.<br />
Be sure to replace <var>your_os</var> with the proper directory name.<br />
<br />
Use CMake as before to change the <code>NEWTON_LIBRARY</code> build setting to the said path:<br />
<br />
# Start the CMake configurator:<pre>$ ccmake ..</pre><br />
# Scroll down and highlight <code>NEWTON_LIBRARY</code>.<br />
# Press {{Hotkey|Enter}} to begin editing and input in the path.<br />
# Press {{Hotkey|C}} to configure and {{Hotkey|G}} to generate the new makefiles.<br />
# Press {{Hotkey|Q}} to quit.<br />
# Recompile the source:<pre>$ make</pre><br />
<br />
===The C Compiler is not able to compile a simple test program===<br />
<br />
When attempting to generate a solution for Xcode CMake fails with the following error<br />
-- Check for working C compiler using: Xcode -- broken<br />
CMake Error at /Applications/CMake 2.8-8.app/Contents/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):<br />
The C compiler "/usr/bin/gcc" is not able to compile a simple test program.<br />
<br />
It fails with the following output:<br />
<br />
Change Dir: /Users/danielmaloney/Documents/Unvanquished/build-xcode/CMakeFiles/CMakeTmp<br />
<br />
<br />
<br />
Run Build Command:/Applications/CMake\ 2.8-8.app/Contents/bin/cmakexbuild<br />
-project CMAKE_TRY_COMPILE.xcodeproj build -target<br />
cmTryCompileExec1400153232 -configuration Debug<br />
<br />
Error: No developer directory found at /Developer. Run<br />
/usr/bin/xcode-select to update the developer directory path.<br />
<br />
<br />
<br />
<br />
<br />
CMake will not be able to correctly generate this project.<br />
Call Stack (most recent call first):<br />
CMakeLists.txt:19 (project)<br />
<br />
This is due to Xcode 4.3 having a different directory structure to previous versions. Simply running the following command will correct this error:<br />
sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer/</div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Compiling_the_source&diff=1970Compiling the source2013-04-15T22:08:51Z<p>Velociostrich: Clarify a bit</p>
<hr />
<div>==Mac OS X==<br />
<br />
First, you need to [[Getting_the_source|acquire the source code]].<br />
<br />
Regardless of what interface you may use to compile the source, you will need [http://www.cmake.org/cmake/resources/software.html CMake] to generate makefiles. You will also need to install [https://developer.apple.com/xcode/ Xcode] (making sure to choose to install the command-line utilities when prompted by the installer).<br />
<br />
Then, you will need to acquire (and in some cases, manually compile) at a minimum the [[#Dependencies|necessary libraries]].<br />
<br />
Once you have the source code and the libraries installed, you may actually proceed to compile the source. You have several options:<br />
* '''Compile the source at the command line'''. This is the easiest if you would just like to compile the game to use yourself and you do not intend to work on the code.<br />
* '''Compile the source using an IDE'''. This is preferred if you intend on developing the source.<br />
** Xcode is Apple's flagship IDE and you should have installed to compile the source regardless of which method you use.<br />
** [http://qt-project.org/downloads QtCreator] is cross-platform and provides real-time feedback of syntax errors, a Vim mode, as well as other features.<br />
** [http://www.codeblocks.org/ Code::Blcoks] is also cross-platform but lacks some of the features of Xcode and QtCreator.<br />
<br />
===Dependencies===<br />
<br />
You only need to use one of the following methods (HomeBrew or compiling by hand). Please try and avoid mixing methods as this may produce unexpected results.<br />
<br />
Unvanquished requires the following libraries:<br />
* [[#JPEG|JPEG]], version 8 or higher. (Version 6 was known to have problems)<br />
* [[#Simple_DirectMedia_Layer_.28SDL.29|Simple DirectMedia Layer]] (The binary provided by libsdl.org causes graphical corruptions. Compile from source or use homebrew/macports)<br />
* [[#The_OpenGL_Extension_Wrangler_Library_.28GLEW.29|The OpenGL Extension Wrangler Library]]<br />
* CuRL<br />
* [[#The_GNU_MP_Bignum_Library_.28libgmp.29|GMP]]<br />
* [[#WebP|WebP]] (v0.2.0 or newer)<br />
<br />
The following libraries are optional:<br />
* Theora<br />
* Speex<br />
* [[#Ogg|Ogg]]<br />
* [[#Vorbis|Vorbis]]<br />
<br />
====HomeBrew====<br />
Install [http://mxcl.github.com/homebrew/ HomeBrew] and then run the following command<br />
<br />
$ brew install nettle libjpeg curl sdl webp xvid gmp glew speex libvorbis theora<br />
<br />
All the necessary libraries should now have been installed.<br />
<br />
====Compiling by hand====<br />
The following are shell scripts that download, compile, and install various libraries. This is more time consuming then other methods but might be useful if you need more control over your libraries<br />
<br />
=====JPEG=====<br />
<br />
$ curl http://www.ijg.org/files/jpegsrc.v8d.tar.gz > jpegsrc.v8d.tar.gz<br />
$ tar xvzf jpegsrc.v8d.tar.gz<br />
$ cd jpeg-8d<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The OpenGL Extension Wrangler Library (GLEW)=====<br />
<br />
$ curl -L https://sourceforge.net/projects/glew/files/glew/1.7.0/glew-1.7.0.tgz/download > glew-1.7.0.tgz<br />
$ tar xvzf glew-1.7.0.tgz<br />
$ cd glew-1.7.0<br />
$ make<br />
$ sudo make install<br />
<br />
=====Simple DirectMedia Layer (SDL)=====<br />
<br />
Do not use the binaries provided by libsdl.org, as these are known to cause issues with gamma and color display. Instead, compile your own:<br />
<br />
$ curl http://www.libsdl.org/release/SDL-1.2.15.tar.gz > SDL-1.2.15.tar.gz<br />
$ tar xvzf SDL-1.2.15.tar.gz<br />
$ cd SDL-1.2.15<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The GNU MP Bignum Library (libgmp)=====<br />
<br />
$ curl ftp://ftp.gmplib.org/pub/gmp-5.0.5/gmp-5.0.5.tar.bz2 > gmp-5.0.5.tar.bz2<br />
$ tar xvjf gmp-5.0.5.tar.bz2<br />
$ cd gmp-5.0.5<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Ogg=====<br />
<br />
$ curl http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz > libogg-1.3.0.tar.gz<br />
$ tar xvzf libogg-1.3.0.tar.gz<br />
$ cd libogg-1.3.0<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Vorbis=====<br />
<br />
$ curl http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz > libvorbis-1.3.3.tar.gz<br />
$ tar xvzf libvorbis-1.3.3.tar.gz<br />
$ cd libvorbis-1.3.3<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====WebP=====<br />
<br />
You do not need to compile WebP by hand; Google provides binaries for Mac OS X available from their [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0-mac-10.5.tar.gz project page]. You will need version 0.2.0 or newer.<br />
<br />
Once downloaded, you must still install the header files and the binary:<br />
<br />
$ curl https://webp.googlecode.com/files/libwebp-0.2.0-mac-10.5.tar.gz > libwebp-0.2.0-mac-10.5.tar.gz<br />
$ tar xvzf libwebp-0.2.0-mac-10.5.tar.gz<br />
$ cd libwebp-0.2.0-mac-10.5<br />
$ sudo cp include/webp /usr/local/include<br />
$ sudo cp lib/libwebp.a /usr/local/lib<br />
<br />
===Configuring with CMake===<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 should be a different directory.<br />
# Hit "Configure". You will be prompted as to which generator you would like to use. If you have Xcode installed, choose that. Wait while the configuration process runs. You may have to set the following:<br />
## If CMake did not find your jpeg headers for some reason, set <code>JPEG_INCLUDE_DIR</code> to <code>/path/to/Unvanquished/src/libs/jpeg</code>.<br />
## Check <code>USE_INTERNAL_CRYPTO</code> to avoid having to compile nettle and hogweed yourself.<br />
## Check <code>USE_INTERNAL_SPEEX</code> to avoid having to compile Speex yourself.<br />
## Uncheck <code>USE_CIN_THEORA</code> and <code>USE_CIN_XVID</code> to avoid having to compile Theora or Xvid. (At present, there are not cutscenes or any such that require it.)<br />
## '''You will probably not be able to compile with the GLSL optimizer enabled; uncheck <code>USE_GLSL_OPTIMIZER</code>'''<br />
## If you have selected to generate Xcode project files, make the <code>SDLMAIN_LIBRARY</code> field blank. This option is not available if you have the generator set to Unix makefiles.<br />
# Hit "Generate".<br />
# You may now close CMake.<br />
<br />
===Compiling===<br />
<br />
====With Xcode====<br />
<br />
<ol><br />
<li>Compilation will fail unless you manually create certain directories needed by the build scripts:<br />
<pre><br />
$ cd /path/to/build/dir/CMakeFiles<br />
$ mkdir gpp{game,trem,ui}-qvm.dir<br />
</pre><br />
This is a workaround to {{Issue|101}}.<br />
</li><br />
<li>Either start Xcode and open the project file (in the build directory you specified) or double-click the project file in Finder.</li><br />
<li>Open the project file created by CMake, which should be in the build directory you specified.</li><br />
<li>Change the active target to "ALL_BUILD" and click Product&rarr;Build.</li><br />
</ol><br />
<br />
====With Unix Makefiles====<br />
<br />
<ul><br />
<li>Start Terminal (Applications &rarr; Utilities &rarr; Terminal).</li><br />
<li>Input the following commands:<br />
<pre><br />
$ cd /path/to/Unvanquished-build<br />
$ make<br />
</pre><br />
If you are on a multi-core or multi-processor machine, you may speed up the process by passing the <code>-j</code> argument followed by the number of available cores to <code>make</code>; e.g., <code>make -j4</code>. Note that doing so makes reading error messages more difficult, as multiple instances of the compiler will print to the screen at once, causing information to appear out of order.<br />
</li><br />
</ul><br />
<br />
===Testing the build===<br />
<br />
====With Xcode 4====<br />
<br />
To test the game, select the "client" scheme from the combo box on the toolbar, and click the run button or press {{Hotkey|MacCommand}}{{Hotkey|R}}.<br />
<br />
====With Unix Makefiles====<br />
<br />
After compiling, you'll have to place the data files in the <code>main</code> directory in your build directory. [[#Acquiring the Game Files|For download instructions, see below.]]<br />
<br />
Your file structure should look as follows:<br />
<br />
[[File:Build_dir_Mac_OS_X.png]]<br />
<br />
You may now start the application as such:<br />
<br />
$ ./daemon.i386<br />
<br />
Note that older machines will not support the new OpenGL 3 renderer, and must be started specifying the "vanilla" (aka "GL") renderer:<br />
<br />
$ ./daemon.i386 +set cl_renderer GL<br />
<br />
===Bundling the Application===<br />
<br />
====With CPack====<br />
<br />
CPack is able to create standalone bundles (as well as many other types of installers). However you must generate the files using Unix Makefiles instead of Xcode.<br />
<br />
$ cd /path/to/Unvanquished-build<br />
$ cpack -G Bundle<br />
<br />
Some warnings will be printed however these can be safely ignored. There should be a file called Unvanquished.dmg in the Unvanquished-build folder.<br />
<br />
====Manually====<br />
<br />
You'll find the Mac [http://macdylibbundler.sourceforge.net/ dynamic library bundler] to be quite useful (you must generate the files using Unix Makefiles instead of Xcode):<br />
<br />
$ curl -L http://sourceforge.net/projects/macdylibbundler/files/macdylibbundler/0.4.1/dylibbundler0.4.1.zip/download > \<br />
dylibbundler0.4.1.zip<br />
$ unzip dylibbundler0.4.1.zip<br />
$ cd dylibbundler<br />
$ make<br />
$ sudo make install<br />
<br />
Once you've done that, you can proceed to create the application bundle. Note that these steps assume that you have downloaded the data files to <code>main/</code> as shown above:<br />
<br />
<pre><br />
$ git=/path/to/Unvanquished-git-repo<br />
$ build=/path/to/Unvanquished-build-dir<br />
$ mkdir -pv Unvanquished.app/Contents/{libs,MacOS,Resources,Frameworks}<br />
$ cp -r $build/main Unvanquished.app/Contents/MacOS<br />
$ sips -s format tiff $git/debian/unvanquished.png --out temp.tiff<br />
$ tiff2icns temp.tiff Unvanquished.app/Contents/Resources/Unvanquished.icns<br />
$ rm temp.tiff<br />
$ cp $build/daemon{,ded}.i386 $build/*.dylib Unvanquished.app/Contents/MacOS<br />
$ cp -r /Library/Frameworks/SDL.framework Unvanquished.app/Contents/Frameworks<br />
$ install_name_tool -id \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/Frameworks/SDL.framework/Versions/A/SDL<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGLi386.dylib<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGL3i386.dylib<br />
$ for binary in Unvanquished.app/Contents/MacOS/*.{i386,dylib}; do<br />
dylibbundler -b -x $binary -d $dest/Unvanquished.app/Contents/libs/; done<br />
$ cp /usr/lib/libGLEW.1.7.0.dylib ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ chmod +w ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -id @executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -change /usr/lib/libGLEW.1.7.0.dylib \<br />
@executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ cat > Unvanquished.app/Contents/Info.plist<br />
<?xml version="1.0" encoding="UTF-8"?><br />
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"<br />
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"><br />
<plist version="1.0"><br />
<dict><br />
<key>CFBundleName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleDisplayName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleExecutable</key><br />
<string>daemon.i386</string><br />
<key>CFBundleIconFile</key><br />
<string>Unvanquished.icns</string><br />
<key>CFBundleIdentifier</key><br />
<string>net.Unvanquished</string><br />
<key>CFBundleInfoDictionaryVersion</key><br />
<string>6.0</string><br />
<key>CFBundlePackageType</key><br />
<string>APPL</string><br />
<key>CFBundleShortVersionString</key><br />
<string>0.4.0</string><br />
<key>CFBundleVersion</key><br />
<string>0.4.0</string><br />
</dict><br />
</plist><br />
^d<br />
</pre><br />
<br />
Note: <code>^d</code> indicates pressing {{Hotkey|Ctrl}}{{Hotkey|D}} on the keyboard.<br />
<br />
The contents of the completed application bundle should look like this:<br />
<br />
[[File:Bundle_dir_Mac_OS_X.png]]<br />
<br />
'''Note''': If you compiled SDL from source, you will not see a directory titled <code>SDL.framework</code>.<br />
<br />
==Windows==<br />
<br />
===Visual Studio===<br />
<br />
CMake can generate Visual Studio projects for Unvanquished.<br />
<br />
# Run the <code>Visual_Studio32.bat</code> batch script in your source directory by double-clicking it. Alternatively, you may use the <code>Visual_Studio64.bat</code> shell script if you have the [http://www.microsoft.com/en-us/download/details.aspx?id=8279 Windows 7 SDK] installed and a 64-bit system.<br />
# Open <code>build-32/Daemon.sln</code> in Visual Studio 2010.<br />
# In the two text boxes in the toolbar, select "Release" or "Debug" in the first one and Win32 in the second one<br />
# Press {{Hotkey|F5}} to build solution and run application, or just use Build &rarr; Build Solution to compile the code.<br />
<br />
====Important Notes====<br />
<br />
* LLVM is disabled and does not work correctly with CMake generated Visual Studio projects.<br />
* ncurses is not supported under Visual Studio.<br />
* The path to the build folder must not have any spaces otherwise generation of QVMs will fail. See {{Issue|102}}.<br />
* Due to limitations with CMake, neither the startup project nor the working directory can be specified. These must be set manually to debug the client with Visual Studio:<br />
** Right click on client and select "Set as StartUp project".<br />
** Right click on client, select properties, select Debugging and set "Working Directory" to <code>$(TargetPath)\..</code>.<br />
<br />
===MinGW===<br />
<br />
It is possible to build Unvanquished with MinGW, although the process is rather arduous compared to Visual Studio or compiling for other platforms.<br />
<br />
====Notes====<br />
<br />
* The easiest way to acquire and install MinGW is with the graphical [http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/ mingw-get-inst installer]. <!-- TODO: maybe walk the user through the installer? --><br />
* When configuring the build with CMake, you will find that you will have to set a number of libraries manually. You can find precompiled DLLs for most of the dependencies; those that are not pre-compiled can be built with the corresponding <code>USE_INTERNAL_</code> setting.<br />
* On Windows, SDL requires that the Direct X SDK can be installed. You may download the June 2010 release from [http://www.microsoft.com/en-us/download/details.aspx?id=6812 Microsoft's site].<br />
* '''The build will fail during QVM compilation if your source or build directories contain spaces.''' This is due to a bug with lcc. If your home directory contains a space, you may want to create source and build directories at the root of one of your drives (e.g., <code>C:\Unvanquished\Source</code> and <code>C:\Unvanquished\Build</code>.)<br />
<br />
====Instructions====<br />
<br />
The easiest way to get a build up (at the time of writing) is as follows:<br />
<br />
{{Note|content=Although there are 64-bit binaries of most of the libraries required to build the game, these do not work with MinGW at present, so the following instructions all use the 32-bit binaries.}}<br />
<br />
<ol><br />
<li>Although there are binaries of gmp distributed with the source, they have are dependent on Visual Studio's implementations of <code>_ftol2_sse</code> and <code>_alloca_probe_16</code>. A fix may be found on [http://stackoverflow.com/questions/6753111/static-linking-with-openssl Stack Exchange], but requires that Visual Studio be installed, which defeats the purpose of attempting to use MinGW to compile the source. You can build gmp yourself:<br />
<ol><br />
<li>Download and extract the latest version of the [http://gmplib.org/ GNU MP Bignum Library (GMP)]. (You will need either cygwin with tar and bz2 installed or 7-zip to extract the archive.)</li><br />
<li>Install the following Cygwin packages if you have not already:<br />
* binutils<br />
* gcc<br />
* gcc-g++<br />
* m4<br />
* make<br />
</li><br />
<li>As part of the GMP compilation process, a file called <code>gen-fib.c</code> generates a table of numbers in the Fibonacci sequence. The generated file does not play nicely with Cygwin or MinGW, so you must fix it. Edit <code>gen-fib.c</code>, and at around line 100, change these lines<br />
<pre><br />
for (i = 0; i < fnum; i++)<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
printf ("), /* %d */\n", i-1);<br />
}<br />
printf ("};\n");<br />
</pre><br />
to look like this:<br />
<pre><br />
for (i = 0; i < fnum; i++)<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
printf (")%c /* %d */\n", (i == (fnum-1)) ? ' ' : ',', i-1);<br />
}<br />
printf ("};\n");<br />
</pre><br />
The patch file looks like this:<br />
<pre><br />
@@ -100,7 +100,7 @@<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
- printf ("), /* %d */\n", i-1);<br />
+ printf (")%c /* %d */\n", (i == (fnum-1)) ? ' ' : ',', i-1);<br />
}<br />
printf ("};\n");<br />
}<br />
</pre><br />
</li><br />
<li>Compiling with MinGW does not work, so you will need to compile with Cygwin. At the prompt:<br />
<pre><br />
$ ./configure --disable-static --enable-shared<br />
$ make<br />
</pre><br />
The <code>--disable-static</code> and <code>--enable-shared</code> flags configure GMP to build a DLL instead of a static library. You may optionally perform <code>make install</code>. Additional compilation instructions [http://www.cs.nyu.edu/exact/core/gmp/ are available].<br />
<p>If you experience difficulties with compilation and it appears that MinGW gcc is being detected by <code>configure</code> and not Cygwin gcc, you can try editing your <code>PATH</code> variable:</p><br />
<pre><br />
$ export PATH=`echo $PATH | sed "s|/cygdrive/c/MinGW/bin:||"`<br />
</pre><br />
Re-run <code>configure</code> and <code>make</code> afterwards.<br />
</ol><br />
</li><br />
<li>Download the [http://www.libsdl.org/release/SDL-1.2.15-win32.zip latest stable version] of SDL for Windows. Extract the archive and copy <code>SDL.dll</code> from it to the root of your build directory.</li><br />
<li>Set the following CMake flags:<br />
{| class="wikitable"<br />
! Setting<br />
! Description<br />
! Type<br />
! Value<br />
|-<br />
| <code>USE_INTERNAL_CRYPTO</code><br />
| Use the provided copies of crypto libraries. <!-- FIXME: I think these are nettle and something else --><br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_GLEW</code><br />
| Use the provided copy of GLEW.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_JPEG</code><br />
| Use the provided copy of JPEG.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SDL</code><br />
| Use the provided copy of SDL.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SPEEX</code><br />
| Use the provided copy of Speex.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_WEBP</code><br />
| Use the provided copy of WebP.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_CURSES</code><br />
| Enables/disables curses.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>PNG_LIBRARY</code><br />
| Path to the PNG library DLL.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng/libs/win32/libpng.lib</code><br />
|-<br />
| <code>PNG_PNG_INCLUDE_DIR</code><br />
| Path to the PNG library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng</code><br />
|-<br />
| <code>FREETYPE_LIBRARY</code><br />
| Path to the compiled FreeType library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/lib/freetype.lib</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_freetype2</code><br />
| Path to the FreeType library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/freetype2</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_ft2build</code><br />
| Path to the FreeType library file "ftbuild.h".<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/</code><br />
|-<br />
| <code>GMP_INCLUDE_DIR</code><br />
| Path to the GMP library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/gmp/include</code><br />
|-<br />
| <code>GMP_LIBRARY</code><br />
| Path to the GMP library.<br />
| <code>FILEPATH</code><br />
| <code><var>path/to/compiled/gmp/</var>.libs/cyggmp-10.dll</code><br />
|-<br />
| <code>ZLIB_INCLUDE_DIR</code><br />
| Path to the zlib library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/include</code><br />
|-<br />
| <code>ZLIB_LIBRARY</code><br />
| Path to the zlib library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/lib/x32/zlib1.dll</code><br />
|-<br />
| <code>CURL_LIBRARY</code><br />
| Path to the CURL library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/lib/win32/release/libcurl.dll</code><br />
|-<br />
| <code>CURL_INCLUDE_DIR</code><br />
| Path to the zlib library.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/include/curl</code><br />
|-<br />
| <code>USE_OPENAL</code><br />
| Enables/disables OpenAL support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_THEORA</code><br />
| Enables/disables Theora support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_XVID</code><br />
| Enables/disables Xvid support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CODEC_THEORA</code><br />
| Enables/disables Ogg support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>SDL_LIBRARY</code><br />
| The path to the SDL DLL.<br />
| <code>FILEPATH</code><br />
| <code><var>BuildPath</var>/SDL.dll</code><br />
|-<br />
| <code>SDLMAIN_LIBRARY</code><br />
| Enables/disables Ogg support.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code><br />
|-<br />
|}<br />
Do note that CMake is slash-direction&ndash;agnostic; it can handle both forward- and backslashes on Windows.<br />
<p>If you would like to compile a debug build, change <code>CMAKE_RELEASE_TYPE</code> from <code>Release</code> to <code>Debug</code>.</p><br />
</li><br />
<li>Open <code><var>SourcePath</var>/CMakeLists.txt</code> and edit the line<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi z )<br />
</pre><br />
(around line 1040) to look like this:<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi )<br />
</pre><br />
Also edit around line 1700:<br />
<pre><br />
###########################<br />
#Configure Download Script#<br />
###########################<br />
<br />
if( NOT MSVC )<br />
</pre><br />
to look like this:<br />
<pre><br />
###########################<br />
#Configure Download Script#<br />
###########################<br />
<br />
if( NOT WIN32 )<br />
</pre><br />
</li><br />
<li>Open <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code> and edit the lines:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "SDL.h"<br />
#include "SDL_main.h"<br />
</pre><br />
to look like:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "../../../include/SDL.h"<br />
#include "../../../include/SDL_main.h"<br />
</pre><br />
<li>Open a command prompt and <code>cd</code> to your source directory.</li><br />
<li>Run <code>make</code>:<br />
<pre><br />
> mingw32-make<br />
</pre><br />
If you would like verbose output, set the <code>VERBOSE</code> environment variable before running <code>make</code>.<br />
<pre><br />
> set VERBOSE=1<br />
</pre><br />
To make it easier to build the source, you can create a batch file (call it something like <code>compile.bat</code>) and place it in your build directory:<br />
<pre><br />
@echo off<br />
<br />
set RETURN=compile<br />
<br />
:get_time<br />
:: Thank you, Rob van der Woude:<br />
:: (http://www.robvanderwoude.com/datetimentparse.php)<br />
FOR /F "tokens=1,2,3 delims=:." %%A IN ("%Time%") DO (<br />
SET /A HOURS = 100%%A %% 100<br />
SET /A MINUTES = 100%%B %% 100<br />
SET /A SECONDS = 100%%C %% 100<br />
)<br />
SET /A TICKS=( %HOURS% * 3600 ) + ( %MINUTES% * 60 ) + %SECONDS%<br />
GOTO %RETURN%<br />
<br />
:compile<br />
SET START_TICKS=%TICKS%<br />
<br />
SET VERBOSE=1<br />
:: mingw32-make clean<br />
mingw32-make -j4<br />
<br />
set RETURN=finish<br />
GOTO get_time<br />
<br />
:finish<br />
SET /A COMPILE_TIME=%TICKS% - %START_TICKS%<br />
SET /A MINUTES=%COMPILE_TIME% / 60<br />
SET /A SECONDS=%COMPILE_TIME% %% 60<br />
ECHO.<br />
ECHO Compilation took %MINUTES%m %SECONDS%s.<br />
PAUSE<br />
</pre><br />
</li><br />
<li>Once compilation finishes, you will find that the game will fail to run due to DLL dependencies. To resolve these:<br />
<ul><br />
<li>You will need to move <code>INTERNAL_GLEW</code> from the <code>Release/</code> folder of the build directory to the root of the build directory.</li><br />
<li>You will need to place the following other DLLs in your build directory:<br />
* freetype6.dll<br />
* libbz2.dll<br />
* libcurl.dll<br />
* libogg.dll<br />
* libpng14-14.dll<br />
* libtheora.dll<br />
* libvorbis.dll<br />
* libvorbisfile.dll<br />
* msvcr100.dll<br />
* msvcr100d.dll<br />
* zlib1.dll<br />
* zlibwapi.dll<br />
The easiest way to obtain these DLLs is by copying them from the installation directory of an [http://sourceforge.net/projects/unvanquished/files/latest/download official release] of Unvanquished.<br />
</li><br />
<li>You will need to copy your compiled DLL of GMP to your build directory. It may be found in <code><var>path/to/compiled/gmp/</var>.libs/cyggmp-10.dll</code>.</li><br />
<li>As you compiled GMP with Cygwin, it in turn depends on <code>cygwin1.dll</code>, which may typically be found in <code>C:\cygwin\bin\</code>. Copy and paste it into your build directory.</li><br />
</ul><br />
Once you have completed these steps, you should never have to do them again.<br />
</li><br />
</ol><br />
<br />
====Notes====<br />
<br />
* If you would like to use curses, try using [http://sourceforge.net/projects/pdcurses/files/pdcurses PDCurses].<br />
<br />
===QtCreator===<br />
<br />
# Install MinGW and follow the above instructions, except select Code::Blocks as the generator.<br />
# Start QtCreator, and select "Open File or Project&hellip;" from the File menu.<br />
# Navigate to your source directory and open CMakeLists.txt.<br />
# At the CMake Wizard, select the same build directory you already configured using CMake. (If you did not chose Code::Blocks as the generator, you will have to start over again, as QtCreator requires a Code::Blocks project file in order to compile the source.)<br />
# Ensure that a generator is selected in the combo box, and click "Run CMake". If there is no generator listed, see the [[#Troubleshooting|troubleshooting]] section below.<br />
# Click "Finish" to close the wizard.<br />
<br />
You should now be able to compile, run, and debug the code using QtCreator.<br />
<br />
====Troubleshooting====<br />
<br />
If at the "Run CMake" prompt of the the CMake Wizard, select "Run CMake" and are warned that no generator was selected, and notice that there are no generators in the combo box, you will likely have to [http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html manually configure your toolchain]. Select "Options&hellip;" from the "Tools" menu, then navigate to "Build &amp; Run".<br />
<br />
At the options window,<br />
* Go to the "Kits" tab, and mouse over the "Desktop (default)" kit under "Manual". If there were any errors in configuring this kit, they will be displayed in the tool tip. If there are problems, select the kit. You may need to manually specify the location of the MinGW debugger, for example, which is typically <code>C:\MinGW\bin\gdb.exe</code>.<br />
* Go to the "Compilers" tab, and ensure that MinGW is present. If not, you will need to add it manually.<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 />
libgmp3-dev libjpeg8-dev libncurses5-dev libogg-dev libopenal-dev \<br />
libpng12-dev libsdl1.2-dev libvorbis-dev zlib1g-dev nettle-dev \<br />
libwebp-dev libspeexdsp-dev libtheora-dev<br />
<br />
If the version of WebP supplied by your version of Debian or Ubuntu is older than v0.2.0, you will need to [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0.tar.gz download] and [https://developers.google.com/speed/webp/docs/compiling#unix compile it from source]. After compiling and installing with <code>sudo make install</code>, in CMake, you'll need to set <code>WEBP_INCLUDE_DIR</code> to <code>/usr/local/include/webp</code> and <code>WEBP_LIBRARY</code> to <code>/usr/local/lib/libwebp.so</code>.<br />
<br />
'''We currently provide a ready-to-use libwebp-dev in our [http://{{SERVERNAME}}/index.php/Download#ubuntu Debian and Ubuntu repositories], alongside .debs of the game and server.'''<br />
<br />
Actual dev package names may vary, e.g. libgmp-dev instead of libgmp3-dev and libglew-dev or libglew1.7-dev instead of libglew1.5-dev.<br />
<br />
Since we have a debian directory in the source, you can also to check what's needed then install the listed packages (choosing from alternatives as needed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ dpkg-checkbuilddeps<br />
…<br />
$ sudo apt-get install <var>package(s)</var><br />
<br />
If dpkg-checkbuilddeps produces no output, you have all necessary build dependencies. Also, debhelper's only needed if you're building .debs.<br />
<br />
====Gentoo====<br />
<br />
$ emerge curl freetype glew gmp jpeg ncurses libogg openal libpng libsdl libvorbis zlib<br />
<br />
====openSUSE====<br />
<br />
$ sudo install zypper gcc gcc-c++ Mesa-libGL-devel SDL-devel libjpeg8-devel \<br />
libpng12-devel glew-devel webp-devel ncurses-devel gmp-devel libcurl-devel \<br />
libnettle-devel openal-soft-devel speex-devel libvorbis-devel \<br />
libtheora-devel<br />
<br />
The latest version of WebP must be installed manually:<br />
<br />
$ wget https://webp.googlecode.com/files/libwebp-0.2.1.tar.gz<br />
$ tar xvzf libwebp-0.2.1.tar.gz<br />
$ cd libwebp-0.2.1<br />
$ ./configure && make<br />
$ sudo make install<br />
<br />
You must disable curses (set <code>USE_CURSES</code> appropriately in CMake) as failing to do so will cause Unvanquished to crash on startup.<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 />
On Debian or 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 />
Or, in Debian or Ubuntu, you can build a package (but you'll need to have devscripts and fakeroot installed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ fakeroot dpkg-buildpackage -b -uc<br />
$ sudo dpkg -i <var>../unvanquished_*.deb</var><br />
<br />
Once in <code>ccmake</code>, use the following keys:<br />
<br />
* Press {{Hotkey|c}} to configure. If an error occurs during this phase, make note of it and press {{Hotkey|e}} to dismiss it.<br />
* Use the up and down arrow keys to navigate the compilation options.<br />
* Press {{Hotkey|Enter}} to enable or disable boolean options (i.e., on/off) or to edit textual options.<br />
** Press {{Hotkey|Esc}} when editing a textual option to cancel the change.<br />
<br />
Once you have finished the configuration process, press {{Hotkey|C}} again, then {{Hotkey|G}} 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=====<br />
<br />
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_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 />
* <code>USE_CIN_THEORA</code> &mdash; Disabling this prevents videos from being recorded in Theora.<br />
* <code>USE_CIN_XVID</code> &mdash; Disabling this prevents videos from being recorded in Xvid.<br />
* <code>USE_VOIP</code> &mdash; Disabling this removes VOIP support. Alternatively enabling <code>USE_INTERNAL_SPEEX</code> will use the libraries distributed with Unvanquished for VoIP<br />
* <code>USE_INTERNAL_CRYPTO</code> &mdash; Enable this to use the crypto libraries provided by Unvanquished.<br />
<br />
===Compiling===<br />
<br />
$ cd <var>path/to/unvanquished/build</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 />
===Acquiring mandatory game files===<br />
<br />
The game files are not in the Git repository, and must be downloaded separately. This may be done on the command line or from your web browser. The downloads may be found on [http://sourceforge.net/projects/unvanquished/files/Assets SourceForge.net]. If you download the files from your browser, just download the files named "pak*.pk3", and save them to the [[Running_the_game#Data_locations|data location]] for your system.<br />
<br />
On Linux, this may be done as follows:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
wget -O $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On FreeBSD, using the <code>sh</code> shell:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
fetch -r -o $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On Mac OS X:<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
curl -L "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download" > $file<br />
fi<br />
done<br />
<br />
Linux users may also use the <code>download-pk3.sh</code> script that is distributed with the source code, which requires that curl be installed:<br />
<br />
$ cd <var>[path to Unvanquished source code]</var><br />
$ mkdir -p ~/.Unvanquished/main<br />
$ ./download-pk3.sh ~/.Unvanquished/main<br />
<br />
===Downloading the map pack===<br />
<br />
The map pack exists only for convenience; if you do not download the map pack, Unvanquished will automatically download maps as needed when you attempt to play online.<br />
<br />
To download the map pack on Linux:<br />
<br />
$ wget -O maps.7z "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z"; done<br />
<br />
To download the map pack on Mac OS X:<br />
<br />
$ curl -L "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z" > maps.7z; done<br />
<br />
Note that you will need to unzip the map pack on either system as it is compressed with LZMA. Mac users can use the [http://wakaba.c3.cx/s/apps/unarchiver.html Unarchiver]. Uncompressing the archive on Linux is highly dependent on your distribution.<br />
<br />
===Verifying the Files===<br />
<br />
Download the latest [http://sourceforge.net/projects/unvanquished/files/Assets/{{CurrentVersion|MD5HashFile}} MD5 hash file] and save it to your system's [[Running_the_game#Data_directory|data location]].<br />
<br />
On systems with the <code>md5</code> command (Mac OS X):<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ cat {{CurrentVersion|MD5HashFile}} | while read line; do<br />
file="`echo "$line" | sed -E "s/^[a-fA-F0-9]+ +\*?//"`"<br />
if [ -e "$file" ]; then<br />
if [ `md5 -r "$file" | cut -d\ -f1` = "`echo "$line" | cut -d\ -f1`" ]<br />
then echo "File \"$file\" appears okay."<br />
else echo "File \"$file\" is corrupt"'!' >&2<br />
fi; fi; done<br />
<br />
On systems with the <code>md5sum</code> command (most Linux distributions):<br />
<br />
$ cd <var>[[Running_the_game#Data_directory|/path/to/data/files]]</var><br />
$ md5sum -c {{CurrentVersion|MD5HashFile}} 2>&1 | grep -v "open or read\|file or directory"<br />
<br />
The <code>grep</code> invocation is used to strip output complaining about missing files.<br />
<br />
Any files that are found to be corrupt should be replaced; just download a [http://sourceforge.net/projects/unvanquished/files/Assets new copy] of the affected file(s).<br />
<br />
==Errors==<br />
<br />
===CMake cannot locate Newton===<br />
<br />
If CMake cannot find Newton, you'll need to set it up yourself.<br />
<br />
It should be in <code><var>/path/to/Unvanquished</var>/src/libs/libnewton/libs/<var>your_os</var>/libNewton.so</code>.<br />
Be sure to replace <var>your_os</var> with the proper directory name.<br />
<br />
Use CMake as before to change the <code>NEWTON_LIBRARY</code> build setting to the said path:<br />
<br />
# Start the CMake configurator:<pre>$ ccmake ..</pre><br />
# Scroll down and highlight <code>NEWTON_LIBRARY</code>.<br />
# Press {{Hotkey|Enter}} to begin editing and input in the path.<br />
# Press {{Hotkey|C}} to configure and {{Hotkey|G}} to generate the new makefiles.<br />
# Press {{Hotkey|Q}} to quit.<br />
# Recompile the source:<pre>$ make</pre><br />
<br />
===The C Compiler is not able to compile a simple test program===<br />
<br />
When attempting to generate a solution for Xcode CMake fails with the following error<br />
-- Check for working C compiler using: Xcode -- broken<br />
CMake Error at /Applications/CMake 2.8-8.app/Contents/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):<br />
The C compiler "/usr/bin/gcc" is not able to compile a simple test program.<br />
<br />
It fails with the following output:<br />
<br />
Change Dir: /Users/danielmaloney/Documents/Unvanquished/build-xcode/CMakeFiles/CMakeTmp<br />
<br />
<br />
<br />
Run Build Command:/Applications/CMake\ 2.8-8.app/Contents/bin/cmakexbuild<br />
-project CMAKE_TRY_COMPILE.xcodeproj build -target<br />
cmTryCompileExec1400153232 -configuration Debug<br />
<br />
Error: No developer directory found at /Developer. Run<br />
/usr/bin/xcode-select to update the developer directory path.<br />
<br />
<br />
<br />
<br />
<br />
CMake will not be able to correctly generate this project.<br />
Call Stack (most recent call first):<br />
CMakeLists.txt:19 (project)<br />
<br />
This is due to Xcode 4.3 having a different directory structure to previous versions. Simply running the following command will correct this error:<br />
sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer/</div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Compiling_the_source&diff=1969Compiling the source2013-04-15T22:06:44Z<p>Velociostrich: /* Configuring with CMake */ s/Xcode/CMake</p>
<hr />
<div>==Mac OS X==<br />
<br />
First, you need to [[Getting_the_source|acquire the source code]].<br />
<br />
Regardless of what interface you may use to compile the source, you will need [http://www.cmake.org/cmake/resources/software.html CMake] to generate makefiles. You will also need to install [https://developer.apple.com/xcode/ Xcode] (making sure to choose to install the command-line utilities when prompted by the installer).<br />
<br />
Then, you will need to acquire (and in some cases, manually compile) at a minimum the [[#Dependencies|necessary libraries]].<br />
<br />
Once you have the source code and the libraries installed, you may actually proceed to compile the source. You have several options:<br />
* '''Compile the source at the command line'''. This is the easiest if you would just like to compile the game to use yourself and you do not intend to work on the code.<br />
* '''Compile the source using an IDE'''. This is preferred if you intend on developing the source.<br />
** Xcode is Apple's flagship IDE and you should have installed to compile the source regardless of which method you use.<br />
** [http://qt-project.org/downloads QtCreator] is cross-platform and provides real-time feedback of syntax errors, a Vim mode, as well as other features.<br />
** [http://www.codeblocks.org/ Code::Blcoks] is also cross-platform but lacks some of the features of Xcode and QtCreator.<br />
<br />
===Dependencies===<br />
<br />
You only need to use one of the following methods (HomeBrew or compiling by hand). Please try and avoid mixing methods as this may produce unexpected results.<br />
<br />
Unvanquished requires the following libraries:<br />
* [[#JPEG|JPEG]], version 8 or higher. (Version 6 was known to have problems)<br />
* [[#Simple_DirectMedia_Layer_.28SDL.29|Simple DirectMedia Layer]] (The binary provided by libsdl.org causes graphical corruptions. Compile from source or use homebrew/macports)<br />
* [[#The_OpenGL_Extension_Wrangler_Library_.28GLEW.29|The OpenGL Extension Wrangler Library]]<br />
* CuRL<br />
* [[#The_GNU_MP_Bignum_Library_.28libgmp.29|GMP]]<br />
* [[#WebP|WebP]] (v0.2.0 or newer)<br />
<br />
The following libraries are optional:<br />
* Theora<br />
* Speex<br />
* [[#Ogg|Ogg]]<br />
* [[#Vorbis|Vorbis]]<br />
<br />
====HomeBrew====<br />
Install [http://mxcl.github.com/homebrew/ HomeBrew] and then run the following command<br />
<br />
$ brew install nettle libjpeg curl sdl webp xvid gmp glew speex libvorbis theora<br />
<br />
All the necessary libraries should now have been installed.<br />
<br />
====Compiling by hand====<br />
The following are shell scripts that download, compile, and install various libraries. This is more time consuming then other methods but might be useful if you need more control over your libraries<br />
<br />
=====JPEG=====<br />
<br />
$ curl http://www.ijg.org/files/jpegsrc.v8d.tar.gz > jpegsrc.v8d.tar.gz<br />
$ tar xvzf jpegsrc.v8d.tar.gz<br />
$ cd jpeg-8d<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The OpenGL Extension Wrangler Library (GLEW)=====<br />
<br />
$ curl -L https://sourceforge.net/projects/glew/files/glew/1.7.0/glew-1.7.0.tgz/download > glew-1.7.0.tgz<br />
$ tar xvzf glew-1.7.0.tgz<br />
$ cd glew-1.7.0<br />
$ make<br />
$ sudo make install<br />
<br />
=====Simple DirectMedia Layer (SDL)=====<br />
<br />
Do not use the binaries provided by libsdl.org, as these are known to cause issues with gamma and color display. Instead, compile your own:<br />
<br />
$ curl http://www.libsdl.org/release/SDL-1.2.15.tar.gz > SDL-1.2.15.tar.gz<br />
$ tar xvzf SDL-1.2.15.tar.gz<br />
$ cd SDL-1.2.15<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The GNU MP Bignum Library (libgmp)=====<br />
<br />
$ curl ftp://ftp.gmplib.org/pub/gmp-5.0.5/gmp-5.0.5.tar.bz2 > gmp-5.0.5.tar.bz2<br />
$ tar xvjf gmp-5.0.5.tar.bz2<br />
$ cd gmp-5.0.5<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Ogg=====<br />
<br />
$ curl http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz > libogg-1.3.0.tar.gz<br />
$ tar xvzf libogg-1.3.0.tar.gz<br />
$ cd libogg-1.3.0<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Vorbis=====<br />
<br />
$ curl http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz > libvorbis-1.3.3.tar.gz<br />
$ tar xvzf libvorbis-1.3.3.tar.gz<br />
$ cd libvorbis-1.3.3<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====WebP=====<br />
<br />
You do not need to compile WebP by hand; Google provides binaries for Mac OS X available from their [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0-mac-10.5.tar.gz project page]. You will need version 0.2.0 or newer.<br />
<br />
Once downloaded, you must still install the header files and the binary:<br />
<br />
$ curl https://webp.googlecode.com/files/libwebp-0.2.0-mac-10.5.tar.gz > libwebp-0.2.0-mac-10.5.tar.gz<br />
$ tar xvzf libwebp-0.2.0-mac-10.5.tar.gz<br />
$ cd libwebp-0.2.0-mac-10.5<br />
$ sudo cp include/webp /usr/local/include<br />
$ sudo cp lib/libwebp.a /usr/local/lib<br />
<br />
===Configuring with CMake===<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 should be a different directory.<br />
# Hit "Configure". You will be prompted as to which generator you would like to use. If you have Xcode installed, choose that. Wait while the configuration process runs. You may have to set the following:<br />
## If CMake did not find your jpeg headers for some reason, set <code>JPEG_INCLUDE_DIR</code> to <code>/path/to/Unvanquished/src/libs/jpeg</code>.<br />
## Check <code>USE_INTERNAL_CRYPTO</code> to avoid having to compile nettle and hogweed.<br />
## Check <code>USE_INTERNAL_SPEEX</code> to avoid having to compile Speex.<br />
## Uncheck <code>USE_CIN_THEORA</code> and <code>USE_CIN_XVID</code> to avoid having to compile Theora or Xvid. (At present, there are not cutscenes or any such that require it.)<br />
## '''You will probably not be able to compile with the GLSL optimizer enabled; uncheck <code>USE_GLSL_OPTIMIZER</code>'''<br />
## If you have selected to generate Xcode project files, make the <code>SDLMAIN_LIBRARY</code> field blank. This option is not available if you have the generator set to Unix makefiles.<br />
# Hit "Generate".<br />
# You may now close CMake.<br />
<br />
===Compiling===<br />
<br />
====With Xcode====<br />
<br />
<ol><br />
<li>Compilation will fail unless you manually create certain directories needed by the build scripts:<br />
<pre><br />
$ cd /path/to/build/dir/CMakeFiles<br />
$ mkdir gpp{game,trem,ui}-qvm.dir<br />
</pre><br />
This is a workaround to {{Issue|101}}.<br />
</li><br />
<li>Either start Xcode and open the project file (in the build directory you specified) or double-click the project file in Finder.</li><br />
<li>Open the project file created by CMake, which should be in the build directory you specified.</li><br />
<li>Change the active target to "ALL_BUILD" and click Product&rarr;Build.</li><br />
</ol><br />
<br />
====With Unix Makefiles====<br />
<br />
<ul><br />
<li>Start Terminal (Applications &rarr; Utilities &rarr; Terminal).</li><br />
<li>Input the following commands:<br />
<pre><br />
$ cd /path/to/Unvanquished-build<br />
$ make<br />
</pre><br />
If you are on a multi-core or multi-processor machine, you may speed up the process by passing the <code>-j</code> argument followed by the number of available cores to <code>make</code>; e.g., <code>make -j4</code>. Note that doing so makes reading error messages more difficult, as multiple instances of the compiler will print to the screen at once, causing information to appear out of order.<br />
</li><br />
</ul><br />
<br />
===Testing the build===<br />
<br />
====With Xcode 4====<br />
<br />
To test the game, select the "client" scheme from the combo box on the toolbar, and click the run button or press {{Hotkey|MacCommand}}{{Hotkey|R}}.<br />
<br />
====With Unix Makefiles====<br />
<br />
After compiling, you'll have to place the data files in the <code>main</code> directory in your build directory. [[#Acquiring the Game Files|For download instructions, see below.]]<br />
<br />
Your file structure should look as follows:<br />
<br />
[[File:Build_dir_Mac_OS_X.png]]<br />
<br />
You may now start the application as such:<br />
<br />
$ ./daemon.i386<br />
<br />
Note that older machines will not support the new OpenGL 3 renderer, and must be started specifying the "vanilla" (aka "GL") renderer:<br />
<br />
$ ./daemon.i386 +set cl_renderer GL<br />
<br />
===Bundling the Application===<br />
<br />
====With CPack====<br />
<br />
CPack is able to create standalone bundles (as well as many other types of installers). However you must generate the files using Unix Makefiles instead of Xcode.<br />
<br />
$ cd /path/to/Unvanquished-build<br />
$ cpack -G Bundle<br />
<br />
Some warnings will be printed however these can be safely ignored. There should be a file called Unvanquished.dmg in the Unvanquished-build folder.<br />
<br />
====Manually====<br />
<br />
You'll find the Mac [http://macdylibbundler.sourceforge.net/ dynamic library bundler] to be quite useful (you must generate the files using Unix Makefiles instead of Xcode):<br />
<br />
$ curl -L http://sourceforge.net/projects/macdylibbundler/files/macdylibbundler/0.4.1/dylibbundler0.4.1.zip/download > \<br />
dylibbundler0.4.1.zip<br />
$ unzip dylibbundler0.4.1.zip<br />
$ cd dylibbundler<br />
$ make<br />
$ sudo make install<br />
<br />
Once you've done that, you can proceed to create the application bundle. Note that these steps assume that you have downloaded the data files to <code>main/</code> as shown above:<br />
<br />
<pre><br />
$ git=/path/to/Unvanquished-git-repo<br />
$ build=/path/to/Unvanquished-build-dir<br />
$ mkdir -pv Unvanquished.app/Contents/{libs,MacOS,Resources,Frameworks}<br />
$ cp -r $build/main Unvanquished.app/Contents/MacOS<br />
$ sips -s format tiff $git/debian/unvanquished.png --out temp.tiff<br />
$ tiff2icns temp.tiff Unvanquished.app/Contents/Resources/Unvanquished.icns<br />
$ rm temp.tiff<br />
$ cp $build/daemon{,ded}.i386 $build/*.dylib Unvanquished.app/Contents/MacOS<br />
$ cp -r /Library/Frameworks/SDL.framework Unvanquished.app/Contents/Frameworks<br />
$ install_name_tool -id \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/Frameworks/SDL.framework/Versions/A/SDL<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGLi386.dylib<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGL3i386.dylib<br />
$ for binary in Unvanquished.app/Contents/MacOS/*.{i386,dylib}; do<br />
dylibbundler -b -x $binary -d $dest/Unvanquished.app/Contents/libs/; done<br />
$ cp /usr/lib/libGLEW.1.7.0.dylib ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ chmod +w ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -id @executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -change /usr/lib/libGLEW.1.7.0.dylib \<br />
@executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ cat > Unvanquished.app/Contents/Info.plist<br />
<?xml version="1.0" encoding="UTF-8"?><br />
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"<br />
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"><br />
<plist version="1.0"><br />
<dict><br />
<key>CFBundleName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleDisplayName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleExecutable</key><br />
<string>daemon.i386</string><br />
<key>CFBundleIconFile</key><br />
<string>Unvanquished.icns</string><br />
<key>CFBundleIdentifier</key><br />
<string>net.Unvanquished</string><br />
<key>CFBundleInfoDictionaryVersion</key><br />
<string>6.0</string><br />
<key>CFBundlePackageType</key><br />
<string>APPL</string><br />
<key>CFBundleShortVersionString</key><br />
<string>0.4.0</string><br />
<key>CFBundleVersion</key><br />
<string>0.4.0</string><br />
</dict><br />
</plist><br />
^d<br />
</pre><br />
<br />
Note: <code>^d</code> indicates pressing {{Hotkey|Ctrl}}{{Hotkey|D}} on the keyboard.<br />
<br />
The contents of the completed application bundle should look like this:<br />
<br />
[[File:Bundle_dir_Mac_OS_X.png]]<br />
<br />
'''Note''': If you compiled SDL from source, you will not see a directory titled <code>SDL.framework</code>.<br />
<br />
==Windows==<br />
<br />
===Visual Studio===<br />
<br />
CMake can generate Visual Studio projects for Unvanquished.<br />
<br />
# Run the <code>Visual_Studio32.bat</code> batch script in your source directory by double-clicking it. Alternatively, you may use the <code>Visual_Studio64.bat</code> shell script if you have the [http://www.microsoft.com/en-us/download/details.aspx?id=8279 Windows 7 SDK] installed and a 64-bit system.<br />
# Open <code>build-32/Daemon.sln</code> in Visual Studio 2010.<br />
# In the two text boxes in the toolbar, select "Release" or "Debug" in the first one and Win32 in the second one<br />
# Press {{Hotkey|F5}} to build solution and run application, or just use Build &rarr; Build Solution to compile the code.<br />
<br />
====Important Notes====<br />
<br />
* LLVM is disabled and does not work correctly with CMake generated Visual Studio projects.<br />
* ncurses is not supported under Visual Studio.<br />
* The path to the build folder must not have any spaces otherwise generation of QVMs will fail. See {{Issue|102}}.<br />
* Due to limitations with CMake, neither the startup project nor the working directory can be specified. These must be set manually to debug the client with Visual Studio:<br />
** Right click on client and select "Set as StartUp project".<br />
** Right click on client, select properties, select Debugging and set "Working Directory" to <code>$(TargetPath)\..</code>.<br />
<br />
===MinGW===<br />
<br />
It is possible to build Unvanquished with MinGW, although the process is rather arduous compared to Visual Studio or compiling for other platforms.<br />
<br />
====Notes====<br />
<br />
* The easiest way to acquire and install MinGW is with the graphical [http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/ mingw-get-inst installer]. <!-- TODO: maybe walk the user through the installer? --><br />
* When configuring the build with CMake, you will find that you will have to set a number of libraries manually. You can find precompiled DLLs for most of the dependencies; those that are not pre-compiled can be built with the corresponding <code>USE_INTERNAL_</code> setting.<br />
* On Windows, SDL requires that the Direct X SDK can be installed. You may download the June 2010 release from [http://www.microsoft.com/en-us/download/details.aspx?id=6812 Microsoft's site].<br />
* '''The build will fail during QVM compilation if your source or build directories contain spaces.''' This is due to a bug with lcc. If your home directory contains a space, you may want to create source and build directories at the root of one of your drives (e.g., <code>C:\Unvanquished\Source</code> and <code>C:\Unvanquished\Build</code>.)<br />
<br />
====Instructions====<br />
<br />
The easiest way to get a build up (at the time of writing) is as follows:<br />
<br />
{{Note|content=Although there are 64-bit binaries of most of the libraries required to build the game, these do not work with MinGW at present, so the following instructions all use the 32-bit binaries.}}<br />
<br />
<ol><br />
<li>Although there are binaries of gmp distributed with the source, they have are dependent on Visual Studio's implementations of <code>_ftol2_sse</code> and <code>_alloca_probe_16</code>. A fix may be found on [http://stackoverflow.com/questions/6753111/static-linking-with-openssl Stack Exchange], but requires that Visual Studio be installed, which defeats the purpose of attempting to use MinGW to compile the source. You can build gmp yourself:<br />
<ol><br />
<li>Download and extract the latest version of the [http://gmplib.org/ GNU MP Bignum Library (GMP)]. (You will need either cygwin with tar and bz2 installed or 7-zip to extract the archive.)</li><br />
<li>Install the following Cygwin packages if you have not already:<br />
* binutils<br />
* gcc<br />
* gcc-g++<br />
* m4<br />
* make<br />
</li><br />
<li>As part of the GMP compilation process, a file called <code>gen-fib.c</code> generates a table of numbers in the Fibonacci sequence. The generated file does not play nicely with Cygwin or MinGW, so you must fix it. Edit <code>gen-fib.c</code>, and at around line 100, change these lines<br />
<pre><br />
for (i = 0; i < fnum; i++)<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
printf ("), /* %d */\n", i-1);<br />
}<br />
printf ("};\n");<br />
</pre><br />
to look like this:<br />
<pre><br />
for (i = 0; i < fnum; i++)<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
printf (")%c /* %d */\n", (i == (fnum-1)) ? ' ' : ',', i-1);<br />
}<br />
printf ("};\n");<br />
</pre><br />
The patch file looks like this:<br />
<pre><br />
@@ -100,7 +100,7 @@<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
- printf ("), /* %d */\n", i-1);<br />
+ printf (")%c /* %d */\n", (i == (fnum-1)) ? ' ' : ',', i-1);<br />
}<br />
printf ("};\n");<br />
}<br />
</pre><br />
</li><br />
<li>Compiling with MinGW does not work, so you will need to compile with Cygwin. At the prompt:<br />
<pre><br />
$ ./configure --disable-static --enable-shared<br />
$ make<br />
</pre><br />
The <code>--disable-static</code> and <code>--enable-shared</code> flags configure GMP to build a DLL instead of a static library. You may optionally perform <code>make install</code>. Additional compilation instructions [http://www.cs.nyu.edu/exact/core/gmp/ are available].<br />
<p>If you experience difficulties with compilation and it appears that MinGW gcc is being detected by <code>configure</code> and not Cygwin gcc, you can try editing your <code>PATH</code> variable:</p><br />
<pre><br />
$ export PATH=`echo $PATH | sed "s|/cygdrive/c/MinGW/bin:||"`<br />
</pre><br />
Re-run <code>configure</code> and <code>make</code> afterwards.<br />
</ol><br />
</li><br />
<li>Download the [http://www.libsdl.org/release/SDL-1.2.15-win32.zip latest stable version] of SDL for Windows. Extract the archive and copy <code>SDL.dll</code> from it to the root of your build directory.</li><br />
<li>Set the following CMake flags:<br />
{| class="wikitable"<br />
! Setting<br />
! Description<br />
! Type<br />
! Value<br />
|-<br />
| <code>USE_INTERNAL_CRYPTO</code><br />
| Use the provided copies of crypto libraries. <!-- FIXME: I think these are nettle and something else --><br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_GLEW</code><br />
| Use the provided copy of GLEW.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_JPEG</code><br />
| Use the provided copy of JPEG.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SDL</code><br />
| Use the provided copy of SDL.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SPEEX</code><br />
| Use the provided copy of Speex.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_WEBP</code><br />
| Use the provided copy of WebP.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_CURSES</code><br />
| Enables/disables curses.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>PNG_LIBRARY</code><br />
| Path to the PNG library DLL.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng/libs/win32/libpng.lib</code><br />
|-<br />
| <code>PNG_PNG_INCLUDE_DIR</code><br />
| Path to the PNG library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng</code><br />
|-<br />
| <code>FREETYPE_LIBRARY</code><br />
| Path to the compiled FreeType library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/lib/freetype.lib</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_freetype2</code><br />
| Path to the FreeType library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/freetype2</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_ft2build</code><br />
| Path to the FreeType library file "ftbuild.h".<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/</code><br />
|-<br />
| <code>GMP_INCLUDE_DIR</code><br />
| Path to the GMP library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/gmp/include</code><br />
|-<br />
| <code>GMP_LIBRARY</code><br />
| Path to the GMP library.<br />
| <code>FILEPATH</code><br />
| <code><var>path/to/compiled/gmp/</var>.libs/cyggmp-10.dll</code><br />
|-<br />
| <code>ZLIB_INCLUDE_DIR</code><br />
| Path to the zlib library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/include</code><br />
|-<br />
| <code>ZLIB_LIBRARY</code><br />
| Path to the zlib library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/lib/x32/zlib1.dll</code><br />
|-<br />
| <code>CURL_LIBRARY</code><br />
| Path to the CURL library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/lib/win32/release/libcurl.dll</code><br />
|-<br />
| <code>CURL_INCLUDE_DIR</code><br />
| Path to the zlib library.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/include/curl</code><br />
|-<br />
| <code>USE_OPENAL</code><br />
| Enables/disables OpenAL support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_THEORA</code><br />
| Enables/disables Theora support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_XVID</code><br />
| Enables/disables Xvid support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CODEC_THEORA</code><br />
| Enables/disables Ogg support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>SDL_LIBRARY</code><br />
| The path to the SDL DLL.<br />
| <code>FILEPATH</code><br />
| <code><var>BuildPath</var>/SDL.dll</code><br />
|-<br />
| <code>SDLMAIN_LIBRARY</code><br />
| Enables/disables Ogg support.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code><br />
|-<br />
|}<br />
Do note that CMake is slash-direction&ndash;agnostic; it can handle both forward- and backslashes on Windows.<br />
<p>If you would like to compile a debug build, change <code>CMAKE_RELEASE_TYPE</code> from <code>Release</code> to <code>Debug</code>.</p><br />
</li><br />
<li>Open <code><var>SourcePath</var>/CMakeLists.txt</code> and edit the line<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi z )<br />
</pre><br />
(around line 1040) to look like this:<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi )<br />
</pre><br />
Also edit around line 1700:<br />
<pre><br />
###########################<br />
#Configure Download Script#<br />
###########################<br />
<br />
if( NOT MSVC )<br />
</pre><br />
to look like this:<br />
<pre><br />
###########################<br />
#Configure Download Script#<br />
###########################<br />
<br />
if( NOT WIN32 )<br />
</pre><br />
</li><br />
<li>Open <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code> and edit the lines:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "SDL.h"<br />
#include "SDL_main.h"<br />
</pre><br />
to look like:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "../../../include/SDL.h"<br />
#include "../../../include/SDL_main.h"<br />
</pre><br />
<li>Open a command prompt and <code>cd</code> to your source directory.</li><br />
<li>Run <code>make</code>:<br />
<pre><br />
> mingw32-make<br />
</pre><br />
If you would like verbose output, set the <code>VERBOSE</code> environment variable before running <code>make</code>.<br />
<pre><br />
> set VERBOSE=1<br />
</pre><br />
To make it easier to build the source, you can create a batch file (call it something like <code>compile.bat</code>) and place it in your build directory:<br />
<pre><br />
@echo off<br />
<br />
set RETURN=compile<br />
<br />
:get_time<br />
:: Thank you, Rob van der Woude:<br />
:: (http://www.robvanderwoude.com/datetimentparse.php)<br />
FOR /F "tokens=1,2,3 delims=:." %%A IN ("%Time%") DO (<br />
SET /A HOURS = 100%%A %% 100<br />
SET /A MINUTES = 100%%B %% 100<br />
SET /A SECONDS = 100%%C %% 100<br />
)<br />
SET /A TICKS=( %HOURS% * 3600 ) + ( %MINUTES% * 60 ) + %SECONDS%<br />
GOTO %RETURN%<br />
<br />
:compile<br />
SET START_TICKS=%TICKS%<br />
<br />
SET VERBOSE=1<br />
:: mingw32-make clean<br />
mingw32-make -j4<br />
<br />
set RETURN=finish<br />
GOTO get_time<br />
<br />
:finish<br />
SET /A COMPILE_TIME=%TICKS% - %START_TICKS%<br />
SET /A MINUTES=%COMPILE_TIME% / 60<br />
SET /A SECONDS=%COMPILE_TIME% %% 60<br />
ECHO.<br />
ECHO Compilation took %MINUTES%m %SECONDS%s.<br />
PAUSE<br />
</pre><br />
</li><br />
<li>Once compilation finishes, you will find that the game will fail to run due to DLL dependencies. To resolve these:<br />
<ul><br />
<li>You will need to move <code>INTERNAL_GLEW</code> from the <code>Release/</code> folder of the build directory to the root of the build directory.</li><br />
<li>You will need to place the following other DLLs in your build directory:<br />
* freetype6.dll<br />
* libbz2.dll<br />
* libcurl.dll<br />
* libogg.dll<br />
* libpng14-14.dll<br />
* libtheora.dll<br />
* libvorbis.dll<br />
* libvorbisfile.dll<br />
* msvcr100.dll<br />
* msvcr100d.dll<br />
* zlib1.dll<br />
* zlibwapi.dll<br />
The easiest way to obtain these DLLs is by copying them from the installation directory of an [http://sourceforge.net/projects/unvanquished/files/latest/download official release] of Unvanquished.<br />
</li><br />
<li>You will need to copy your compiled DLL of GMP to your build directory. It may be found in <code><var>path/to/compiled/gmp/</var>.libs/cyggmp-10.dll</code>.</li><br />
<li>As you compiled GMP with Cygwin, it in turn depends on <code>cygwin1.dll</code>, which may typically be found in <code>C:\cygwin\bin\</code>. Copy and paste it into your build directory.</li><br />
</ul><br />
Once you have completed these steps, you should never have to do them again.<br />
</li><br />
</ol><br />
<br />
====Notes====<br />
<br />
* If you would like to use curses, try using [http://sourceforge.net/projects/pdcurses/files/pdcurses PDCurses].<br />
<br />
===QtCreator===<br />
<br />
# Install MinGW and follow the above instructions, except select Code::Blocks as the generator.<br />
# Start QtCreator, and select "Open File or Project&hellip;" from the File menu.<br />
# Navigate to your source directory and open CMakeLists.txt.<br />
# At the CMake Wizard, select the same build directory you already configured using CMake. (If you did not chose Code::Blocks as the generator, you will have to start over again, as QtCreator requires a Code::Blocks project file in order to compile the source.)<br />
# Ensure that a generator is selected in the combo box, and click "Run CMake". If there is no generator listed, see the [[#Troubleshooting|troubleshooting]] section below.<br />
# Click "Finish" to close the wizard.<br />
<br />
You should now be able to compile, run, and debug the code using QtCreator.<br />
<br />
====Troubleshooting====<br />
<br />
If at the "Run CMake" prompt of the the CMake Wizard, select "Run CMake" and are warned that no generator was selected, and notice that there are no generators in the combo box, you will likely have to [http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html manually configure your toolchain]. Select "Options&hellip;" from the "Tools" menu, then navigate to "Build &amp; Run".<br />
<br />
At the options window,<br />
* Go to the "Kits" tab, and mouse over the "Desktop (default)" kit under "Manual". If there were any errors in configuring this kit, they will be displayed in the tool tip. If there are problems, select the kit. You may need to manually specify the location of the MinGW debugger, for example, which is typically <code>C:\MinGW\bin\gdb.exe</code>.<br />
* Go to the "Compilers" tab, and ensure that MinGW is present. If not, you will need to add it manually.<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 />
libgmp3-dev libjpeg8-dev libncurses5-dev libogg-dev libopenal-dev \<br />
libpng12-dev libsdl1.2-dev libvorbis-dev zlib1g-dev nettle-dev \<br />
libwebp-dev libspeexdsp-dev libtheora-dev<br />
<br />
If the version of WebP supplied by your version of Debian or Ubuntu is older than v0.2.0, you will need to [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0.tar.gz download] and [https://developers.google.com/speed/webp/docs/compiling#unix compile it from source]. After compiling and installing with <code>sudo make install</code>, in CMake, you'll need to set <code>WEBP_INCLUDE_DIR</code> to <code>/usr/local/include/webp</code> and <code>WEBP_LIBRARY</code> to <code>/usr/local/lib/libwebp.so</code>.<br />
<br />
'''We currently provide a ready-to-use libwebp-dev in our [http://{{SERVERNAME}}/index.php/Download#ubuntu Debian and Ubuntu repositories], alongside .debs of the game and server.'''<br />
<br />
Actual dev package names may vary, e.g. libgmp-dev instead of libgmp3-dev and libglew-dev or libglew1.7-dev instead of libglew1.5-dev.<br />
<br />
Since we have a debian directory in the source, you can also to check what's needed then install the listed packages (choosing from alternatives as needed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ dpkg-checkbuilddeps<br />
…<br />
$ sudo apt-get install <var>package(s)</var><br />
<br />
If dpkg-checkbuilddeps produces no output, you have all necessary build dependencies. Also, debhelper's only needed if you're building .debs.<br />
<br />
====Gentoo====<br />
<br />
$ emerge curl freetype glew gmp jpeg ncurses libogg openal libpng libsdl libvorbis zlib<br />
<br />
====openSUSE====<br />
<br />
$ sudo install zypper gcc gcc-c++ Mesa-libGL-devel SDL-devel libjpeg8-devel \<br />
libpng12-devel glew-devel webp-devel ncurses-devel gmp-devel libcurl-devel \<br />
libnettle-devel openal-soft-devel speex-devel libvorbis-devel \<br />
libtheora-devel<br />
<br />
The latest version of WebP must be installed manually:<br />
<br />
$ wget https://webp.googlecode.com/files/libwebp-0.2.1.tar.gz<br />
$ tar xvzf libwebp-0.2.1.tar.gz<br />
$ cd libwebp-0.2.1<br />
$ ./configure && make<br />
$ sudo make install<br />
<br />
You must disable curses (set <code>USE_CURSES</code> appropriately in CMake) as failing to do so will cause Unvanquished to crash on startup.<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 />
On Debian or 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 />
Or, in Debian or Ubuntu, you can build a package (but you'll need to have devscripts and fakeroot installed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ fakeroot dpkg-buildpackage -b -uc<br />
$ sudo dpkg -i <var>../unvanquished_*.deb</var><br />
<br />
Once in <code>ccmake</code>, use the following keys:<br />
<br />
* Press {{Hotkey|c}} to configure. If an error occurs during this phase, make note of it and press {{Hotkey|e}} to dismiss it.<br />
* Use the up and down arrow keys to navigate the compilation options.<br />
* Press {{Hotkey|Enter}} to enable or disable boolean options (i.e., on/off) or to edit textual options.<br />
** Press {{Hotkey|Esc}} when editing a textual option to cancel the change.<br />
<br />
Once you have finished the configuration process, press {{Hotkey|C}} again, then {{Hotkey|G}} 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=====<br />
<br />
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_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 />
* <code>USE_CIN_THEORA</code> &mdash; Disabling this prevents videos from being recorded in Theora.<br />
* <code>USE_CIN_XVID</code> &mdash; Disabling this prevents videos from being recorded in Xvid.<br />
* <code>USE_VOIP</code> &mdash; Disabling this removes VOIP support. Alternatively enabling <code>USE_INTERNAL_SPEEX</code> will use the libraries distributed with Unvanquished for VoIP<br />
* <code>USE_INTERNAL_CRYPTO</code> &mdash; Enable this to use the crypto libraries provided by Unvanquished.<br />
<br />
===Compiling===<br />
<br />
$ cd <var>path/to/unvanquished/build</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 />
===Acquiring mandatory game files===<br />
<br />
The game files are not in the Git repository, and must be downloaded separately. This may be done on the command line or from your web browser. The downloads may be found on [http://sourceforge.net/projects/unvanquished/files/Assets SourceForge.net]. If you download the files from your browser, just download the files named "pak*.pk3", and save them to the [[Running_the_game#Data_locations|data location]] for your system.<br />
<br />
On Linux, this may be done as follows:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
wget -O $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On FreeBSD, using the <code>sh</code> shell:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
fetch -r -o $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On Mac OS X:<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
curl -L "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download" > $file<br />
fi<br />
done<br />
<br />
Linux users may also use the <code>download-pk3.sh</code> script that is distributed with the source code, which requires that curl be installed:<br />
<br />
$ cd <var>[path to Unvanquished source code]</var><br />
$ mkdir -p ~/.Unvanquished/main<br />
$ ./download-pk3.sh ~/.Unvanquished/main<br />
<br />
===Downloading the map pack===<br />
<br />
The map pack exists only for convenience; if you do not download the map pack, Unvanquished will automatically download maps as needed when you attempt to play online.<br />
<br />
To download the map pack on Linux:<br />
<br />
$ wget -O maps.7z "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z"; done<br />
<br />
To download the map pack on Mac OS X:<br />
<br />
$ curl -L "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z" > maps.7z; done<br />
<br />
Note that you will need to unzip the map pack on either system as it is compressed with LZMA. Mac users can use the [http://wakaba.c3.cx/s/apps/unarchiver.html Unarchiver]. Uncompressing the archive on Linux is highly dependent on your distribution.<br />
<br />
===Verifying the Files===<br />
<br />
Download the latest [http://sourceforge.net/projects/unvanquished/files/Assets/{{CurrentVersion|MD5HashFile}} MD5 hash file] and save it to your system's [[Running_the_game#Data_directory|data location]].<br />
<br />
On systems with the <code>md5</code> command (Mac OS X):<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ cat {{CurrentVersion|MD5HashFile}} | while read line; do<br />
file="`echo "$line" | sed -E "s/^[a-fA-F0-9]+ +\*?//"`"<br />
if [ -e "$file" ]; then<br />
if [ `md5 -r "$file" | cut -d\ -f1` = "`echo "$line" | cut -d\ -f1`" ]<br />
then echo "File \"$file\" appears okay."<br />
else echo "File \"$file\" is corrupt"'!' >&2<br />
fi; fi; done<br />
<br />
On systems with the <code>md5sum</code> command (most Linux distributions):<br />
<br />
$ cd <var>[[Running_the_game#Data_directory|/path/to/data/files]]</var><br />
$ md5sum -c {{CurrentVersion|MD5HashFile}} 2>&1 | grep -v "open or read\|file or directory"<br />
<br />
The <code>grep</code> invocation is used to strip output complaining about missing files.<br />
<br />
Any files that are found to be corrupt should be replaced; just download a [http://sourceforge.net/projects/unvanquished/files/Assets new copy] of the affected file(s).<br />
<br />
==Errors==<br />
<br />
===CMake cannot locate Newton===<br />
<br />
If CMake cannot find Newton, you'll need to set it up yourself.<br />
<br />
It should be in <code><var>/path/to/Unvanquished</var>/src/libs/libnewton/libs/<var>your_os</var>/libNewton.so</code>.<br />
Be sure to replace <var>your_os</var> with the proper directory name.<br />
<br />
Use CMake as before to change the <code>NEWTON_LIBRARY</code> build setting to the said path:<br />
<br />
# Start the CMake configurator:<pre>$ ccmake ..</pre><br />
# Scroll down and highlight <code>NEWTON_LIBRARY</code>.<br />
# Press {{Hotkey|Enter}} to begin editing and input in the path.<br />
# Press {{Hotkey|C}} to configure and {{Hotkey|G}} to generate the new makefiles.<br />
# Press {{Hotkey|Q}} to quit.<br />
# Recompile the source:<pre>$ make</pre><br />
<br />
===The C Compiler is not able to compile a simple test program===<br />
<br />
When attempting to generate a solution for Xcode CMake fails with the following error<br />
-- Check for working C compiler using: Xcode -- broken<br />
CMake Error at /Applications/CMake 2.8-8.app/Contents/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):<br />
The C compiler "/usr/bin/gcc" is not able to compile a simple test program.<br />
<br />
It fails with the following output:<br />
<br />
Change Dir: /Users/danielmaloney/Documents/Unvanquished/build-xcode/CMakeFiles/CMakeTmp<br />
<br />
<br />
<br />
Run Build Command:/Applications/CMake\ 2.8-8.app/Contents/bin/cmakexbuild<br />
-project CMAKE_TRY_COMPILE.xcodeproj build -target<br />
cmTryCompileExec1400153232 -configuration Debug<br />
<br />
Error: No developer directory found at /Developer. Run<br />
/usr/bin/xcode-select to update the developer directory path.<br />
<br />
<br />
<br />
<br />
<br />
CMake will not be able to correctly generate this project.<br />
Call Stack (most recent call first):<br />
CMakeLists.txt:19 (project)<br />
<br />
This is due to Xcode 4.3 having a different directory structure to previous versions. Simply running the following command will correct this error:<br />
sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer/</div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Technical_Documentation&diff=1968Technical Documentation2013-04-15T18:31:45Z<p>Velociostrich: /* GL3 Renderer */ Update renderer info</p>
<hr />
<div>Currently, this page isn't of much help, but you can change that by editing it!<br />
<br />
==Branches==<br />
<br />
The following branches are under active development and may be of interest:<br />
<br />
* <code>librocket</code> &mdash; Work to integrate libRocket is being done on this branch. libRocket is a library that will allow us to create user interfaces using dialects of HTML and CSS.<br />
* <code>bots2</code> &mdash; New bot code, using behavior trees.<br />
<br />
==Language Oddities==<br />
<br />
<ul><br />
<li>You must use the <code>INLINE</code> macro instead of <code>inline</code>.<br />
<li>You must cast integers that are being used as enum values to an enum type. For example:<br />
<pre><br />
BG_Class ( ( class_t ) self->client->ps.stats[ STAT_CLASS ] )<br />
</pre><br />
</li><br />
</ul><br />
<br />
==Source code & data structure==<br />
<br />
* <code>main/</code> Data associated with the game.<br />
** <code>def/</code> Entity definitions for [[Mapping|Radiant]].<br />
** <code>fonts/</code><br />
** <code>gfx/</code><br />
** <code>glsl/</code> OpenGL shader code.<br />
** <code>lights/</code><br />
** <code>models/</code><br />
** <code>scripts/</code><br />
** <code>sound/</code><br />
** <code>translation/</code><br />
** <code>ui/</code><br />
* <code>src/</code><br />
** <code>engine/</code> Engine source code.<br />
*** <code>asm/</code><br />
*** <code>client/</code><br />
*** <code>null/</code><br />
*** <code>qcommon/</code><br />
*** <code>renderer/</code> Vanilla (fixed-function pipeline) renderer<br />
*** <code>rendererGL/</code> Modern XReal-based renderer<br />
*** <code>server/</code><br />
*** <code>sys/</code><br />
** <code>gamelogic/</code> Code that falls outside the scope of the core engine. These are all run in separate [[virtual machines]].<br />
*** <code>cgame/</code> Client-side game code.<br />
*** <code>game/</code> Server-side game code.<br />
*** <code>ui/</code> User interface code.<br />
<br />
==Program entry point==<br />
<br />
The <code>main</code> function may be found at around line 591 of {{SourceFile|src/engine/sys/sys_main.c}}. Note that some magic happens on the Mac in {{SourceFile|src/engine/sys/SDLMain.m}}.<br />
<br />
==Lag compensation==<br />
<br />
Daemon uses Neil "haste" Toronto's [http://www.ra.is/unlagged/ Unlagged mod].<br />
<br />
==Data Files==<br />
<br />
Daemon uses a variety of file formats. Many of these formats are custom. <!-- just try and provide a dump of all configuration files, then I'll reorganize them --><br />
<br />
* Bot behavior trees<br />
* Player configuration files<br />
** Crosshair configuration<br />
** Pubkey<br />
** GUID<br />
* Server configuration files<br />
** [[Map_layouts|Map layouts]]<br />
** Map rotations<br />
* Particle & trail system files<br />
* Sound configurations<br />
** [[Music_and_sounds#Buildables|Buildables]]<br />
* Model data ([[Exporting_Models#What_is_MD5.3F|discussion of supported formats]])<br />
** Skins<br />
** [[Exporting_Models#MD3_3|MD3 animation configuration files]] &mdash; specify which frames are for which animations<br />
** Configuration files<br />
*** [[Exporting_Models#Buildables_2|Buildables]]<br />
*** [[Exporting_Models#Weapons_2|Weapons]]<br />
*** [[Exporting_Models#Player_models_2|Player models]]<br />
* Map data<br />
** Map geometry (BSPs)<br />
** Color grading configurations<br />
<br />
==Game logic==<br />
<br />
Buildable information is encapsulated in the <code>cg_buildables</code> array (declared in {{SourceFile|src/gamelogic/cgame/cg_main.c|cg_main.c}})<br />
<br />
Constants used to define gamelogic variables are in {{SourceFile|src/gamelogic/game/tremulous.h}}.<br />
<br />
Types:<br />
* <code>buildableInfo_t</code> &mdash; Encapsulates data associated with buildables (sounds, animations, etc.).<br />
* <code>buildable_t</code> &mdash; An enumeration of all buildable types.<br />
* <code>buildableAttributes_t</code> &mdash; Encapsulates gameplay information associated with buildables. There is an array of these called <code>bg_buildableList</code>.<br />
<br />
==Server-side==<br />
<br />
Server game state initialization occurs in <code>G_InitGame()</code> in {{SourceFile|src/gamelogic/game/g_main.c}}.<br />
<br />
==Particle &amp; trail system==<br />
<br />
For now, please see the [http://tremulous.net/manual/#x1-130003.2 Tremulous documentation].<br />
<br />
==GL3 Renderer==<br />
<br />
Source code for the modern OpenGL renderer is located in {{SourceFile|src/engine/rendererGL}}. This renderer is often referred to as the "GL3" renderer, whereas the legacy renderer (found in {{SourceFile|src/engine/renderer}}) is often referred to as the "vanilla" renderer.<br />
<br />
===Notes===<br />
<br />
* There is some (highly experimental and untested) Direct X code mixed in the modern OpenGL renderer code.<br />
Shaders are implemented as subclasses of the <code>GLShader</code> class. All are defined in {{SourceFile|src/engine/rendererGL/gl_shader.h}}.<br />
* Compiled GLSL shader files (located in the hard-coded location <code>"glsl/"</code> with the <code>.bin</code> filename extension) are read by <code>GLShader::LoadShaderBinary()</code>.<br />
* All possible parameters (what OpenGL calls [http://www.opengl.org/sdk/docs/man4/xhtml/glUniform.xml "uniform variables"]) that may be passed to a shader are enumerated in the <code>shaderProgram_t</code> structure in {{SourceFile|src/engine/rendererGL/tr_local.h}}.<br />
* Shaders with duplicate functionality is achieved with multiple inheritance. E.g., <code>gl_genericShader</code> is of type <code>GLShader_generic*</code> which derives from the following classes:<br />
** <code>GLShader</code><br />
** <code>u_ColorMap</code><br />
** <code>u_ColorTextureMatrix</code><br />
** <code>u_ViewOrigin</code><br />
** <code>u_AlphaTest</code><br />
** <code>u_ModelMatrix</code><br />
** <code>u_ModelViewProjectionMatrix</code><br />
** <code>u_ColorModulate</code><br />
** <code>u_Color</code><br />
** <code>u_BoneMatrix</code><br />
** <code>u_VertexInterpolation</code><br />
** <code>u_PortalPlane</code><br />
** <code>GLDeformStage</code><br />
** <code>GLCompileMacro_USE_PORTAL_CLIPPING</code><br />
** <code>GLCompileMacro_USE_ALPHA_TESTING</code><br />
** <code>GLCompileMacro_USE_VERTEX_SKINNING</code><br />
** <code>GLCompileMacro_USE_VERTEX_ANIMATION</code><br />
** <code>GLCompileMacro_USE_DEFORM_VERTEXES</code><br />
** <code>GLCompileMacro_USE_TCGEN_ENVIRONMENT</code><br />
** <code>GLCompileMacro_USE_TCGEN_LIGHTMAP</code><br />
* GLSL shaders may be found in <code>main/glsl/</code>. Please see the [[GLSL Shaders|full article]] for a complete listing.<br />
<br />
===Helper classes===<br />
<br />
As mentioned above, shader classes make use of multiple inheritance to give them the relevant methods for controlling their behavior.<br />
<br />
====Uniform variables====<br />
<br />
Uniform variables are enumerated in the <code>shaderProgram_t</code> structure in {{SourceFile|src/engine/rendererGL/tr_local.h}}, and are controlled by classes beginning with the <code>u_</code> prefix:<br />
<br />
* u_BoneMatrix &mdash; Provides the convenience method <code>SetUniform_BoneMatrix</code>.<br />
<br />
====Compile macros====<br />
<br />
* <code>GLCompileMacro_USE_ALPHA_TESTING</code><br />
* <code>GLCompileMacro_USE_PORTAL_CLIPPING</code><br />
* <code>GLCompileMacro_USE_FRUSTUM_CLIPPING</code><br />
* <code>GLCompileMacro_USE_VERTEX_SKINNING</code><br />
* <code>GLCompileMacro_USE_VERTEX_ANIMATION</code><br />
* <code>GLCompileMacro_USE_DEFORM_VERTEXES</code><br />
* <code>GLCompileMacro_USE_TCGEN_ENVIRONMENT</code><br />
* <code>GLCompileMacro_USE_TCGEN_LIGHTMAP</code><br />
* <code>GLCompileMacro_USE_NORMAL_MAPPING</code><br />
* <code>GLCompileMacro_USE_PARALLAX_MAPPING</code><br />
* <code>GLCompileMacro_USE_REFLECTIVE_SPECULAR</code><br />
* <code>GLCompileMacro_TWOSIDED</code><br />
* <code>GLCompileMacro_EYE_OUTSIDE</code><br />
* <code>GLCompileMacro_BRIGHTPASS_FILTER</code><br />
* <code>GLCompileMacro_LIGHT_DIRECTIONAL</code><br />
* <code>GLCompileMacro_USE_SHADOWING</code><br />
* <code>GLCompileMacro_USE_GBUFFER</code><br />
<br />
===Resources===<br />
<br />
Mac OS X users with XCode installed can access OpenGL man pages via the terminal. <!-- TODO: discuss how to get these on windows or linux? --><br />
<br />
Alternatively, OpenGL API reference documentation is available online:<br />
* [http://www.opengl.org/sdk/docs/man3/ OpenGL 3.3 Reference Pages]<br />
* [http://www.opengl.org/sdk/docs/manglsl/ OpenGL Shading Language (GLSL) Reference Pages]<br />
* [http://www.khronos.org/files/opengl-quick-reference-card.pdf OpenGL 3.3 &amp; GLSL Quick Reference Card]<br />
<br />
==Valgrind and fglrx==<br />
<br />
fglrx drivers cause Valgrind to spew out a lot of false errors. You can suppress these by using the --suppressions=/path/to/file.supp flag. You must pass the full path (no use of the tilde symbol). The following [http://www.mediafire.com/?z6ehwrxpw2m469h file] can be used as a template for your suppression file. Keep in mind that the location of the fglrx library may need to be changed.<br />
<br />
==Resources==<br />
<br />
===Publications===<br />
<br />
<ul><br />
<li>[http://halo.bungie.net/Inside/publications.aspx Bungie, Inc.] &mdash; creators of the Marathon, Myth, and Halo franchises.</li><br />
<li>[http://dice.se/publications/ DICE SE] &mdash; creators of the Battlefield franchise.</li><br />
<li>[http://www.guerrilla-games.com/publications/ Guerilla Games] &mdash; creators of the Killzone franchise.<br />
<p>Also of interest is the "Making of Killzone 2" video series, not listed on their site:</p><br />
* [http://www.ign.com/videos/2009/01/27/killzone-2-ps3-the-making-of-killzone-2-part-1?objectid=748475 Part 1]<br />
* [http://www.ign.com/videos/2009/01/27/killzone-2-ps3-the-making-of-killzone-2-part-2?objectid=748475 Part 2]<br />
* [http://www.ign.com/videos/2009/01/27/killzone-2-ps3-the-making-of-killzone-2-part-3?objectid=748475 Part 3]<br />
* [http://www.ign.com/videos/2009/01/27/killzone-2-ps3-the-making-of-killzone-2-part-4?objectid=748475 Part 4]<br />
</li><br />
<li>[http://www.valvesoftware.com/company/publications.html Valve Software] &mdash; creators of the Half-Life franchise.</li><br />
</ul><br />
<br />
===General Game Development===<br />
<br />
* [http://devmaster.net/ Devmaster.net]<br />
<br />
===OpenGL===<br />
<br />
* [http://www.opengl.org/ Official OpenGL page]<br />
* [http://www.opengl.org/sdk/docs/man3/ OpenGL 3.3 Reference Pages]<br />
* [http://www.opengl.org/sdk/docs/manglsl/ OpenGL Shading Language Reference Pages]<br />
* [http://arcsynthesis.org/gltut/ Learning Modern 3D Graphics Programming]<br />
<br />
===Quake===<br />
<br />
* [http://fd.fabiensanglard.net/doom3/pdfs/johnc-plan_1999.pdf John Carmack's notes from development]<br />
* "Looking at the Quake 3 Source"<br />
** [http://element61.blogspot.com/2005/08/looking-at-quake-3-source-part-1.html Part 1]<br />
** [http://element61.blogspot.com/2005/08/looking-at-quake-3-source-part-2.html Part 2]<br />
** [http://element61.blogspot.com/2005/09/looking-at-quake-3-source-part-3.html Part 3]<br />
* [http://www.quakewiki.net/archives/code3arena/ Code3Arena]<br />
* [http://www.modwiki.net/wiki/MD5_(file_format) MD5 file format]<br />
* [http://tfc.duke.free.fr/coding/md5-specs-en.html Another MD5 format article]<br />
* [http://fabiensanglard.net/quake3/index.php Quake 3 Source Code Review]<br />
* [http://www.quake3world.com/forum/index.php Quake3World Discussion Forums]<br />
* [http://wiki.ioquake3.org/ ioquake3 project wiki] &mdash; Primarily oriented for users, developers and server administrators.</div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Technical_Documentation&diff=1967Technical Documentation2013-04-15T18:28:05Z<p>Velociostrich: /* Data Files */ Add map rotations to the list</p>
<hr />
<div>Currently, this page isn't of much help, but you can change that by editing it!<br />
<br />
==Branches==<br />
<br />
The following branches are under active development and may be of interest:<br />
<br />
* <code>librocket</code> &mdash; Work to integrate libRocket is being done on this branch. libRocket is a library that will allow us to create user interfaces using dialects of HTML and CSS.<br />
* <code>bots2</code> &mdash; New bot code, using behavior trees.<br />
<br />
==Language Oddities==<br />
<br />
<ul><br />
<li>You must use the <code>INLINE</code> macro instead of <code>inline</code>.<br />
<li>You must cast integers that are being used as enum values to an enum type. For example:<br />
<pre><br />
BG_Class ( ( class_t ) self->client->ps.stats[ STAT_CLASS ] )<br />
</pre><br />
</li><br />
</ul><br />
<br />
==Source code & data structure==<br />
<br />
* <code>main/</code> Data associated with the game.<br />
** <code>def/</code> Entity definitions for [[Mapping|Radiant]].<br />
** <code>fonts/</code><br />
** <code>gfx/</code><br />
** <code>glsl/</code> OpenGL shader code.<br />
** <code>lights/</code><br />
** <code>models/</code><br />
** <code>scripts/</code><br />
** <code>sound/</code><br />
** <code>translation/</code><br />
** <code>ui/</code><br />
* <code>src/</code><br />
** <code>engine/</code> Engine source code.<br />
*** <code>asm/</code><br />
*** <code>client/</code><br />
*** <code>null/</code><br />
*** <code>qcommon/</code><br />
*** <code>renderer/</code> Vanilla (fixed-function pipeline) renderer<br />
*** <code>rendererGL/</code> Modern XReal-based renderer<br />
*** <code>server/</code><br />
*** <code>sys/</code><br />
** <code>gamelogic/</code> Code that falls outside the scope of the core engine. These are all run in separate [[virtual machines]].<br />
*** <code>cgame/</code> Client-side game code.<br />
*** <code>game/</code> Server-side game code.<br />
*** <code>ui/</code> User interface code.<br />
<br />
==Program entry point==<br />
<br />
The <code>main</code> function may be found at around line 591 of {{SourceFile|src/engine/sys/sys_main.c}}. Note that some magic happens on the Mac in {{SourceFile|src/engine/sys/SDLMain.m}}.<br />
<br />
==Lag compensation==<br />
<br />
Daemon uses Neil "haste" Toronto's [http://www.ra.is/unlagged/ Unlagged mod].<br />
<br />
==Data Files==<br />
<br />
Daemon uses a variety of file formats. Many of these formats are custom. <!-- just try and provide a dump of all configuration files, then I'll reorganize them --><br />
<br />
* Bot behavior trees<br />
* Player configuration files<br />
** Crosshair configuration<br />
** Pubkey<br />
** GUID<br />
* Server configuration files<br />
** [[Map_layouts|Map layouts]]<br />
** Map rotations<br />
* Particle & trail system files<br />
* Sound configurations<br />
** [[Music_and_sounds#Buildables|Buildables]]<br />
* Model data ([[Exporting_Models#What_is_MD5.3F|discussion of supported formats]])<br />
** Skins<br />
** [[Exporting_Models#MD3_3|MD3 animation configuration files]] &mdash; specify which frames are for which animations<br />
** Configuration files<br />
*** [[Exporting_Models#Buildables_2|Buildables]]<br />
*** [[Exporting_Models#Weapons_2|Weapons]]<br />
*** [[Exporting_Models#Player_models_2|Player models]]<br />
* Map data<br />
** Map geometry (BSPs)<br />
** Color grading configurations<br />
<br />
==Game logic==<br />
<br />
Buildable information is encapsulated in the <code>cg_buildables</code> array (declared in {{SourceFile|src/gamelogic/cgame/cg_main.c|cg_main.c}})<br />
<br />
Constants used to define gamelogic variables are in {{SourceFile|src/gamelogic/game/tremulous.h}}.<br />
<br />
Types:<br />
* <code>buildableInfo_t</code> &mdash; Encapsulates data associated with buildables (sounds, animations, etc.).<br />
* <code>buildable_t</code> &mdash; An enumeration of all buildable types.<br />
* <code>buildableAttributes_t</code> &mdash; Encapsulates gameplay information associated with buildables. There is an array of these called <code>bg_buildableList</code>.<br />
<br />
==Server-side==<br />
<br />
Server game state initialization occurs in <code>G_InitGame()</code> in {{SourceFile|src/gamelogic/game/g_main.c}}.<br />
<br />
==Particle &amp; trail system==<br />
<br />
For now, please see the [http://tremulous.net/manual/#x1-130003.2 Tremulous documentation].<br />
<br />
==GL3 Renderer==<br />
<br />
This section is a work-in-progress.<br />
<br />
Source code for the OpenGL 3 renderer is located in {{SourceFile|src/engine/rendererGL}}.<br />
<br />
Shaders are implemented as subclasses of the <code>GLShader</code> class. All are defined in {{SourceFile|src/engine/rendererGL/gl_shader.h}}.<br />
<br />
Compiled GLSL shader files (located in the hard-coded location <code>"glsl/"</code> with the <code>.bin</code> filename extension) are read by <code>GLShader::LoadShaderBinary()</code>.<br />
<br />
All possible parameters (what OpenGL calls [http://www.opengl.org/sdk/docs/man4/xhtml/glUniform.xml "uniform variables"]) that may be passed to a shader are enumerated in the <code>shaderProgram_t</code> structure in {{SourceFile|src/engine/rendererGL/tr_local.h}}.<br />
<br />
Shaders with duplicate functionality is achieved with multiple inheritance. E.g., <code>gl_genericShader</code> is of type <code>GLShader_generic*</code> which derives from the following classes:<br />
<br />
* <code>GLShader</code><br />
* <code>u_ColorMap</code><br />
* <code>u_ColorTextureMatrix</code><br />
* <code>u_ViewOrigin</code><br />
* <code>u_AlphaTest</code><br />
* <code>u_ModelMatrix</code><br />
* <code>u_ModelViewProjectionMatrix</code><br />
* <code>u_ColorModulate</code><br />
* <code>u_Color</code><br />
* <code>u_BoneMatrix</code><br />
* <code>u_VertexInterpolation</code><br />
* <code>u_PortalPlane</code><br />
* <code>GLDeformStage</code><br />
* <code>GLCompileMacro_USE_PORTAL_CLIPPING</code><br />
* <code>GLCompileMacro_USE_ALPHA_TESTING</code><br />
* <code>GLCompileMacro_USE_VERTEX_SKINNING</code><br />
* <code>GLCompileMacro_USE_VERTEX_ANIMATION</code><br />
* <code>GLCompileMacro_USE_DEFORM_VERTEXES</code><br />
* <code>GLCompileMacro_USE_TCGEN_ENVIRONMENT</code><br />
* <code>GLCompileMacro_USE_TCGEN_LIGHTMAP</code><br />
<br />
GLSL shaders may be found in <code>main/glsl/</code>. Please see the [[GLSL Shaders|full article]] for a complete listing.<br />
<br />
===Helper classes===<br />
<br />
As mentioned above, shader classes make use of multiple inheritance to give them the relevant methods for controlling their behavior.<br />
<br />
====Uniform variables====<br />
<br />
Uniform variables are controlled with classes with the <code>u_</code> prefix:<br />
<br />
* u_BoneMatrix &mdash; Provides the convenience method <code>SetUniform_BoneMatrix</code>.<br />
<br />
====Compile macros====<br />
<br />
* <code>GLCompileMacro_USE_ALPHA_TESTING</code><br />
* <code>GLCompileMacro_USE_PORTAL_CLIPPING</code><br />
* <code>GLCompileMacro_USE_FRUSTUM_CLIPPING</code><br />
* <code>GLCompileMacro_USE_VERTEX_SKINNING</code><br />
* <code>GLCompileMacro_USE_VERTEX_ANIMATION</code><br />
* <code>GLCompileMacro_USE_DEFORM_VERTEXES</code><br />
* <code>GLCompileMacro_USE_TCGEN_ENVIRONMENT</code><br />
* <code>GLCompileMacro_USE_TCGEN_LIGHTMAP</code><br />
* <code>GLCompileMacro_USE_NORMAL_MAPPING</code><br />
* <code>GLCompileMacro_USE_PARALLAX_MAPPING</code><br />
* <code>GLCompileMacro_USE_REFLECTIVE_SPECULAR</code><br />
* <code>GLCompileMacro_TWOSIDED</code><br />
* <code>GLCompileMacro_EYE_OUTSIDE</code><br />
* <code>GLCompileMacro_BRIGHTPASS_FILTER</code><br />
* <code>GLCompileMacro_LIGHT_DIRECTIONAL</code><br />
* <code>GLCompileMacro_USE_SHADOWING</code><br />
* <code>GLCompileMacro_USE_GBUFFER</code><br />
<br />
===Resources===<br />
<br />
Mac OS X users with XCode installed can access OpenGL man pages via the terminal. <!-- TODO: discuss how to get these on windows or linux? --><br />
<br />
Alternatively, OpenGL API reference documentation is available online:<br />
* [http://www.opengl.org/sdk/docs/man3/ OpenGL 3.3 Reference Pages]<br />
* [http://www.opengl.org/sdk/docs/manglsl/ OpenGL Shading Language (GLSL) Reference Pages]<br />
* [http://www.khronos.org/files/opengl-quick-reference-card.pdf OpenGL 3.3 &amp; GLSL Quick Reference Card]<br />
<br />
==Valgrind and fglrx==<br />
<br />
fglrx drivers cause Valgrind to spew out a lot of false errors. You can suppress these by using the --suppressions=/path/to/file.supp flag. You must pass the full path (no use of the tilde symbol). The following [http://www.mediafire.com/?z6ehwrxpw2m469h file] can be used as a template for your suppression file. Keep in mind that the location of the fglrx library may need to be changed.<br />
<br />
==Resources==<br />
<br />
===Publications===<br />
<br />
<ul><br />
<li>[http://halo.bungie.net/Inside/publications.aspx Bungie, Inc.] &mdash; creators of the Marathon, Myth, and Halo franchises.</li><br />
<li>[http://dice.se/publications/ DICE SE] &mdash; creators of the Battlefield franchise.</li><br />
<li>[http://www.guerrilla-games.com/publications/ Guerilla Games] &mdash; creators of the Killzone franchise.<br />
<p>Also of interest is the "Making of Killzone 2" video series, not listed on their site:</p><br />
* [http://www.ign.com/videos/2009/01/27/killzone-2-ps3-the-making-of-killzone-2-part-1?objectid=748475 Part 1]<br />
* [http://www.ign.com/videos/2009/01/27/killzone-2-ps3-the-making-of-killzone-2-part-2?objectid=748475 Part 2]<br />
* [http://www.ign.com/videos/2009/01/27/killzone-2-ps3-the-making-of-killzone-2-part-3?objectid=748475 Part 3]<br />
* [http://www.ign.com/videos/2009/01/27/killzone-2-ps3-the-making-of-killzone-2-part-4?objectid=748475 Part 4]<br />
</li><br />
<li>[http://www.valvesoftware.com/company/publications.html Valve Software] &mdash; creators of the Half-Life franchise.</li><br />
</ul><br />
<br />
===General Game Development===<br />
<br />
* [http://devmaster.net/ Devmaster.net]<br />
<br />
===OpenGL===<br />
<br />
* [http://www.opengl.org/ Official OpenGL page]<br />
* [http://www.opengl.org/sdk/docs/man3/ OpenGL 3.3 Reference Pages]<br />
* [http://www.opengl.org/sdk/docs/manglsl/ OpenGL Shading Language Reference Pages]<br />
* [http://arcsynthesis.org/gltut/ Learning Modern 3D Graphics Programming]<br />
<br />
===Quake===<br />
<br />
* [http://fd.fabiensanglard.net/doom3/pdfs/johnc-plan_1999.pdf John Carmack's notes from development]<br />
* "Looking at the Quake 3 Source"<br />
** [http://element61.blogspot.com/2005/08/looking-at-quake-3-source-part-1.html Part 1]<br />
** [http://element61.blogspot.com/2005/08/looking-at-quake-3-source-part-2.html Part 2]<br />
** [http://element61.blogspot.com/2005/09/looking-at-quake-3-source-part-3.html Part 3]<br />
* [http://www.quakewiki.net/archives/code3arena/ Code3Arena]<br />
* [http://www.modwiki.net/wiki/MD5_(file_format) MD5 file format]<br />
* [http://tfc.duke.free.fr/coding/md5-specs-en.html Another MD5 format article]<br />
* [http://fabiensanglard.net/quake3/index.php Quake 3 Source Code Review]<br />
* [http://www.quake3world.com/forum/index.php Quake3World Discussion Forums]<br />
* [http://wiki.ioquake3.org/ ioquake3 project wiki] &mdash; Primarily oriented for users, developers and server administrators.</div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Technical_Documentation&diff=1966Technical Documentation2013-04-15T18:27:33Z<p>Velociostrich: Begin creating a listing of all file formats read by the engine</p>
<hr />
<div>Currently, this page isn't of much help, but you can change that by editing it!<br />
<br />
==Branches==<br />
<br />
The following branches are under active development and may be of interest:<br />
<br />
* <code>librocket</code> &mdash; Work to integrate libRocket is being done on this branch. libRocket is a library that will allow us to create user interfaces using dialects of HTML and CSS.<br />
* <code>bots2</code> &mdash; New bot code, using behavior trees.<br />
<br />
==Language Oddities==<br />
<br />
<ul><br />
<li>You must use the <code>INLINE</code> macro instead of <code>inline</code>.<br />
<li>You must cast integers that are being used as enum values to an enum type. For example:<br />
<pre><br />
BG_Class ( ( class_t ) self->client->ps.stats[ STAT_CLASS ] )<br />
</pre><br />
</li><br />
</ul><br />
<br />
==Source code & data structure==<br />
<br />
* <code>main/</code> Data associated with the game.<br />
** <code>def/</code> Entity definitions for [[Mapping|Radiant]].<br />
** <code>fonts/</code><br />
** <code>gfx/</code><br />
** <code>glsl/</code> OpenGL shader code.<br />
** <code>lights/</code><br />
** <code>models/</code><br />
** <code>scripts/</code><br />
** <code>sound/</code><br />
** <code>translation/</code><br />
** <code>ui/</code><br />
* <code>src/</code><br />
** <code>engine/</code> Engine source code.<br />
*** <code>asm/</code><br />
*** <code>client/</code><br />
*** <code>null/</code><br />
*** <code>qcommon/</code><br />
*** <code>renderer/</code> Vanilla (fixed-function pipeline) renderer<br />
*** <code>rendererGL/</code> Modern XReal-based renderer<br />
*** <code>server/</code><br />
*** <code>sys/</code><br />
** <code>gamelogic/</code> Code that falls outside the scope of the core engine. These are all run in separate [[virtual machines]].<br />
*** <code>cgame/</code> Client-side game code.<br />
*** <code>game/</code> Server-side game code.<br />
*** <code>ui/</code> User interface code.<br />
<br />
==Program entry point==<br />
<br />
The <code>main</code> function may be found at around line 591 of {{SourceFile|src/engine/sys/sys_main.c}}. Note that some magic happens on the Mac in {{SourceFile|src/engine/sys/SDLMain.m}}.<br />
<br />
==Lag compensation==<br />
<br />
Daemon uses Neil "haste" Toronto's [http://www.ra.is/unlagged/ Unlagged mod].<br />
<br />
==Data Files==<br />
<br />
Daemon uses a variety of file formats. Many of these formats are custom. <!-- just try and provide a dump of all configuration files, then I'll reorganize them --><br />
<br />
* Bot behavior trees<br />
* Player configuration files<br />
** Crosshair configuration<br />
** Pubkey<br />
** GUID<br />
* Server configuration files<br />
** [[Map_layouts|Map layouts]]<br />
* Particle & trail system files<br />
* Sound configurations<br />
** [[Music_and_sounds#Buildables|Buildables]]<br />
* Model data ([[Exporting_Models#What_is_MD5.3F|discussion of supported formats]])<br />
** Skins<br />
** [[Exporting_Models#MD3_3|MD3 animation configuration files]] &mdash; specify which frames are for which animations<br />
** Configuration files<br />
*** [[Exporting_Models#Buildables_2|Buildables]]<br />
*** [[Exporting_Models#Weapons_2|Weapons]]<br />
*** [[Exporting_Models#Player_models_2|Player models]]<br />
* Map data<br />
** Map geometry (BSPs)<br />
** Color grading configurations<br />
<br />
==Game logic==<br />
<br />
Buildable information is encapsulated in the <code>cg_buildables</code> array (declared in {{SourceFile|src/gamelogic/cgame/cg_main.c|cg_main.c}})<br />
<br />
Constants used to define gamelogic variables are in {{SourceFile|src/gamelogic/game/tremulous.h}}.<br />
<br />
Types:<br />
* <code>buildableInfo_t</code> &mdash; Encapsulates data associated with buildables (sounds, animations, etc.).<br />
* <code>buildable_t</code> &mdash; An enumeration of all buildable types.<br />
* <code>buildableAttributes_t</code> &mdash; Encapsulates gameplay information associated with buildables. There is an array of these called <code>bg_buildableList</code>.<br />
<br />
==Server-side==<br />
<br />
Server game state initialization occurs in <code>G_InitGame()</code> in {{SourceFile|src/gamelogic/game/g_main.c}}.<br />
<br />
==Particle &amp; trail system==<br />
<br />
For now, please see the [http://tremulous.net/manual/#x1-130003.2 Tremulous documentation].<br />
<br />
==GL3 Renderer==<br />
<br />
This section is a work-in-progress.<br />
<br />
Source code for the OpenGL 3 renderer is located in {{SourceFile|src/engine/rendererGL}}.<br />
<br />
Shaders are implemented as subclasses of the <code>GLShader</code> class. All are defined in {{SourceFile|src/engine/rendererGL/gl_shader.h}}.<br />
<br />
Compiled GLSL shader files (located in the hard-coded location <code>"glsl/"</code> with the <code>.bin</code> filename extension) are read by <code>GLShader::LoadShaderBinary()</code>.<br />
<br />
All possible parameters (what OpenGL calls [http://www.opengl.org/sdk/docs/man4/xhtml/glUniform.xml "uniform variables"]) that may be passed to a shader are enumerated in the <code>shaderProgram_t</code> structure in {{SourceFile|src/engine/rendererGL/tr_local.h}}.<br />
<br />
Shaders with duplicate functionality is achieved with multiple inheritance. E.g., <code>gl_genericShader</code> is of type <code>GLShader_generic*</code> which derives from the following classes:<br />
<br />
* <code>GLShader</code><br />
* <code>u_ColorMap</code><br />
* <code>u_ColorTextureMatrix</code><br />
* <code>u_ViewOrigin</code><br />
* <code>u_AlphaTest</code><br />
* <code>u_ModelMatrix</code><br />
* <code>u_ModelViewProjectionMatrix</code><br />
* <code>u_ColorModulate</code><br />
* <code>u_Color</code><br />
* <code>u_BoneMatrix</code><br />
* <code>u_VertexInterpolation</code><br />
* <code>u_PortalPlane</code><br />
* <code>GLDeformStage</code><br />
* <code>GLCompileMacro_USE_PORTAL_CLIPPING</code><br />
* <code>GLCompileMacro_USE_ALPHA_TESTING</code><br />
* <code>GLCompileMacro_USE_VERTEX_SKINNING</code><br />
* <code>GLCompileMacro_USE_VERTEX_ANIMATION</code><br />
* <code>GLCompileMacro_USE_DEFORM_VERTEXES</code><br />
* <code>GLCompileMacro_USE_TCGEN_ENVIRONMENT</code><br />
* <code>GLCompileMacro_USE_TCGEN_LIGHTMAP</code><br />
<br />
GLSL shaders may be found in <code>main/glsl/</code>. Please see the [[GLSL Shaders|full article]] for a complete listing.<br />
<br />
===Helper classes===<br />
<br />
As mentioned above, shader classes make use of multiple inheritance to give them the relevant methods for controlling their behavior.<br />
<br />
====Uniform variables====<br />
<br />
Uniform variables are controlled with classes with the <code>u_</code> prefix:<br />
<br />
* u_BoneMatrix &mdash; Provides the convenience method <code>SetUniform_BoneMatrix</code>.<br />
<br />
====Compile macros====<br />
<br />
* <code>GLCompileMacro_USE_ALPHA_TESTING</code><br />
* <code>GLCompileMacro_USE_PORTAL_CLIPPING</code><br />
* <code>GLCompileMacro_USE_FRUSTUM_CLIPPING</code><br />
* <code>GLCompileMacro_USE_VERTEX_SKINNING</code><br />
* <code>GLCompileMacro_USE_VERTEX_ANIMATION</code><br />
* <code>GLCompileMacro_USE_DEFORM_VERTEXES</code><br />
* <code>GLCompileMacro_USE_TCGEN_ENVIRONMENT</code><br />
* <code>GLCompileMacro_USE_TCGEN_LIGHTMAP</code><br />
* <code>GLCompileMacro_USE_NORMAL_MAPPING</code><br />
* <code>GLCompileMacro_USE_PARALLAX_MAPPING</code><br />
* <code>GLCompileMacro_USE_REFLECTIVE_SPECULAR</code><br />
* <code>GLCompileMacro_TWOSIDED</code><br />
* <code>GLCompileMacro_EYE_OUTSIDE</code><br />
* <code>GLCompileMacro_BRIGHTPASS_FILTER</code><br />
* <code>GLCompileMacro_LIGHT_DIRECTIONAL</code><br />
* <code>GLCompileMacro_USE_SHADOWING</code><br />
* <code>GLCompileMacro_USE_GBUFFER</code><br />
<br />
===Resources===<br />
<br />
Mac OS X users with XCode installed can access OpenGL man pages via the terminal. <!-- TODO: discuss how to get these on windows or linux? --><br />
<br />
Alternatively, OpenGL API reference documentation is available online:<br />
* [http://www.opengl.org/sdk/docs/man3/ OpenGL 3.3 Reference Pages]<br />
* [http://www.opengl.org/sdk/docs/manglsl/ OpenGL Shading Language (GLSL) Reference Pages]<br />
* [http://www.khronos.org/files/opengl-quick-reference-card.pdf OpenGL 3.3 &amp; GLSL Quick Reference Card]<br />
<br />
==Valgrind and fglrx==<br />
<br />
fglrx drivers cause Valgrind to spew out a lot of false errors. You can suppress these by using the --suppressions=/path/to/file.supp flag. You must pass the full path (no use of the tilde symbol). The following [http://www.mediafire.com/?z6ehwrxpw2m469h file] can be used as a template for your suppression file. Keep in mind that the location of the fglrx library may need to be changed.<br />
<br />
==Resources==<br />
<br />
===Publications===<br />
<br />
<ul><br />
<li>[http://halo.bungie.net/Inside/publications.aspx Bungie, Inc.] &mdash; creators of the Marathon, Myth, and Halo franchises.</li><br />
<li>[http://dice.se/publications/ DICE SE] &mdash; creators of the Battlefield franchise.</li><br />
<li>[http://www.guerrilla-games.com/publications/ Guerilla Games] &mdash; creators of the Killzone franchise.<br />
<p>Also of interest is the "Making of Killzone 2" video series, not listed on their site:</p><br />
* [http://www.ign.com/videos/2009/01/27/killzone-2-ps3-the-making-of-killzone-2-part-1?objectid=748475 Part 1]<br />
* [http://www.ign.com/videos/2009/01/27/killzone-2-ps3-the-making-of-killzone-2-part-2?objectid=748475 Part 2]<br />
* [http://www.ign.com/videos/2009/01/27/killzone-2-ps3-the-making-of-killzone-2-part-3?objectid=748475 Part 3]<br />
* [http://www.ign.com/videos/2009/01/27/killzone-2-ps3-the-making-of-killzone-2-part-4?objectid=748475 Part 4]<br />
</li><br />
<li>[http://www.valvesoftware.com/company/publications.html Valve Software] &mdash; creators of the Half-Life franchise.</li><br />
</ul><br />
<br />
===General Game Development===<br />
<br />
* [http://devmaster.net/ Devmaster.net]<br />
<br />
===OpenGL===<br />
<br />
* [http://www.opengl.org/ Official OpenGL page]<br />
* [http://www.opengl.org/sdk/docs/man3/ OpenGL 3.3 Reference Pages]<br />
* [http://www.opengl.org/sdk/docs/manglsl/ OpenGL Shading Language Reference Pages]<br />
* [http://arcsynthesis.org/gltut/ Learning Modern 3D Graphics Programming]<br />
<br />
===Quake===<br />
<br />
* [http://fd.fabiensanglard.net/doom3/pdfs/johnc-plan_1999.pdf John Carmack's notes from development]<br />
* "Looking at the Quake 3 Source"<br />
** [http://element61.blogspot.com/2005/08/looking-at-quake-3-source-part-1.html Part 1]<br />
** [http://element61.blogspot.com/2005/08/looking-at-quake-3-source-part-2.html Part 2]<br />
** [http://element61.blogspot.com/2005/09/looking-at-quake-3-source-part-3.html Part 3]<br />
* [http://www.quakewiki.net/archives/code3arena/ Code3Arena]<br />
* [http://www.modwiki.net/wiki/MD5_(file_format) MD5 file format]<br />
* [http://tfc.duke.free.fr/coding/md5-specs-en.html Another MD5 format article]<br />
* [http://fabiensanglard.net/quake3/index.php Quake 3 Source Code Review]<br />
* [http://www.quake3world.com/forum/index.php Quake3World Discussion Forums]<br />
* [http://wiki.ioquake3.org/ ioquake3 project wiki] &mdash; Primarily oriented for users, developers and server administrators.</div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Template:Issue/doc&diff=1965Template:Issue/doc2013-04-15T00:38:27Z<p>Velociostrich: Initial edit.</p>
<hr />
<div>This template creates a link to an issue for an Unvanquished GitHub project.<br />
<br />
==Usage==<br />
<br />
Typing the following<br />
<br />
<pre><nowiki><br />
This feature currently does not work. Please see {{Issue|102}}.<br />
</nowiki></pre><br />
<br />
generates<br />
<br />
<div style="border:1px solid #ccc;padding:0em 1em"><br />
<br />
This feature currently does not work. Please see {{Issue|102}}.<br />
</div><br />
<br />
==Positional Parameters==<br />
<br />
# Specifies the number of the issue.<br />
# ''(Optional)'' Specifies the project name to use. Defaults to <code>Unvanquished</code>.</div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Template:Issue&diff=1964Template:Issue2013-04-15T00:29:46Z<p>Velociostrich: Add documentation</p>
<hr />
<div><includeonly>[https://github.com/Unvanquished/{{{2|Unvanquished}}}/issues/{{{1}}} Issue {{{1}}}]</includeonly><noinclude><br />
{{Documentation}}<br />
</noinclude></div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Compiling_the_source&diff=1963Compiling the source2013-04-15T00:29:14Z<p>Velociostrich: /* Visual Studio */ Update information, improve formatting</p>
<hr />
<div>==Mac OS X==<br />
<br />
First, you need to [[Getting_the_source|acquire the source code]].<br />
<br />
Regardless of what interface you may use to compile the source, you will need [http://www.cmake.org/cmake/resources/software.html CMake] to generate makefiles. You will also need to install [https://developer.apple.com/xcode/ Xcode] (making sure to choose to install the command-line utilities when prompted by the installer).<br />
<br />
Then, you will need to acquire (and in some cases, manually compile) at a minimum the [[#Dependencies|necessary libraries]].<br />
<br />
Once you have the source code and the libraries installed, you may actually proceed to compile the source. You have several options:<br />
* '''Compile the source at the command line'''. This is the easiest if you would just like to compile the game to use yourself and you do not intend to work on the code.<br />
* '''Compile the source using an IDE'''. This is preferred if you intend on developing the source.<br />
** Xcode is Apple's flagship IDE and you should have installed to compile the source regardless of which method you use.<br />
** [http://qt-project.org/downloads QtCreator] is cross-platform and provides real-time feedback of syntax errors, a Vim mode, as well as other features.<br />
** [http://www.codeblocks.org/ Code::Blcoks] is also cross-platform but lacks some of the features of Xcode and QtCreator.<br />
<br />
===Dependencies===<br />
<br />
You only need to use one of the following methods (HomeBrew or compiling by hand). Please try and avoid mixing methods as this may produce unexpected results.<br />
<br />
Unvanquished requires the following libraries:<br />
* [[#JPEG|JPEG]], version 8 or higher. (Version 6 was known to have problems)<br />
* [[#Simple_DirectMedia_Layer_.28SDL.29|Simple DirectMedia Layer]] (The binary provided by libsdl.org causes graphical corruptions. Compile from source or use homebrew/macports)<br />
* [[#The_OpenGL_Extension_Wrangler_Library_.28GLEW.29|The OpenGL Extension Wrangler Library]]<br />
* CuRL<br />
* [[#The_GNU_MP_Bignum_Library_.28libgmp.29|GMP]]<br />
* [[#WebP|WebP]] (v0.2.0 or newer)<br />
<br />
The following libraries are optional:<br />
* Theora<br />
* Speex<br />
* [[#Ogg|Ogg]]<br />
* [[#Vorbis|Vorbis]]<br />
<br />
====HomeBrew====<br />
Install [http://mxcl.github.com/homebrew/ HomeBrew] and then run the following command<br />
<br />
$ brew install nettle libjpeg curl sdl webp xvid gmp glew speex libvorbis theora<br />
<br />
All the necessary libraries should now have been installed.<br />
<br />
====Compiling by hand====<br />
The following are shell scripts that download, compile, and install various libraries. This is more time consuming then other methods but might be useful if you need more control over your libraries<br />
<br />
=====JPEG=====<br />
<br />
$ curl http://www.ijg.org/files/jpegsrc.v8d.tar.gz > jpegsrc.v8d.tar.gz<br />
$ tar xvzf jpegsrc.v8d.tar.gz<br />
$ cd jpeg-8d<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The OpenGL Extension Wrangler Library (GLEW)=====<br />
<br />
$ curl -L https://sourceforge.net/projects/glew/files/glew/1.7.0/glew-1.7.0.tgz/download > glew-1.7.0.tgz<br />
$ tar xvzf glew-1.7.0.tgz<br />
$ cd glew-1.7.0<br />
$ make<br />
$ sudo make install<br />
<br />
=====Simple DirectMedia Layer (SDL)=====<br />
<br />
Do not use the binaries provided by libsdl.org, as these are known to cause issues with gamma and color display. Instead, compile your own:<br />
<br />
$ curl http://www.libsdl.org/release/SDL-1.2.15.tar.gz > SDL-1.2.15.tar.gz<br />
$ tar xvzf SDL-1.2.15.tar.gz<br />
$ cd SDL-1.2.15<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The GNU MP Bignum Library (libgmp)=====<br />
<br />
$ curl ftp://ftp.gmplib.org/pub/gmp-5.0.5/gmp-5.0.5.tar.bz2 > gmp-5.0.5.tar.bz2<br />
$ tar xvjf gmp-5.0.5.tar.bz2<br />
$ cd gmp-5.0.5<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Ogg=====<br />
<br />
$ curl http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz > libogg-1.3.0.tar.gz<br />
$ tar xvzf libogg-1.3.0.tar.gz<br />
$ cd libogg-1.3.0<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Vorbis=====<br />
<br />
$ curl http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz > libvorbis-1.3.3.tar.gz<br />
$ tar xvzf libvorbis-1.3.3.tar.gz<br />
$ cd libvorbis-1.3.3<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====WebP=====<br />
<br />
You do not need to compile WebP by hand; Google provides binaries for Mac OS X available from their [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0-mac-10.5.tar.gz project page]. You will need version 0.2.0 or newer.<br />
<br />
Once downloaded, you must still install the header files and the binary:<br />
<br />
$ curl https://webp.googlecode.com/files/libwebp-0.2.0-mac-10.5.tar.gz > libwebp-0.2.0-mac-10.5.tar.gz<br />
$ tar xvzf libwebp-0.2.0-mac-10.5.tar.gz<br />
$ cd libwebp-0.2.0-mac-10.5<br />
$ sudo cp include/webp /usr/local/include<br />
$ sudo cp lib/libwebp.a /usr/local/lib<br />
<br />
===Configuring with CMake===<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 should be a different directory.<br />
# Hit "Configure". You will be prompted as to which generator you would like to use. If you have Xcode installed, choose that. Wait while the configuration process runs. You may have to set the following:<br />
## If CMake did not find your jpeg headers for some reason, set <code>JPEG_INCLUDE_DIR</code> to <code>/path/to/Unvanquished/src/libs/jpeg</code>.<br />
## Check <code>USE_INTERNAL_CRYPTO</code> to avoid having to compile nettle and hogweed.<br />
## Check <code>USE_INTERNAL_SPEEX</code> to avoid having to compile Speex.<br />
## Uncheck <code>USE_CIN_THEORA</code> and <code>USE_CIN_XVID</code> to avoid having to compile Theora or Xvid. (At present, there are not cutscenes or any such that require it.)<br />
## '''You will probably not be able to compile with the GLSL optimizer enabled; uncheck <code>USE_GLSL_OPTIMIZER</code>'''<br />
## If you have selected to generate Xcode project files, make the <code>SDLMAIN_LIBRARY</code> field blank. This option is not available if you have the generator set to Unix makefiles.<br />
# Hit "Generate".<br />
# You may now close Xcode.<br />
<br />
===Compiling===<br />
<br />
====With Xcode====<br />
<br />
<ol><br />
<li>Compilation will fail unless you manually create certain directories needed by the build scripts:<br />
<pre><br />
$ cd /path/to/build/dir/CMakeFiles<br />
$ mkdir gpp{game,trem,ui}-qvm.dir<br />
</pre><br />
This is a workaround to {{Issue|101}}.<br />
</li><br />
<li>Either start Xcode and open the project file (in the build directory you specified) or double-click the project file in Finder.</li><br />
<li>Open the project file created by CMake, which should be in the build directory you specified.</li><br />
<li>Change the active target to "ALL_BUILD" and click Product&rarr;Build.</li><br />
</ol><br />
<br />
====With Unix Makefiles====<br />
<br />
<ul><br />
<li>Start Terminal (Applications &rarr; Utilities &rarr; Terminal).</li><br />
<li>Input the following commands:<br />
<pre><br />
$ cd /path/to/Unvanquished-build<br />
$ make<br />
</pre><br />
If you are on a multi-core or multi-processor machine, you may speed up the process by passing the <code>-j</code> argument followed by the number of available cores to <code>make</code>; e.g., <code>make -j4</code>. Note that doing so makes reading error messages more difficult, as multiple instances of the compiler will print to the screen at once, causing information to appear out of order.<br />
</li><br />
</ul><br />
<br />
===Testing the build===<br />
<br />
====With Xcode 4====<br />
<br />
To test the game, select the "client" scheme from the combo box on the toolbar, and click the run button or press {{Hotkey|MacCommand}}{{Hotkey|R}}.<br />
<br />
====With Unix Makefiles====<br />
<br />
After compiling, you'll have to place the data files in the <code>main</code> directory in your build directory. [[#Acquiring the Game Files|For download instructions, see below.]]<br />
<br />
Your file structure should look as follows:<br />
<br />
[[File:Build_dir_Mac_OS_X.png]]<br />
<br />
You may now start the application as such:<br />
<br />
$ ./daemon.i386<br />
<br />
Note that older machines will not support the new OpenGL 3 renderer, and must be started specifying the "vanilla" (aka "GL") renderer:<br />
<br />
$ ./daemon.i386 +set cl_renderer GL<br />
<br />
===Bundling the Application===<br />
<br />
====With CPack====<br />
<br />
CPack is able to create standalone bundles (as well as many other types of installers). However you must generate the files using Unix Makefiles instead of Xcode.<br />
<br />
$ cd /path/to/Unvanquished-build<br />
$ cpack -G Bundle<br />
<br />
Some warnings will be printed however these can be safely ignored. There should be a file called Unvanquished.dmg in the Unvanquished-build folder.<br />
<br />
====Manually====<br />
<br />
You'll find the Mac [http://macdylibbundler.sourceforge.net/ dynamic library bundler] to be quite useful (you must generate the files using Unix Makefiles instead of Xcode):<br />
<br />
$ curl -L http://sourceforge.net/projects/macdylibbundler/files/macdylibbundler/0.4.1/dylibbundler0.4.1.zip/download > \<br />
dylibbundler0.4.1.zip<br />
$ unzip dylibbundler0.4.1.zip<br />
$ cd dylibbundler<br />
$ make<br />
$ sudo make install<br />
<br />
Once you've done that, you can proceed to create the application bundle. Note that these steps assume that you have downloaded the data files to <code>main/</code> as shown above:<br />
<br />
<pre><br />
$ git=/path/to/Unvanquished-git-repo<br />
$ build=/path/to/Unvanquished-build-dir<br />
$ mkdir -pv Unvanquished.app/Contents/{libs,MacOS,Resources,Frameworks}<br />
$ cp -r $build/main Unvanquished.app/Contents/MacOS<br />
$ sips -s format tiff $git/debian/unvanquished.png --out temp.tiff<br />
$ tiff2icns temp.tiff Unvanquished.app/Contents/Resources/Unvanquished.icns<br />
$ rm temp.tiff<br />
$ cp $build/daemon{,ded}.i386 $build/*.dylib Unvanquished.app/Contents/MacOS<br />
$ cp -r /Library/Frameworks/SDL.framework Unvanquished.app/Contents/Frameworks<br />
$ install_name_tool -id \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/Frameworks/SDL.framework/Versions/A/SDL<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGLi386.dylib<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGL3i386.dylib<br />
$ for binary in Unvanquished.app/Contents/MacOS/*.{i386,dylib}; do<br />
dylibbundler -b -x $binary -d $dest/Unvanquished.app/Contents/libs/; done<br />
$ cp /usr/lib/libGLEW.1.7.0.dylib ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ chmod +w ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -id @executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -change /usr/lib/libGLEW.1.7.0.dylib \<br />
@executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ cat > Unvanquished.app/Contents/Info.plist<br />
<?xml version="1.0" encoding="UTF-8"?><br />
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"<br />
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"><br />
<plist version="1.0"><br />
<dict><br />
<key>CFBundleName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleDisplayName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleExecutable</key><br />
<string>daemon.i386</string><br />
<key>CFBundleIconFile</key><br />
<string>Unvanquished.icns</string><br />
<key>CFBundleIdentifier</key><br />
<string>net.Unvanquished</string><br />
<key>CFBundleInfoDictionaryVersion</key><br />
<string>6.0</string><br />
<key>CFBundlePackageType</key><br />
<string>APPL</string><br />
<key>CFBundleShortVersionString</key><br />
<string>0.4.0</string><br />
<key>CFBundleVersion</key><br />
<string>0.4.0</string><br />
</dict><br />
</plist><br />
^d<br />
</pre><br />
<br />
Note: <code>^d</code> indicates pressing {{Hotkey|Ctrl}}{{Hotkey|D}} on the keyboard.<br />
<br />
The contents of the completed application bundle should look like this:<br />
<br />
[[File:Bundle_dir_Mac_OS_X.png]]<br />
<br />
'''Note''': If you compiled SDL from source, you will not see a directory titled <code>SDL.framework</code>.<br />
<br />
==Windows==<br />
<br />
===Visual Studio===<br />
<br />
CMake can generate Visual Studio projects for Unvanquished.<br />
<br />
# Run the <code>Visual_Studio32.bat</code> batch script in your source directory by double-clicking it. Alternatively, you may use the <code>Visual_Studio64.bat</code> shell script if you have the [http://www.microsoft.com/en-us/download/details.aspx?id=8279 Windows 7 SDK] installed and a 64-bit system.<br />
# Open <code>build-32/Daemon.sln</code> in Visual Studio 2010.<br />
# In the two text boxes in the toolbar, select "Release" or "Debug" in the first one and Win32 in the second one<br />
# Press {{Hotkey|F5}} to build solution and run application, or just use Build &rarr; Build Solution to compile the code.<br />
<br />
====Important Notes====<br />
<br />
* LLVM is disabled and does not work correctly with CMake generated Visual Studio projects.<br />
* ncurses is not supported under Visual Studio.<br />
* The path to the build folder must not have any spaces otherwise generation of QVMs will fail. See {{Issue|102}}.<br />
* Due to limitations with CMake, neither the startup project nor the working directory can be specified. These must be set manually to debug the client with Visual Studio:<br />
** Right click on client and select "Set as StartUp project".<br />
** Right click on client, select properties, select Debugging and set "Working Directory" to <code>$(TargetPath)\..</code>.<br />
<br />
===MinGW===<br />
<br />
It is possible to build Unvanquished with MinGW, although the process is rather arduous compared to Visual Studio or compiling for other platforms.<br />
<br />
====Notes====<br />
<br />
* The easiest way to acquire and install MinGW is with the graphical [http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/ mingw-get-inst installer]. <!-- TODO: maybe walk the user through the installer? --><br />
* When configuring the build with CMake, you will find that you will have to set a number of libraries manually. You can find precompiled DLLs for most of the dependencies; those that are not pre-compiled can be built with the corresponding <code>USE_INTERNAL_</code> setting.<br />
* On Windows, SDL requires that the Direct X SDK can be installed. You may download the June 2010 release from [http://www.microsoft.com/en-us/download/details.aspx?id=6812 Microsoft's site].<br />
* '''The build will fail during QVM compilation if your source or build directories contain spaces.''' This is due to a bug with lcc. If your home directory contains a space, you may want to create source and build directories at the root of one of your drives (e.g., <code>C:\Unvanquished\Source</code> and <code>C:\Unvanquished\Build</code>.)<br />
<br />
====Instructions====<br />
<br />
The easiest way to get a build up (at the time of writing) is as follows:<br />
<br />
{{Note|content=Although there are 64-bit binaries of most of the libraries required to build the game, these do not work with MinGW at present, so the following instructions all use the 32-bit binaries.}}<br />
<br />
<ol><br />
<li>Although there are binaries of gmp distributed with the source, they have are dependent on Visual Studio's implementations of <code>_ftol2_sse</code> and <code>_alloca_probe_16</code>. A fix may be found on [http://stackoverflow.com/questions/6753111/static-linking-with-openssl Stack Exchange], but requires that Visual Studio be installed, which defeats the purpose of attempting to use MinGW to compile the source. You can build gmp yourself:<br />
<ol><br />
<li>Download and extract the latest version of the [http://gmplib.org/ GNU MP Bignum Library (GMP)]. (You will need either cygwin with tar and bz2 installed or 7-zip to extract the archive.)</li><br />
<li>Install the following Cygwin packages if you have not already:<br />
* binutils<br />
* gcc<br />
* gcc-g++<br />
* m4<br />
* make<br />
</li><br />
<li>As part of the GMP compilation process, a file called <code>gen-fib.c</code> generates a table of numbers in the Fibonacci sequence. The generated file does not play nicely with Cygwin or MinGW, so you must fix it. Edit <code>gen-fib.c</code>, and at around line 100, change these lines<br />
<pre><br />
for (i = 0; i < fnum; i++)<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
printf ("), /* %d */\n", i-1);<br />
}<br />
printf ("};\n");<br />
</pre><br />
to look like this:<br />
<pre><br />
for (i = 0; i < fnum; i++)<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
printf (")%c /* %d */\n", (i == (fnum-1)) ? ' ' : ',', i-1);<br />
}<br />
printf ("};\n");<br />
</pre><br />
The patch file looks like this:<br />
<pre><br />
@@ -100,7 +100,7 @@<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
- printf ("), /* %d */\n", i-1);<br />
+ printf (")%c /* %d */\n", (i == (fnum-1)) ? ' ' : ',', i-1);<br />
}<br />
printf ("};\n");<br />
}<br />
</pre><br />
</li><br />
<li>Compiling with MinGW does not work, so you will need to compile with Cygwin. At the prompt:<br />
<pre><br />
$ ./configure --disable-static --enable-shared<br />
$ make<br />
</pre><br />
The <code>--disable-static</code> and <code>--enable-shared</code> flags configure GMP to build a DLL instead of a static library. You may optionally perform <code>make install</code>. Additional compilation instructions [http://www.cs.nyu.edu/exact/core/gmp/ are available].<br />
<p>If you experience difficulties with compilation and it appears that MinGW gcc is being detected by <code>configure</code> and not Cygwin gcc, you can try editing your <code>PATH</code> variable:</p><br />
<pre><br />
$ export PATH=`echo $PATH | sed "s|/cygdrive/c/MinGW/bin:||"`<br />
</pre><br />
Re-run <code>configure</code> and <code>make</code> afterwards.<br />
</ol><br />
</li><br />
<li>Download the [http://www.libsdl.org/release/SDL-1.2.15-win32.zip latest stable version] of SDL for Windows. Extract the archive and copy <code>SDL.dll</code> from it to the root of your build directory.</li><br />
<li>Set the following CMake flags:<br />
{| class="wikitable"<br />
! Setting<br />
! Description<br />
! Type<br />
! Value<br />
|-<br />
| <code>USE_INTERNAL_CRYPTO</code><br />
| Use the provided copies of crypto libraries. <!-- FIXME: I think these are nettle and something else --><br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_GLEW</code><br />
| Use the provided copy of GLEW.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_JPEG</code><br />
| Use the provided copy of JPEG.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SDL</code><br />
| Use the provided copy of SDL.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SPEEX</code><br />
| Use the provided copy of Speex.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_WEBP</code><br />
| Use the provided copy of WebP.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_CURSES</code><br />
| Enables/disables curses.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>PNG_LIBRARY</code><br />
| Path to the PNG library DLL.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng/libs/win32/libpng.lib</code><br />
|-<br />
| <code>PNG_PNG_INCLUDE_DIR</code><br />
| Path to the PNG library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng</code><br />
|-<br />
| <code>FREETYPE_LIBRARY</code><br />
| Path to the compiled FreeType library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/lib/freetype.lib</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_freetype2</code><br />
| Path to the FreeType library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/freetype2</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_ft2build</code><br />
| Path to the FreeType library file "ftbuild.h".<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/</code><br />
|-<br />
| <code>GMP_INCLUDE_DIR</code><br />
| Path to the GMP library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/gmp/include</code><br />
|-<br />
| <code>GMP_LIBRARY</code><br />
| Path to the GMP library.<br />
| <code>FILEPATH</code><br />
| <code><var>path/to/compiled/gmp/</var>.libs/cyggmp-10.dll</code><br />
|-<br />
| <code>ZLIB_INCLUDE_DIR</code><br />
| Path to the zlib library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/include</code><br />
|-<br />
| <code>ZLIB_LIBRARY</code><br />
| Path to the zlib library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/lib/x32/zlib1.dll</code><br />
|-<br />
| <code>CURL_LIBRARY</code><br />
| Path to the CURL library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/lib/win32/release/libcurl.dll</code><br />
|-<br />
| <code>CURL_INCLUDE_DIR</code><br />
| Path to the zlib library.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/include/curl</code><br />
|-<br />
| <code>USE_OPENAL</code><br />
| Enables/disables OpenAL support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_THEORA</code><br />
| Enables/disables Theora support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_XVID</code><br />
| Enables/disables Xvid support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CODEC_THEORA</code><br />
| Enables/disables Ogg support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>SDL_LIBRARY</code><br />
| The path to the SDL DLL.<br />
| <code>FILEPATH</code><br />
| <code><var>BuildPath</var>/SDL.dll</code><br />
|-<br />
| <code>SDLMAIN_LIBRARY</code><br />
| Enables/disables Ogg support.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code><br />
|-<br />
|}<br />
Do note that CMake is slash-direction&ndash;agnostic; it can handle both forward- and backslashes on Windows.<br />
<p>If you would like to compile a debug build, change <code>CMAKE_RELEASE_TYPE</code> from <code>Release</code> to <code>Debug</code>.</p><br />
</li><br />
<li>Open <code><var>SourcePath</var>/CMakeLists.txt</code> and edit the line<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi z )<br />
</pre><br />
(around line 1040) to look like this:<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi )<br />
</pre><br />
Also edit around line 1700:<br />
<pre><br />
###########################<br />
#Configure Download Script#<br />
###########################<br />
<br />
if( NOT MSVC )<br />
</pre><br />
to look like this:<br />
<pre><br />
###########################<br />
#Configure Download Script#<br />
###########################<br />
<br />
if( NOT WIN32 )<br />
</pre><br />
</li><br />
<li>Open <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code> and edit the lines:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "SDL.h"<br />
#include "SDL_main.h"<br />
</pre><br />
to look like:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "../../../include/SDL.h"<br />
#include "../../../include/SDL_main.h"<br />
</pre><br />
<li>Open a command prompt and <code>cd</code> to your source directory.</li><br />
<li>Run <code>make</code>:<br />
<pre><br />
> mingw32-make<br />
</pre><br />
If you would like verbose output, set the <code>VERBOSE</code> environment variable before running <code>make</code>.<br />
<pre><br />
> set VERBOSE=1<br />
</pre><br />
To make it easier to build the source, you can create a batch file (call it something like <code>compile.bat</code>) and place it in your build directory:<br />
<pre><br />
@echo off<br />
<br />
set RETURN=compile<br />
<br />
:get_time<br />
:: Thank you, Rob van der Woude:<br />
:: (http://www.robvanderwoude.com/datetimentparse.php)<br />
FOR /F "tokens=1,2,3 delims=:." %%A IN ("%Time%") DO (<br />
SET /A HOURS = 100%%A %% 100<br />
SET /A MINUTES = 100%%B %% 100<br />
SET /A SECONDS = 100%%C %% 100<br />
)<br />
SET /A TICKS=( %HOURS% * 3600 ) + ( %MINUTES% * 60 ) + %SECONDS%<br />
GOTO %RETURN%<br />
<br />
:compile<br />
SET START_TICKS=%TICKS%<br />
<br />
SET VERBOSE=1<br />
:: mingw32-make clean<br />
mingw32-make -j4<br />
<br />
set RETURN=finish<br />
GOTO get_time<br />
<br />
:finish<br />
SET /A COMPILE_TIME=%TICKS% - %START_TICKS%<br />
SET /A MINUTES=%COMPILE_TIME% / 60<br />
SET /A SECONDS=%COMPILE_TIME% %% 60<br />
ECHO.<br />
ECHO Compilation took %MINUTES%m %SECONDS%s.<br />
PAUSE<br />
</pre><br />
</li><br />
<li>Once compilation finishes, you will find that the game will fail to run due to DLL dependencies. To resolve these:<br />
<ul><br />
<li>You will need to move <code>INTERNAL_GLEW</code> from the <code>Release/</code> folder of the build directory to the root of the build directory.</li><br />
<li>You will need to place the following other DLLs in your build directory:<br />
* freetype6.dll<br />
* libbz2.dll<br />
* libcurl.dll<br />
* libogg.dll<br />
* libpng14-14.dll<br />
* libtheora.dll<br />
* libvorbis.dll<br />
* libvorbisfile.dll<br />
* msvcr100.dll<br />
* msvcr100d.dll<br />
* zlib1.dll<br />
* zlibwapi.dll<br />
The easiest way to obtain these DLLs is by copying them from the installation directory of an [http://sourceforge.net/projects/unvanquished/files/latest/download official release] of Unvanquished.<br />
</li><br />
<li>You will need to copy your compiled DLL of GMP to your build directory. It may be found in <code><var>path/to/compiled/gmp/</var>.libs/cyggmp-10.dll</code>.</li><br />
<li>As you compiled GMP with Cygwin, it in turn depends on <code>cygwin1.dll</code>, which may typically be found in <code>C:\cygwin\bin\</code>. Copy and paste it into your build directory.</li><br />
</ul><br />
Once you have completed these steps, you should never have to do them again.<br />
</li><br />
</ol><br />
<br />
====Notes====<br />
<br />
* If you would like to use curses, try using [http://sourceforge.net/projects/pdcurses/files/pdcurses PDCurses].<br />
<br />
===QtCreator===<br />
<br />
# Install MinGW and follow the above instructions, except select Code::Blocks as the generator.<br />
# Start QtCreator, and select "Open File or Project&hellip;" from the File menu.<br />
# Navigate to your source directory and open CMakeLists.txt.<br />
# At the CMake Wizard, select the same build directory you already configured using CMake. (If you did not chose Code::Blocks as the generator, you will have to start over again, as QtCreator requires a Code::Blocks project file in order to compile the source.)<br />
# Ensure that a generator is selected in the combo box, and click "Run CMake". If there is no generator listed, see the [[#Troubleshooting|troubleshooting]] section below.<br />
# Click "Finish" to close the wizard.<br />
<br />
You should now be able to compile, run, and debug the code using QtCreator.<br />
<br />
====Troubleshooting====<br />
<br />
If at the "Run CMake" prompt of the the CMake Wizard, select "Run CMake" and are warned that no generator was selected, and notice that there are no generators in the combo box, you will likely have to [http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html manually configure your toolchain]. Select "Options&hellip;" from the "Tools" menu, then navigate to "Build &amp; Run".<br />
<br />
At the options window,<br />
* Go to the "Kits" tab, and mouse over the "Desktop (default)" kit under "Manual". If there were any errors in configuring this kit, they will be displayed in the tool tip. If there are problems, select the kit. You may need to manually specify the location of the MinGW debugger, for example, which is typically <code>C:\MinGW\bin\gdb.exe</code>.<br />
* Go to the "Compilers" tab, and ensure that MinGW is present. If not, you will need to add it manually.<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 />
libgmp3-dev libjpeg8-dev libncurses5-dev libogg-dev libopenal-dev \<br />
libpng12-dev libsdl1.2-dev libvorbis-dev zlib1g-dev nettle-dev \<br />
libwebp-dev libspeexdsp-dev libtheora-dev<br />
<br />
If the version of WebP supplied by your version of Debian or Ubuntu is older than v0.2.0, you will need to [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0.tar.gz download] and [https://developers.google.com/speed/webp/docs/compiling#unix compile it from source]. After compiling and installing with <code>sudo make install</code>, in CMake, you'll need to set <code>WEBP_INCLUDE_DIR</code> to <code>/usr/local/include/webp</code> and <code>WEBP_LIBRARY</code> to <code>/usr/local/lib/libwebp.so</code>.<br />
<br />
'''We currently provide a ready-to-use libwebp-dev in our [http://{{SERVERNAME}}/index.php/Download#ubuntu Debian and Ubuntu repositories], alongside .debs of the game and server.'''<br />
<br />
Actual dev package names may vary, e.g. libgmp-dev instead of libgmp3-dev and libglew-dev or libglew1.7-dev instead of libglew1.5-dev.<br />
<br />
Since we have a debian directory in the source, you can also to check what's needed then install the listed packages (choosing from alternatives as needed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ dpkg-checkbuilddeps<br />
…<br />
$ sudo apt-get install <var>package(s)</var><br />
<br />
If dpkg-checkbuilddeps produces no output, you have all necessary build dependencies. Also, debhelper's only needed if you're building .debs.<br />
<br />
====Gentoo====<br />
<br />
$ emerge curl freetype glew gmp jpeg ncurses libogg openal libpng libsdl libvorbis zlib<br />
<br />
====openSUSE====<br />
<br />
$ sudo install zypper gcc gcc-c++ Mesa-libGL-devel SDL-devel libjpeg8-devel \<br />
libpng12-devel glew-devel webp-devel ncurses-devel gmp-devel libcurl-devel \<br />
libnettle-devel openal-soft-devel speex-devel libvorbis-devel \<br />
libtheora-devel<br />
<br />
The latest version of WebP must be installed manually:<br />
<br />
$ wget https://webp.googlecode.com/files/libwebp-0.2.1.tar.gz<br />
$ tar xvzf libwebp-0.2.1.tar.gz<br />
$ cd libwebp-0.2.1<br />
$ ./configure && make<br />
$ sudo make install<br />
<br />
You must disable curses (set <code>USE_CURSES</code> appropriately in CMake) as failing to do so will cause Unvanquished to crash on startup.<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 />
On Debian or 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 />
Or, in Debian or Ubuntu, you can build a package (but you'll need to have devscripts and fakeroot installed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ fakeroot dpkg-buildpackage -b -uc<br />
$ sudo dpkg -i <var>../unvanquished_*.deb</var><br />
<br />
Once in <code>ccmake</code>, use the following keys:<br />
<br />
* Press {{Hotkey|c}} to configure. If an error occurs during this phase, make note of it and press {{Hotkey|e}} to dismiss it.<br />
* Use the up and down arrow keys to navigate the compilation options.<br />
* Press {{Hotkey|Enter}} to enable or disable boolean options (i.e., on/off) or to edit textual options.<br />
** Press {{Hotkey|Esc}} when editing a textual option to cancel the change.<br />
<br />
Once you have finished the configuration process, press {{Hotkey|C}} again, then {{Hotkey|G}} 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=====<br />
<br />
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_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 />
* <code>USE_CIN_THEORA</code> &mdash; Disabling this prevents videos from being recorded in Theora.<br />
* <code>USE_CIN_XVID</code> &mdash; Disabling this prevents videos from being recorded in Xvid.<br />
* <code>USE_VOIP</code> &mdash; Disabling this removes VOIP support. Alternatively enabling <code>USE_INTERNAL_SPEEX</code> will use the libraries distributed with Unvanquished for VoIP<br />
* <code>USE_INTERNAL_CRYPTO</code> &mdash; Enable this to use the crypto libraries provided by Unvanquished.<br />
<br />
===Compiling===<br />
<br />
$ cd <var>path/to/unvanquished/build</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 />
===Acquiring mandatory game files===<br />
<br />
The game files are not in the Git repository, and must be downloaded separately. This may be done on the command line or from your web browser. The downloads may be found on [http://sourceforge.net/projects/unvanquished/files/Assets SourceForge.net]. If you download the files from your browser, just download the files named "pak*.pk3", and save them to the [[Running_the_game#Data_locations|data location]] for your system.<br />
<br />
On Linux, this may be done as follows:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
wget -O $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On FreeBSD, using the <code>sh</code> shell:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
fetch -r -o $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On Mac OS X:<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
curl -L "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download" > $file<br />
fi<br />
done<br />
<br />
Linux users may also use the <code>download-pk3.sh</code> script that is distributed with the source code, which requires that curl be installed:<br />
<br />
$ cd <var>[path to Unvanquished source code]</var><br />
$ mkdir -p ~/.Unvanquished/main<br />
$ ./download-pk3.sh ~/.Unvanquished/main<br />
<br />
===Downloading the map pack===<br />
<br />
The map pack exists only for convenience; if you do not download the map pack, Unvanquished will automatically download maps as needed when you attempt to play online.<br />
<br />
To download the map pack on Linux:<br />
<br />
$ wget -O maps.7z "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z"; done<br />
<br />
To download the map pack on Mac OS X:<br />
<br />
$ curl -L "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z" > maps.7z; done<br />
<br />
Note that you will need to unzip the map pack on either system as it is compressed with LZMA. Mac users can use the [http://wakaba.c3.cx/s/apps/unarchiver.html Unarchiver]. Uncompressing the archive on Linux is highly dependent on your distribution.<br />
<br />
===Verifying the Files===<br />
<br />
Download the latest [http://sourceforge.net/projects/unvanquished/files/Assets/{{CurrentVersion|MD5HashFile}} MD5 hash file] and save it to your system's [[Running_the_game#Data_directory|data location]].<br />
<br />
On systems with the <code>md5</code> command (Mac OS X):<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ cat {{CurrentVersion|MD5HashFile}} | while read line; do<br />
file="`echo "$line" | sed -E "s/^[a-fA-F0-9]+ +\*?//"`"<br />
if [ -e "$file" ]; then<br />
if [ `md5 -r "$file" | cut -d\ -f1` = "`echo "$line" | cut -d\ -f1`" ]<br />
then echo "File \"$file\" appears okay."<br />
else echo "File \"$file\" is corrupt"'!' >&2<br />
fi; fi; done<br />
<br />
On systems with the <code>md5sum</code> command (most Linux distributions):<br />
<br />
$ cd <var>[[Running_the_game#Data_directory|/path/to/data/files]]</var><br />
$ md5sum -c {{CurrentVersion|MD5HashFile}} 2>&1 | grep -v "open or read\|file or directory"<br />
<br />
The <code>grep</code> invocation is used to strip output complaining about missing files.<br />
<br />
Any files that are found to be corrupt should be replaced; just download a [http://sourceforge.net/projects/unvanquished/files/Assets new copy] of the affected file(s).<br />
<br />
==Errors==<br />
<br />
===CMake cannot locate Newton===<br />
<br />
If CMake cannot find Newton, you'll need to set it up yourself.<br />
<br />
It should be in <code><var>/path/to/Unvanquished</var>/src/libs/libnewton/libs/<var>your_os</var>/libNewton.so</code>.<br />
Be sure to replace <var>your_os</var> with the proper directory name.<br />
<br />
Use CMake as before to change the <code>NEWTON_LIBRARY</code> build setting to the said path:<br />
<br />
# Start the CMake configurator:<pre>$ ccmake ..</pre><br />
# Scroll down and highlight <code>NEWTON_LIBRARY</code>.<br />
# Press {{Hotkey|Enter}} to begin editing and input in the path.<br />
# Press {{Hotkey|C}} to configure and {{Hotkey|G}} to generate the new makefiles.<br />
# Press {{Hotkey|Q}} to quit.<br />
# Recompile the source:<pre>$ make</pre><br />
<br />
===The C Compiler is not able to compile a simple test program===<br />
<br />
When attempting to generate a solution for Xcode CMake fails with the following error<br />
-- Check for working C compiler using: Xcode -- broken<br />
CMake Error at /Applications/CMake 2.8-8.app/Contents/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):<br />
The C compiler "/usr/bin/gcc" is not able to compile a simple test program.<br />
<br />
It fails with the following output:<br />
<br />
Change Dir: /Users/danielmaloney/Documents/Unvanquished/build-xcode/CMakeFiles/CMakeTmp<br />
<br />
<br />
<br />
Run Build Command:/Applications/CMake\ 2.8-8.app/Contents/bin/cmakexbuild<br />
-project CMAKE_TRY_COMPILE.xcodeproj build -target<br />
cmTryCompileExec1400153232 -configuration Debug<br />
<br />
Error: No developer directory found at /Developer. Run<br />
/usr/bin/xcode-select to update the developer directory path.<br />
<br />
<br />
<br />
<br />
<br />
CMake will not be able to correctly generate this project.<br />
Call Stack (most recent call first):<br />
CMakeLists.txt:19 (project)<br />
<br />
This is due to Xcode 4.3 having a different directory structure to previous versions. Simply running the following command will correct this error:<br />
sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer/</div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Compiling_the_source&diff=1962Compiling the source2013-04-14T23:04:50Z<p>Velociostrich: /* Instructions */ s/terminal/command prompt/, fix a closing pre tag</p>
<hr />
<div>==Mac OS X==<br />
<br />
First, you need to [[Getting_the_source|acquire the source code]].<br />
<br />
Regardless of what interface you may use to compile the source, you will need [http://www.cmake.org/cmake/resources/software.html CMake] to generate makefiles. You will also need to install [https://developer.apple.com/xcode/ Xcode] (making sure to choose to install the command-line utilities when prompted by the installer).<br />
<br />
Then, you will need to acquire (and in some cases, manually compile) at a minimum the [[#Dependencies|necessary libraries]].<br />
<br />
Once you have the source code and the libraries installed, you may actually proceed to compile the source. You have several options:<br />
* '''Compile the source at the command line'''. This is the easiest if you would just like to compile the game to use yourself and you do not intend to work on the code.<br />
* '''Compile the source using an IDE'''. This is preferred if you intend on developing the source.<br />
** Xcode is Apple's flagship IDE and you should have installed to compile the source regardless of which method you use.<br />
** [http://qt-project.org/downloads QtCreator] is cross-platform and provides real-time feedback of syntax errors, a Vim mode, as well as other features.<br />
** [http://www.codeblocks.org/ Code::Blcoks] is also cross-platform but lacks some of the features of Xcode and QtCreator.<br />
<br />
===Dependencies===<br />
<br />
You only need to use one of the following methods (HomeBrew or compiling by hand). Please try and avoid mixing methods as this may produce unexpected results.<br />
<br />
Unvanquished requires the following libraries:<br />
* [[#JPEG|JPEG]], version 8 or higher. (Version 6 was known to have problems)<br />
* [[#Simple_DirectMedia_Layer_.28SDL.29|Simple DirectMedia Layer]] (The binary provided by libsdl.org causes graphical corruptions. Compile from source or use homebrew/macports)<br />
* [[#The_OpenGL_Extension_Wrangler_Library_.28GLEW.29|The OpenGL Extension Wrangler Library]]<br />
* CuRL<br />
* [[#The_GNU_MP_Bignum_Library_.28libgmp.29|GMP]]<br />
* [[#WebP|WebP]] (v0.2.0 or newer)<br />
<br />
The following libraries are optional:<br />
* Theora<br />
* Speex<br />
* [[#Ogg|Ogg]]<br />
* [[#Vorbis|Vorbis]]<br />
<br />
====HomeBrew====<br />
Install [http://mxcl.github.com/homebrew/ HomeBrew] and then run the following command<br />
<br />
$ brew install nettle libjpeg curl sdl webp xvid gmp glew speex libvorbis theora<br />
<br />
All the necessary libraries should now have been installed.<br />
<br />
====Compiling by hand====<br />
The following are shell scripts that download, compile, and install various libraries. This is more time consuming then other methods but might be useful if you need more control over your libraries<br />
<br />
=====JPEG=====<br />
<br />
$ curl http://www.ijg.org/files/jpegsrc.v8d.tar.gz > jpegsrc.v8d.tar.gz<br />
$ tar xvzf jpegsrc.v8d.tar.gz<br />
$ cd jpeg-8d<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The OpenGL Extension Wrangler Library (GLEW)=====<br />
<br />
$ curl -L https://sourceforge.net/projects/glew/files/glew/1.7.0/glew-1.7.0.tgz/download > glew-1.7.0.tgz<br />
$ tar xvzf glew-1.7.0.tgz<br />
$ cd glew-1.7.0<br />
$ make<br />
$ sudo make install<br />
<br />
=====Simple DirectMedia Layer (SDL)=====<br />
<br />
Do not use the binaries provided by libsdl.org, as these are known to cause issues with gamma and color display. Instead, compile your own:<br />
<br />
$ curl http://www.libsdl.org/release/SDL-1.2.15.tar.gz > SDL-1.2.15.tar.gz<br />
$ tar xvzf SDL-1.2.15.tar.gz<br />
$ cd SDL-1.2.15<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The GNU MP Bignum Library (libgmp)=====<br />
<br />
$ curl ftp://ftp.gmplib.org/pub/gmp-5.0.5/gmp-5.0.5.tar.bz2 > gmp-5.0.5.tar.bz2<br />
$ tar xvjf gmp-5.0.5.tar.bz2<br />
$ cd gmp-5.0.5<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Ogg=====<br />
<br />
$ curl http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz > libogg-1.3.0.tar.gz<br />
$ tar xvzf libogg-1.3.0.tar.gz<br />
$ cd libogg-1.3.0<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Vorbis=====<br />
<br />
$ curl http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz > libvorbis-1.3.3.tar.gz<br />
$ tar xvzf libvorbis-1.3.3.tar.gz<br />
$ cd libvorbis-1.3.3<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====WebP=====<br />
<br />
You do not need to compile WebP by hand; Google provides binaries for Mac OS X available from their [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0-mac-10.5.tar.gz project page]. You will need version 0.2.0 or newer.<br />
<br />
Once downloaded, you must still install the header files and the binary:<br />
<br />
$ curl https://webp.googlecode.com/files/libwebp-0.2.0-mac-10.5.tar.gz > libwebp-0.2.0-mac-10.5.tar.gz<br />
$ tar xvzf libwebp-0.2.0-mac-10.5.tar.gz<br />
$ cd libwebp-0.2.0-mac-10.5<br />
$ sudo cp include/webp /usr/local/include<br />
$ sudo cp lib/libwebp.a /usr/local/lib<br />
<br />
===Configuring with CMake===<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 should be a different directory.<br />
# Hit "Configure". You will be prompted as to which generator you would like to use. If you have Xcode installed, choose that. Wait while the configuration process runs. You may have to set the following:<br />
## If CMake did not find your jpeg headers for some reason, set <code>JPEG_INCLUDE_DIR</code> to <code>/path/to/Unvanquished/src/libs/jpeg</code>.<br />
## Check <code>USE_INTERNAL_CRYPTO</code> to avoid having to compile nettle and hogweed.<br />
## Check <code>USE_INTERNAL_SPEEX</code> to avoid having to compile Speex.<br />
## Uncheck <code>USE_CIN_THEORA</code> and <code>USE_CIN_XVID</code> to avoid having to compile Theora or Xvid. (At present, there are not cutscenes or any such that require it.)<br />
## '''You will probably not be able to compile with the GLSL optimizer enabled; uncheck <code>USE_GLSL_OPTIMIZER</code>'''<br />
## If you have selected to generate Xcode project files, make the <code>SDLMAIN_LIBRARY</code> field blank. This option is not available if you have the generator set to Unix makefiles.<br />
# Hit "Generate".<br />
# You may now close Xcode.<br />
<br />
===Compiling===<br />
<br />
====With Xcode====<br />
<br />
<ol><br />
<li>Compilation will fail unless you manually create certain directories needed by the build scripts:<br />
<pre><br />
$ cd /path/to/build/dir/CMakeFiles<br />
$ mkdir gpp{game,trem,ui}-qvm.dir<br />
</pre><br />
This is a workaround to {{Issue|101}}.<br />
</li><br />
<li>Either start Xcode and open the project file (in the build directory you specified) or double-click the project file in Finder.</li><br />
<li>Open the project file created by CMake, which should be in the build directory you specified.</li><br />
<li>Change the active target to "ALL_BUILD" and click Product&rarr;Build.</li><br />
</ol><br />
<br />
====With Unix Makefiles====<br />
<br />
<ul><br />
<li>Start Terminal (Applications &rarr; Utilities &rarr; Terminal).</li><br />
<li>Input the following commands:<br />
<pre><br />
$ cd /path/to/Unvanquished-build<br />
$ make<br />
</pre><br />
If you are on a multi-core or multi-processor machine, you may speed up the process by passing the <code>-j</code> argument followed by the number of available cores to <code>make</code>; e.g., <code>make -j4</code>. Note that doing so makes reading error messages more difficult, as multiple instances of the compiler will print to the screen at once, causing information to appear out of order.<br />
</li><br />
</ul><br />
<br />
===Testing the build===<br />
<br />
====With Xcode 4====<br />
<br />
To test the game, select the "client" scheme from the combo box on the toolbar, and click the run button or press {{Hotkey|MacCommand}}{{Hotkey|R}}.<br />
<br />
====With Unix Makefiles====<br />
<br />
After compiling, you'll have to place the data files in the <code>main</code> directory in your build directory. [[#Acquiring the Game Files|For download instructions, see below.]]<br />
<br />
Your file structure should look as follows:<br />
<br />
[[File:Build_dir_Mac_OS_X.png]]<br />
<br />
You may now start the application as such:<br />
<br />
$ ./daemon.i386<br />
<br />
Note that older machines will not support the new OpenGL 3 renderer, and must be started specifying the "vanilla" (aka "GL") renderer:<br />
<br />
$ ./daemon.i386 +set cl_renderer GL<br />
<br />
===Bundling the Application===<br />
<br />
====With CPack====<br />
<br />
CPack is able to create standalone bundles (as well as many other types of installers). However you must generate the files using Unix Makefiles instead of Xcode.<br />
<br />
$ cd /path/to/Unvanquished-build<br />
$ cpack -G Bundle<br />
<br />
Some warnings will be printed however these can be safely ignored. There should be a file called Unvanquished.dmg in the Unvanquished-build folder.<br />
<br />
====Manually====<br />
<br />
You'll find the Mac [http://macdylibbundler.sourceforge.net/ dynamic library bundler] to be quite useful (you must generate the files using Unix Makefiles instead of Xcode):<br />
<br />
$ curl -L http://sourceforge.net/projects/macdylibbundler/files/macdylibbundler/0.4.1/dylibbundler0.4.1.zip/download > \<br />
dylibbundler0.4.1.zip<br />
$ unzip dylibbundler0.4.1.zip<br />
$ cd dylibbundler<br />
$ make<br />
$ sudo make install<br />
<br />
Once you've done that, you can proceed to create the application bundle. Note that these steps assume that you have downloaded the data files to <code>main/</code> as shown above:<br />
<br />
<pre><br />
$ git=/path/to/Unvanquished-git-repo<br />
$ build=/path/to/Unvanquished-build-dir<br />
$ mkdir -pv Unvanquished.app/Contents/{libs,MacOS,Resources,Frameworks}<br />
$ cp -r $build/main Unvanquished.app/Contents/MacOS<br />
$ sips -s format tiff $git/debian/unvanquished.png --out temp.tiff<br />
$ tiff2icns temp.tiff Unvanquished.app/Contents/Resources/Unvanquished.icns<br />
$ rm temp.tiff<br />
$ cp $build/daemon{,ded}.i386 $build/*.dylib Unvanquished.app/Contents/MacOS<br />
$ cp -r /Library/Frameworks/SDL.framework Unvanquished.app/Contents/Frameworks<br />
$ install_name_tool -id \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/Frameworks/SDL.framework/Versions/A/SDL<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGLi386.dylib<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGL3i386.dylib<br />
$ for binary in Unvanquished.app/Contents/MacOS/*.{i386,dylib}; do<br />
dylibbundler -b -x $binary -d $dest/Unvanquished.app/Contents/libs/; done<br />
$ cp /usr/lib/libGLEW.1.7.0.dylib ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ chmod +w ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -id @executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -change /usr/lib/libGLEW.1.7.0.dylib \<br />
@executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ cat > Unvanquished.app/Contents/Info.plist<br />
<?xml version="1.0" encoding="UTF-8"?><br />
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"<br />
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"><br />
<plist version="1.0"><br />
<dict><br />
<key>CFBundleName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleDisplayName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleExecutable</key><br />
<string>daemon.i386</string><br />
<key>CFBundleIconFile</key><br />
<string>Unvanquished.icns</string><br />
<key>CFBundleIdentifier</key><br />
<string>net.Unvanquished</string><br />
<key>CFBundleInfoDictionaryVersion</key><br />
<string>6.0</string><br />
<key>CFBundlePackageType</key><br />
<string>APPL</string><br />
<key>CFBundleShortVersionString</key><br />
<string>0.4.0</string><br />
<key>CFBundleVersion</key><br />
<string>0.4.0</string><br />
</dict><br />
</plist><br />
^d<br />
</pre><br />
<br />
Note: <code>^d</code> indicates pressing {{Hotkey|Ctrl}}{{Hotkey|D}} on the keyboard.<br />
<br />
The contents of the completed application bundle should look like this:<br />
<br />
[[File:Bundle_dir_Mac_OS_X.png]]<br />
<br />
'''Note''': If you compiled SDL from source, you will not see a directory titled <code>SDL.framework</code>.<br />
<br />
==Windows==<br />
<br />
===Visual Studio===<br />
<br />
CMake can generate Visual Studio projects for unvanquished however this feature is relatively new and may have some bugs.<br />
<br />
Steps:<br />
<br />
# Double click on Visual_Studio32.bat<br />
# Open build-32/Daemon.sln in Visual Studio 2010.<br />
# In the two text boxes in the toolbar, select "Release" or "Debug" in the first one and Win32 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 />
====Important Notes====<br />
<br />
* LLVM is disabled and does not work correctly with CMake generated Visual Studio projects.<br />
* ncurses is not supported under Visual Studio.<br />
* The path to the build folder must not have any spaces otherwise generation of QVMs will fail. See [https://github.com/Unvanquished/Unvanquished/issues/102 issue 102]<br />
* Due to limitations with cmake neither the startup project nor the working directory can be specified. These must be manually set to the following values for debugging the client under Visual Studio<br />
** Right click on client and select "Set as StartUp project".<br />
** Right click on client, select properties, select Debugging and set "Working Directory" to $(TargetPath)\..<br />
<br />
===MinGW===<br />
<br />
It is possible to build Unvanquished with MinGW, although the process is rather arduous compared to Visual Studio or compiling for other platforms.<br />
<br />
====Notes====<br />
<br />
* The easiest way to acquire and install MinGW is with the graphical [http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/ mingw-get-inst installer]. <!-- TODO: maybe walk the user through the installer? --><br />
* When configuring the build with CMake, you will find that you will have to set a number of libraries manually. You can find precompiled DLLs for most of the dependencies; those that are not pre-compiled can be built with the corresponding <code>USE_INTERNAL_</code> setting.<br />
* On Windows, SDL requires that the Direct X SDK can be installed. You may download the June 2010 release from [http://www.microsoft.com/en-us/download/details.aspx?id=6812 Microsoft's site].<br />
* '''The build will fail during QVM compilation if your source or build directories contain spaces.''' This is due to a bug with lcc. If your home directory contains a space, you may want to create source and build directories at the root of one of your drives (e.g., <code>C:\Unvanquished\Source</code> and <code>C:\Unvanquished\Build</code>.)<br />
<br />
====Instructions====<br />
<br />
The easiest way to get a build up (at the time of writing) is as follows:<br />
<br />
{{Note|content=Although there are 64-bit binaries of most of the libraries required to build the game, these do not work with MinGW at present, so the following instructions all use the 32-bit binaries.}}<br />
<br />
<ol><br />
<li>Although there are binaries of gmp distributed with the source, they have are dependent on Visual Studio's implementations of <code>_ftol2_sse</code> and <code>_alloca_probe_16</code>. A fix may be found on [http://stackoverflow.com/questions/6753111/static-linking-with-openssl Stack Exchange], but requires that Visual Studio be installed, which defeats the purpose of attempting to use MinGW to compile the source. You can build gmp yourself:<br />
<ol><br />
<li>Download and extract the latest version of the [http://gmplib.org/ GNU MP Bignum Library (GMP)]. (You will need either cygwin with tar and bz2 installed or 7-zip to extract the archive.)</li><br />
<li>Install the following Cygwin packages if you have not already:<br />
* binutils<br />
* gcc<br />
* gcc-g++<br />
* m4<br />
* make<br />
</li><br />
<li>As part of the GMP compilation process, a file called <code>gen-fib.c</code> generates a table of numbers in the Fibonacci sequence. The generated file does not play nicely with Cygwin or MinGW, so you must fix it. Edit <code>gen-fib.c</code>, and at around line 100, change these lines<br />
<pre><br />
for (i = 0; i < fnum; i++)<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
printf ("), /* %d */\n", i-1);<br />
}<br />
printf ("};\n");<br />
</pre><br />
to look like this:<br />
<pre><br />
for (i = 0; i < fnum; i++)<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
printf (")%c /* %d */\n", (i == (fnum-1)) ? ' ' : ',', i-1);<br />
}<br />
printf ("};\n");<br />
</pre><br />
The patch file looks like this:<br />
<pre><br />
@@ -100,7 +100,7 @@<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
- printf ("), /* %d */\n", i-1);<br />
+ printf (")%c /* %d */\n", (i == (fnum-1)) ? ' ' : ',', i-1);<br />
}<br />
printf ("};\n");<br />
}<br />
</pre><br />
</li><br />
<li>Compiling with MinGW does not work, so you will need to compile with Cygwin. At the prompt:<br />
<pre><br />
$ ./configure --disable-static --enable-shared<br />
$ make<br />
</pre><br />
The <code>--disable-static</code> and <code>--enable-shared</code> flags configure GMP to build a DLL instead of a static library. You may optionally perform <code>make install</code>. Additional compilation instructions [http://www.cs.nyu.edu/exact/core/gmp/ are available].<br />
<p>If you experience difficulties with compilation and it appears that MinGW gcc is being detected by <code>configure</code> and not Cygwin gcc, you can try editing your <code>PATH</code> variable:</p><br />
<pre><br />
$ export PATH=`echo $PATH | sed "s|/cygdrive/c/MinGW/bin:||"`<br />
</pre><br />
Re-run <code>configure</code> and <code>make</code> afterwards.<br />
</ol><br />
</li><br />
<li>Download the [http://www.libsdl.org/release/SDL-1.2.15-win32.zip latest stable version] of SDL for Windows. Extract the archive and copy <code>SDL.dll</code> from it to the root of your build directory.</li><br />
<li>Set the following CMake flags:<br />
{| class="wikitable"<br />
! Setting<br />
! Description<br />
! Type<br />
! Value<br />
|-<br />
| <code>USE_INTERNAL_CRYPTO</code><br />
| Use the provided copies of crypto libraries. <!-- FIXME: I think these are nettle and something else --><br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_GLEW</code><br />
| Use the provided copy of GLEW.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_JPEG</code><br />
| Use the provided copy of JPEG.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SDL</code><br />
| Use the provided copy of SDL.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SPEEX</code><br />
| Use the provided copy of Speex.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_WEBP</code><br />
| Use the provided copy of WebP.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_CURSES</code><br />
| Enables/disables curses.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>PNG_LIBRARY</code><br />
| Path to the PNG library DLL.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng/libs/win32/libpng.lib</code><br />
|-<br />
| <code>PNG_PNG_INCLUDE_DIR</code><br />
| Path to the PNG library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng</code><br />
|-<br />
| <code>FREETYPE_LIBRARY</code><br />
| Path to the compiled FreeType library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/lib/freetype.lib</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_freetype2</code><br />
| Path to the FreeType library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/freetype2</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_ft2build</code><br />
| Path to the FreeType library file "ftbuild.h".<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/</code><br />
|-<br />
| <code>GMP_INCLUDE_DIR</code><br />
| Path to the GMP library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/gmp/include</code><br />
|-<br />
| <code>GMP_LIBRARY</code><br />
| Path to the GMP library.<br />
| <code>FILEPATH</code><br />
| <code><var>path/to/compiled/gmp/</var>.libs/cyggmp-10.dll</code><br />
|-<br />
| <code>ZLIB_INCLUDE_DIR</code><br />
| Path to the zlib library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/include</code><br />
|-<br />
| <code>ZLIB_LIBRARY</code><br />
| Path to the zlib library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/lib/x32/zlib1.dll</code><br />
|-<br />
| <code>CURL_LIBRARY</code><br />
| Path to the CURL library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/lib/win32/release/libcurl.dll</code><br />
|-<br />
| <code>CURL_INCLUDE_DIR</code><br />
| Path to the zlib library.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/include/curl</code><br />
|-<br />
| <code>USE_OPENAL</code><br />
| Enables/disables OpenAL support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_THEORA</code><br />
| Enables/disables Theora support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_XVID</code><br />
| Enables/disables Xvid support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CODEC_THEORA</code><br />
| Enables/disables Ogg support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>SDL_LIBRARY</code><br />
| The path to the SDL DLL.<br />
| <code>FILEPATH</code><br />
| <code><var>BuildPath</var>/SDL.dll</code><br />
|-<br />
| <code>SDLMAIN_LIBRARY</code><br />
| Enables/disables Ogg support.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code><br />
|-<br />
|}<br />
Do note that CMake is slash-direction&ndash;agnostic; it can handle both forward- and backslashes on Windows.<br />
<p>If you would like to compile a debug build, change <code>CMAKE_RELEASE_TYPE</code> from <code>Release</code> to <code>Debug</code>.</p><br />
</li><br />
<li>Open <code><var>SourcePath</var>/CMakeLists.txt</code> and edit the line<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi z )<br />
</pre><br />
(around line 1040) to look like this:<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi )<br />
</pre><br />
Also edit around line 1700:<br />
<pre><br />
###########################<br />
#Configure Download Script#<br />
###########################<br />
<br />
if( NOT MSVC )<br />
</pre><br />
to look like this:<br />
<pre><br />
###########################<br />
#Configure Download Script#<br />
###########################<br />
<br />
if( NOT WIN32 )<br />
</pre><br />
</li><br />
<li>Open <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code> and edit the lines:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "SDL.h"<br />
#include "SDL_main.h"<br />
</pre><br />
to look like:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "../../../include/SDL.h"<br />
#include "../../../include/SDL_main.h"<br />
</pre><br />
<li>Open a command prompt and <code>cd</code> to your source directory.</li><br />
<li>Run <code>make</code>:<br />
<pre><br />
> mingw32-make<br />
</pre><br />
If you would like verbose output, set the <code>VERBOSE</code> environment variable before running <code>make</code>.<br />
<pre><br />
> set VERBOSE=1<br />
</pre><br />
To make it easier to build the source, you can create a batch file (call it something like <code>compile.bat</code>) and place it in your build directory:<br />
<pre><br />
@echo off<br />
<br />
set RETURN=compile<br />
<br />
:get_time<br />
:: Thank you, Rob van der Woude:<br />
:: (http://www.robvanderwoude.com/datetimentparse.php)<br />
FOR /F "tokens=1,2,3 delims=:." %%A IN ("%Time%") DO (<br />
SET /A HOURS = 100%%A %% 100<br />
SET /A MINUTES = 100%%B %% 100<br />
SET /A SECONDS = 100%%C %% 100<br />
)<br />
SET /A TICKS=( %HOURS% * 3600 ) + ( %MINUTES% * 60 ) + %SECONDS%<br />
GOTO %RETURN%<br />
<br />
:compile<br />
SET START_TICKS=%TICKS%<br />
<br />
SET VERBOSE=1<br />
:: mingw32-make clean<br />
mingw32-make -j4<br />
<br />
set RETURN=finish<br />
GOTO get_time<br />
<br />
:finish<br />
SET /A COMPILE_TIME=%TICKS% - %START_TICKS%<br />
SET /A MINUTES=%COMPILE_TIME% / 60<br />
SET /A SECONDS=%COMPILE_TIME% %% 60<br />
ECHO.<br />
ECHO Compilation took %MINUTES%m %SECONDS%s.<br />
PAUSE<br />
</pre><br />
</li><br />
<li>Once compilation finishes, you will find that the game will fail to run due to DLL dependencies. To resolve these:<br />
<ul><br />
<li>You will need to move <code>INTERNAL_GLEW</code> from the <code>Release/</code> folder of the build directory to the root of the build directory.</li><br />
<li>You will need to place the following other DLLs in your build directory:<br />
* freetype6.dll<br />
* libbz2.dll<br />
* libcurl.dll<br />
* libogg.dll<br />
* libpng14-14.dll<br />
* libtheora.dll<br />
* libvorbis.dll<br />
* libvorbisfile.dll<br />
* msvcr100.dll<br />
* msvcr100d.dll<br />
* zlib1.dll<br />
* zlibwapi.dll<br />
The easiest way to obtain these DLLs is by copying them from the installation directory of an [http://sourceforge.net/projects/unvanquished/files/latest/download official release] of Unvanquished.<br />
</li><br />
<li>You will need to copy your compiled DLL of GMP to your build directory. It may be found in <code><var>path/to/compiled/gmp/</var>.libs/cyggmp-10.dll</code>.</li><br />
<li>As you compiled GMP with Cygwin, it in turn depends on <code>cygwin1.dll</code>, which may typically be found in <code>C:\cygwin\bin\</code>. Copy and paste it into your build directory.</li><br />
</ul><br />
Once you have completed these steps, you should never have to do them again.<br />
</li><br />
</ol><br />
<br />
====Notes====<br />
<br />
* If you would like to use curses, try using [http://sourceforge.net/projects/pdcurses/files/pdcurses PDCurses].<br />
<br />
===QtCreator===<br />
<br />
# Install MinGW and follow the above instructions, except select Code::Blocks as the generator.<br />
# Start QtCreator, and select "Open File or Project&hellip;" from the File menu.<br />
# Navigate to your source directory and open CMakeLists.txt.<br />
# At the CMake Wizard, select the same build directory you already configured using CMake. (If you did not chose Code::Blocks as the generator, you will have to start over again, as QtCreator requires a Code::Blocks project file in order to compile the source.)<br />
# Ensure that a generator is selected in the combo box, and click "Run CMake". If there is no generator listed, see the [[#Troubleshooting|troubleshooting]] section below.<br />
# Click "Finish" to close the wizard.<br />
<br />
You should now be able to compile, run, and debug the code using QtCreator.<br />
<br />
====Troubleshooting====<br />
<br />
If at the "Run CMake" prompt of the the CMake Wizard, select "Run CMake" and are warned that no generator was selected, and notice that there are no generators in the combo box, you will likely have to [http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html manually configure your toolchain]. Select "Options&hellip;" from the "Tools" menu, then navigate to "Build &amp; Run".<br />
<br />
At the options window,<br />
* Go to the "Kits" tab, and mouse over the "Desktop (default)" kit under "Manual". If there were any errors in configuring this kit, they will be displayed in the tool tip. If there are problems, select the kit. You may need to manually specify the location of the MinGW debugger, for example, which is typically <code>C:\MinGW\bin\gdb.exe</code>.<br />
* Go to the "Compilers" tab, and ensure that MinGW is present. If not, you will need to add it manually.<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 />
libgmp3-dev libjpeg8-dev libncurses5-dev libogg-dev libopenal-dev \<br />
libpng12-dev libsdl1.2-dev libvorbis-dev zlib1g-dev nettle-dev \<br />
libwebp-dev libspeexdsp-dev libtheora-dev<br />
<br />
If the version of WebP supplied by your version of Debian or Ubuntu is older than v0.2.0, you will need to [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0.tar.gz download] and [https://developers.google.com/speed/webp/docs/compiling#unix compile it from source]. After compiling and installing with <code>sudo make install</code>, in CMake, you'll need to set <code>WEBP_INCLUDE_DIR</code> to <code>/usr/local/include/webp</code> and <code>WEBP_LIBRARY</code> to <code>/usr/local/lib/libwebp.so</code>.<br />
<br />
'''We currently provide a ready-to-use libwebp-dev in our [http://{{SERVERNAME}}/index.php/Download#ubuntu Debian and Ubuntu repositories], alongside .debs of the game and server.'''<br />
<br />
Actual dev package names may vary, e.g. libgmp-dev instead of libgmp3-dev and libglew-dev or libglew1.7-dev instead of libglew1.5-dev.<br />
<br />
Since we have a debian directory in the source, you can also to check what's needed then install the listed packages (choosing from alternatives as needed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ dpkg-checkbuilddeps<br />
…<br />
$ sudo apt-get install <var>package(s)</var><br />
<br />
If dpkg-checkbuilddeps produces no output, you have all necessary build dependencies. Also, debhelper's only needed if you're building .debs.<br />
<br />
====Gentoo====<br />
<br />
$ emerge curl freetype glew gmp jpeg ncurses libogg openal libpng libsdl libvorbis zlib<br />
<br />
====openSUSE====<br />
<br />
$ sudo install zypper gcc gcc-c++ Mesa-libGL-devel SDL-devel libjpeg8-devel \<br />
libpng12-devel glew-devel webp-devel ncurses-devel gmp-devel libcurl-devel \<br />
libnettle-devel openal-soft-devel speex-devel libvorbis-devel \<br />
libtheora-devel<br />
<br />
The latest version of WebP must be installed manually:<br />
<br />
$ wget https://webp.googlecode.com/files/libwebp-0.2.1.tar.gz<br />
$ tar xvzf libwebp-0.2.1.tar.gz<br />
$ cd libwebp-0.2.1<br />
$ ./configure && make<br />
$ sudo make install<br />
<br />
You must disable curses (set <code>USE_CURSES</code> appropriately in CMake) as failing to do so will cause Unvanquished to crash on startup.<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 />
On Debian or 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 />
Or, in Debian or Ubuntu, you can build a package (but you'll need to have devscripts and fakeroot installed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ fakeroot dpkg-buildpackage -b -uc<br />
$ sudo dpkg -i <var>../unvanquished_*.deb</var><br />
<br />
Once in <code>ccmake</code>, use the following keys:<br />
<br />
* Press {{Hotkey|c}} to configure. If an error occurs during this phase, make note of it and press {{Hotkey|e}} to dismiss it.<br />
* Use the up and down arrow keys to navigate the compilation options.<br />
* Press {{Hotkey|Enter}} to enable or disable boolean options (i.e., on/off) or to edit textual options.<br />
** Press {{Hotkey|Esc}} when editing a textual option to cancel the change.<br />
<br />
Once you have finished the configuration process, press {{Hotkey|C}} again, then {{Hotkey|G}} 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=====<br />
<br />
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_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 />
* <code>USE_CIN_THEORA</code> &mdash; Disabling this prevents videos from being recorded in Theora.<br />
* <code>USE_CIN_XVID</code> &mdash; Disabling this prevents videos from being recorded in Xvid.<br />
* <code>USE_VOIP</code> &mdash; Disabling this removes VOIP support. Alternatively enabling <code>USE_INTERNAL_SPEEX</code> will use the libraries distributed with Unvanquished for VoIP<br />
* <code>USE_INTERNAL_CRYPTO</code> &mdash; Enable this to use the crypto libraries provided by Unvanquished.<br />
<br />
===Compiling===<br />
<br />
$ cd <var>path/to/unvanquished/build</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 />
===Acquiring mandatory game files===<br />
<br />
The game files are not in the Git repository, and must be downloaded separately. This may be done on the command line or from your web browser. The downloads may be found on [http://sourceforge.net/projects/unvanquished/files/Assets SourceForge.net]. If you download the files from your browser, just download the files named "pak*.pk3", and save them to the [[Running_the_game#Data_locations|data location]] for your system.<br />
<br />
On Linux, this may be done as follows:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
wget -O $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On FreeBSD, using the <code>sh</code> shell:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
fetch -r -o $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On Mac OS X:<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
curl -L "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download" > $file<br />
fi<br />
done<br />
<br />
Linux users may also use the <code>download-pk3.sh</code> script that is distributed with the source code, which requires that curl be installed:<br />
<br />
$ cd <var>[path to Unvanquished source code]</var><br />
$ mkdir -p ~/.Unvanquished/main<br />
$ ./download-pk3.sh ~/.Unvanquished/main<br />
<br />
===Downloading the map pack===<br />
<br />
The map pack exists only for convenience; if you do not download the map pack, Unvanquished will automatically download maps as needed when you attempt to play online.<br />
<br />
To download the map pack on Linux:<br />
<br />
$ wget -O maps.7z "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z"; done<br />
<br />
To download the map pack on Mac OS X:<br />
<br />
$ curl -L "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z" > maps.7z; done<br />
<br />
Note that you will need to unzip the map pack on either system as it is compressed with LZMA. Mac users can use the [http://wakaba.c3.cx/s/apps/unarchiver.html Unarchiver]. Uncompressing the archive on Linux is highly dependent on your distribution.<br />
<br />
===Verifying the Files===<br />
<br />
Download the latest [http://sourceforge.net/projects/unvanquished/files/Assets/{{CurrentVersion|MD5HashFile}} MD5 hash file] and save it to your system's [[Running_the_game#Data_directory|data location]].<br />
<br />
On systems with the <code>md5</code> command (Mac OS X):<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ cat {{CurrentVersion|MD5HashFile}} | while read line; do<br />
file="`echo "$line" | sed -E "s/^[a-fA-F0-9]+ +\*?//"`"<br />
if [ -e "$file" ]; then<br />
if [ `md5 -r "$file" | cut -d\ -f1` = "`echo "$line" | cut -d\ -f1`" ]<br />
then echo "File \"$file\" appears okay."<br />
else echo "File \"$file\" is corrupt"'!' >&2<br />
fi; fi; done<br />
<br />
On systems with the <code>md5sum</code> command (most Linux distributions):<br />
<br />
$ cd <var>[[Running_the_game#Data_directory|/path/to/data/files]]</var><br />
$ md5sum -c {{CurrentVersion|MD5HashFile}} 2>&1 | grep -v "open or read\|file or directory"<br />
<br />
The <code>grep</code> invocation is used to strip output complaining about missing files.<br />
<br />
Any files that are found to be corrupt should be replaced; just download a [http://sourceforge.net/projects/unvanquished/files/Assets new copy] of the affected file(s).<br />
<br />
==Errors==<br />
<br />
===CMake cannot locate Newton===<br />
<br />
If CMake cannot find Newton, you'll need to set it up yourself.<br />
<br />
It should be in <code><var>/path/to/Unvanquished</var>/src/libs/libnewton/libs/<var>your_os</var>/libNewton.so</code>.<br />
Be sure to replace <var>your_os</var> with the proper directory name.<br />
<br />
Use CMake as before to change the <code>NEWTON_LIBRARY</code> build setting to the said path:<br />
<br />
# Start the CMake configurator:<pre>$ ccmake ..</pre><br />
# Scroll down and highlight <code>NEWTON_LIBRARY</code>.<br />
# Press {{Hotkey|Enter}} to begin editing and input in the path.<br />
# Press {{Hotkey|C}} to configure and {{Hotkey|G}} to generate the new makefiles.<br />
# Press {{Hotkey|Q}} to quit.<br />
# Recompile the source:<pre>$ make</pre><br />
<br />
===The C Compiler is not able to compile a simple test program===<br />
<br />
When attempting to generate a solution for Xcode CMake fails with the following error<br />
-- Check for working C compiler using: Xcode -- broken<br />
CMake Error at /Applications/CMake 2.8-8.app/Contents/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):<br />
The C compiler "/usr/bin/gcc" is not able to compile a simple test program.<br />
<br />
It fails with the following output:<br />
<br />
Change Dir: /Users/danielmaloney/Documents/Unvanquished/build-xcode/CMakeFiles/CMakeTmp<br />
<br />
<br />
<br />
Run Build Command:/Applications/CMake\ 2.8-8.app/Contents/bin/cmakexbuild<br />
-project CMAKE_TRY_COMPILE.xcodeproj build -target<br />
cmTryCompileExec1400153232 -configuration Debug<br />
<br />
Error: No developer directory found at /Developer. Run<br />
/usr/bin/xcode-select to update the developer directory path.<br />
<br />
<br />
<br />
<br />
<br />
CMake will not be able to correctly generate this project.<br />
Call Stack (most recent call first):<br />
CMakeLists.txt:19 (project)<br />
<br />
This is due to Xcode 4.3 having a different directory structure to previous versions. Simply running the following command will correct this error:<br />
sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer/</div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Compiling_the_source&diff=1961Compiling the source2013-04-14T18:15:57Z<p>Velociostrich: /* Instructions */ Add a note on creating a debug build.</p>
<hr />
<div>==Mac OS X==<br />
<br />
First, you need to [[Getting_the_source|acquire the source code]].<br />
<br />
Regardless of what interface you may use to compile the source, you will need [http://www.cmake.org/cmake/resources/software.html CMake] to generate makefiles. You will also need to install [https://developer.apple.com/xcode/ Xcode] (making sure to choose to install the command-line utilities when prompted by the installer).<br />
<br />
Then, you will need to acquire (and in some cases, manually compile) at a minimum the [[#Dependencies|necessary libraries]].<br />
<br />
Once you have the source code and the libraries installed, you may actually proceed to compile the source. You have several options:<br />
* '''Compile the source at the command line'''. This is the easiest if you would just like to compile the game to use yourself and you do not intend to work on the code.<br />
* '''Compile the source using an IDE'''. This is preferred if you intend on developing the source.<br />
** Xcode is Apple's flagship IDE and you should have installed to compile the source regardless of which method you use.<br />
** [http://qt-project.org/downloads QtCreator] is cross-platform and provides real-time feedback of syntax errors, a Vim mode, as well as other features.<br />
** [http://www.codeblocks.org/ Code::Blcoks] is also cross-platform but lacks some of the features of Xcode and QtCreator.<br />
<br />
===Dependencies===<br />
<br />
You only need to use one of the following methods (HomeBrew or compiling by hand). Please try and avoid mixing methods as this may produce unexpected results.<br />
<br />
Unvanquished requires the following libraries:<br />
* [[#JPEG|JPEG]], version 8 or higher. (Version 6 was known to have problems)<br />
* [[#Simple_DirectMedia_Layer_.28SDL.29|Simple DirectMedia Layer]] (The binary provided by libsdl.org causes graphical corruptions. Compile from source or use homebrew/macports)<br />
* [[#The_OpenGL_Extension_Wrangler_Library_.28GLEW.29|The OpenGL Extension Wrangler Library]]<br />
* CuRL<br />
* [[#The_GNU_MP_Bignum_Library_.28libgmp.29|GMP]]<br />
* [[#WebP|WebP]] (v0.2.0 or newer)<br />
<br />
The following libraries are optional:<br />
* Theora<br />
* Speex<br />
* [[#Ogg|Ogg]]<br />
* [[#Vorbis|Vorbis]]<br />
<br />
====HomeBrew====<br />
Install [http://mxcl.github.com/homebrew/ HomeBrew] and then run the following command<br />
<br />
$ brew install nettle libjpeg curl sdl webp xvid gmp glew speex libvorbis theora<br />
<br />
All the necessary libraries should now have been installed.<br />
<br />
====Compiling by hand====<br />
The following are shell scripts that download, compile, and install various libraries. This is more time consuming then other methods but might be useful if you need more control over your libraries<br />
<br />
=====JPEG=====<br />
<br />
$ curl http://www.ijg.org/files/jpegsrc.v8d.tar.gz > jpegsrc.v8d.tar.gz<br />
$ tar xvzf jpegsrc.v8d.tar.gz<br />
$ cd jpeg-8d<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The OpenGL Extension Wrangler Library (GLEW)=====<br />
<br />
$ curl -L https://sourceforge.net/projects/glew/files/glew/1.7.0/glew-1.7.0.tgz/download > glew-1.7.0.tgz<br />
$ tar xvzf glew-1.7.0.tgz<br />
$ cd glew-1.7.0<br />
$ make<br />
$ sudo make install<br />
<br />
=====Simple DirectMedia Layer (SDL)=====<br />
<br />
Do not use the binaries provided by libsdl.org, as these are known to cause issues with gamma and color display. Instead, compile your own:<br />
<br />
$ curl http://www.libsdl.org/release/SDL-1.2.15.tar.gz > SDL-1.2.15.tar.gz<br />
$ tar xvzf SDL-1.2.15.tar.gz<br />
$ cd SDL-1.2.15<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The GNU MP Bignum Library (libgmp)=====<br />
<br />
$ curl ftp://ftp.gmplib.org/pub/gmp-5.0.5/gmp-5.0.5.tar.bz2 > gmp-5.0.5.tar.bz2<br />
$ tar xvjf gmp-5.0.5.tar.bz2<br />
$ cd gmp-5.0.5<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Ogg=====<br />
<br />
$ curl http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz > libogg-1.3.0.tar.gz<br />
$ tar xvzf libogg-1.3.0.tar.gz<br />
$ cd libogg-1.3.0<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Vorbis=====<br />
<br />
$ curl http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz > libvorbis-1.3.3.tar.gz<br />
$ tar xvzf libvorbis-1.3.3.tar.gz<br />
$ cd libvorbis-1.3.3<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====WebP=====<br />
<br />
You do not need to compile WebP by hand; Google provides binaries for Mac OS X available from their [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0-mac-10.5.tar.gz project page]. You will need version 0.2.0 or newer.<br />
<br />
Once downloaded, you must still install the header files and the binary:<br />
<br />
$ curl https://webp.googlecode.com/files/libwebp-0.2.0-mac-10.5.tar.gz > libwebp-0.2.0-mac-10.5.tar.gz<br />
$ tar xvzf libwebp-0.2.0-mac-10.5.tar.gz<br />
$ cd libwebp-0.2.0-mac-10.5<br />
$ sudo cp include/webp /usr/local/include<br />
$ sudo cp lib/libwebp.a /usr/local/lib<br />
<br />
===Configuring with CMake===<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 should be a different directory.<br />
# Hit "Configure". You will be prompted as to which generator you would like to use. If you have Xcode installed, choose that. Wait while the configuration process runs. You may have to set the following:<br />
## If CMake did not find your jpeg headers for some reason, set <code>JPEG_INCLUDE_DIR</code> to <code>/path/to/Unvanquished/src/libs/jpeg</code>.<br />
## Check <code>USE_INTERNAL_CRYPTO</code> to avoid having to compile nettle and hogweed.<br />
## Check <code>USE_INTERNAL_SPEEX</code> to avoid having to compile Speex.<br />
## Uncheck <code>USE_CIN_THEORA</code> and <code>USE_CIN_XVID</code> to avoid having to compile Theora or Xvid. (At present, there are not cutscenes or any such that require it.)<br />
## '''You will probably not be able to compile with the GLSL optimizer enabled; uncheck <code>USE_GLSL_OPTIMIZER</code>'''<br />
## If you have selected to generate Xcode project files, make the <code>SDLMAIN_LIBRARY</code> field blank. This option is not available if you have the generator set to Unix makefiles.<br />
# Hit "Generate".<br />
# You may now close Xcode.<br />
<br />
===Compiling===<br />
<br />
====With Xcode====<br />
<br />
<ol><br />
<li>Compilation will fail unless you manually create certain directories needed by the build scripts:<br />
<pre><br />
$ cd /path/to/build/dir/CMakeFiles<br />
$ mkdir gpp{game,trem,ui}-qvm.dir<br />
</pre><br />
This is a workaround to {{Issue|101}}.<br />
</li><br />
<li>Either start Xcode and open the project file (in the build directory you specified) or double-click the project file in Finder.</li><br />
<li>Open the project file created by CMake, which should be in the build directory you specified.</li><br />
<li>Change the active target to "ALL_BUILD" and click Product&rarr;Build.</li><br />
</ol><br />
<br />
====With Unix Makefiles====<br />
<br />
<ul><br />
<li>Start Terminal (Applications &rarr; Utilities &rarr; Terminal).</li><br />
<li>Input the following commands:<br />
<pre><br />
$ cd /path/to/Unvanquished-build<br />
$ make<br />
</pre><br />
If you are on a multi-core or multi-processor machine, you may speed up the process by passing the <code>-j</code> argument followed by the number of available cores to <code>make</code>; e.g., <code>make -j4</code>. Note that doing so makes reading error messages more difficult, as multiple instances of the compiler will print to the screen at once, causing information to appear out of order.<br />
</li><br />
</ul><br />
<br />
===Testing the build===<br />
<br />
====With Xcode 4====<br />
<br />
To test the game, select the "client" scheme from the combo box on the toolbar, and click the run button or press {{Hotkey|MacCommand}}{{Hotkey|R}}.<br />
<br />
====With Unix Makefiles====<br />
<br />
After compiling, you'll have to place the data files in the <code>main</code> directory in your build directory. [[#Acquiring the Game Files|For download instructions, see below.]]<br />
<br />
Your file structure should look as follows:<br />
<br />
[[File:Build_dir_Mac_OS_X.png]]<br />
<br />
You may now start the application as such:<br />
<br />
$ ./daemon.i386<br />
<br />
Note that older machines will not support the new OpenGL 3 renderer, and must be started specifying the "vanilla" (aka "GL") renderer:<br />
<br />
$ ./daemon.i386 +set cl_renderer GL<br />
<br />
===Bundling the Application===<br />
<br />
====With CPack====<br />
<br />
CPack is able to create standalone bundles (as well as many other types of installers). However you must generate the files using Unix Makefiles instead of Xcode.<br />
<br />
$ cd /path/to/Unvanquished-build<br />
$ cpack -G Bundle<br />
<br />
Some warnings will be printed however these can be safely ignored. There should be a file called Unvanquished.dmg in the Unvanquished-build folder.<br />
<br />
====Manually====<br />
<br />
You'll find the Mac [http://macdylibbundler.sourceforge.net/ dynamic library bundler] to be quite useful (you must generate the files using Unix Makefiles instead of Xcode):<br />
<br />
$ curl -L http://sourceforge.net/projects/macdylibbundler/files/macdylibbundler/0.4.1/dylibbundler0.4.1.zip/download > \<br />
dylibbundler0.4.1.zip<br />
$ unzip dylibbundler0.4.1.zip<br />
$ cd dylibbundler<br />
$ make<br />
$ sudo make install<br />
<br />
Once you've done that, you can proceed to create the application bundle. Note that these steps assume that you have downloaded the data files to <code>main/</code> as shown above:<br />
<br />
<pre><br />
$ git=/path/to/Unvanquished-git-repo<br />
$ build=/path/to/Unvanquished-build-dir<br />
$ mkdir -pv Unvanquished.app/Contents/{libs,MacOS,Resources,Frameworks}<br />
$ cp -r $build/main Unvanquished.app/Contents/MacOS<br />
$ sips -s format tiff $git/debian/unvanquished.png --out temp.tiff<br />
$ tiff2icns temp.tiff Unvanquished.app/Contents/Resources/Unvanquished.icns<br />
$ rm temp.tiff<br />
$ cp $build/daemon{,ded}.i386 $build/*.dylib Unvanquished.app/Contents/MacOS<br />
$ cp -r /Library/Frameworks/SDL.framework Unvanquished.app/Contents/Frameworks<br />
$ install_name_tool -id \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/Frameworks/SDL.framework/Versions/A/SDL<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGLi386.dylib<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGL3i386.dylib<br />
$ for binary in Unvanquished.app/Contents/MacOS/*.{i386,dylib}; do<br />
dylibbundler -b -x $binary -d $dest/Unvanquished.app/Contents/libs/; done<br />
$ cp /usr/lib/libGLEW.1.7.0.dylib ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ chmod +w ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -id @executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -change /usr/lib/libGLEW.1.7.0.dylib \<br />
@executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ cat > Unvanquished.app/Contents/Info.plist<br />
<?xml version="1.0" encoding="UTF-8"?><br />
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"<br />
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"><br />
<plist version="1.0"><br />
<dict><br />
<key>CFBundleName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleDisplayName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleExecutable</key><br />
<string>daemon.i386</string><br />
<key>CFBundleIconFile</key><br />
<string>Unvanquished.icns</string><br />
<key>CFBundleIdentifier</key><br />
<string>net.Unvanquished</string><br />
<key>CFBundleInfoDictionaryVersion</key><br />
<string>6.0</string><br />
<key>CFBundlePackageType</key><br />
<string>APPL</string><br />
<key>CFBundleShortVersionString</key><br />
<string>0.4.0</string><br />
<key>CFBundleVersion</key><br />
<string>0.4.0</string><br />
</dict><br />
</plist><br />
^d<br />
</pre><br />
<br />
Note: <code>^d</code> indicates pressing {{Hotkey|Ctrl}}{{Hotkey|D}} on the keyboard.<br />
<br />
The contents of the completed application bundle should look like this:<br />
<br />
[[File:Bundle_dir_Mac_OS_X.png]]<br />
<br />
'''Note''': If you compiled SDL from source, you will not see a directory titled <code>SDL.framework</code>.<br />
<br />
==Windows==<br />
<br />
===Visual Studio===<br />
<br />
CMake can generate Visual Studio projects for unvanquished however this feature is relatively new and may have some bugs.<br />
<br />
Steps:<br />
<br />
# Double click on Visual_Studio32.bat<br />
# Open build-32/Daemon.sln in Visual Studio 2010.<br />
# In the two text boxes in the toolbar, select "Release" or "Debug" in the first one and Win32 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 />
====Important Notes====<br />
<br />
* LLVM is disabled and does not work correctly with CMake generated Visual Studio projects.<br />
* ncurses is not supported under Visual Studio.<br />
* The path to the build folder must not have any spaces otherwise generation of QVMs will fail. See [https://github.com/Unvanquished/Unvanquished/issues/102 issue 102]<br />
* Due to limitations with cmake neither the startup project nor the working directory can be specified. These must be manually set to the following values for debugging the client under Visual Studio<br />
** Right click on client and select "Set as StartUp project".<br />
** Right click on client, select properties, select Debugging and set "Working Directory" to $(TargetPath)\..<br />
<br />
===MinGW===<br />
<br />
It is possible to build Unvanquished with MinGW, although the process is rather arduous compared to Visual Studio or compiling for other platforms.<br />
<br />
====Notes====<br />
<br />
* The easiest way to acquire and install MinGW is with the graphical [http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/ mingw-get-inst installer]. <!-- TODO: maybe walk the user through the installer? --><br />
* When configuring the build with CMake, you will find that you will have to set a number of libraries manually. You can find precompiled DLLs for most of the dependencies; those that are not pre-compiled can be built with the corresponding <code>USE_INTERNAL_</code> setting.<br />
* On Windows, SDL requires that the Direct X SDK can be installed. You may download the June 2010 release from [http://www.microsoft.com/en-us/download/details.aspx?id=6812 Microsoft's site].<br />
* '''The build will fail during QVM compilation if your source or build directories contain spaces.''' This is due to a bug with lcc. If your home directory contains a space, you may want to create source and build directories at the root of one of your drives (e.g., <code>C:\Unvanquished\Source</code> and <code>C:\Unvanquished\Build</code>.)<br />
<br />
====Instructions====<br />
<br />
The easiest way to get a build up (at the time of writing) is as follows:<br />
<br />
{{Note|content=Although there are 64-bit binaries of most of the libraries required to build the game, these do not work with MinGW at present, so the following instructions all use the 32-bit binaries.}}<br />
<br />
<ol><br />
<li>Although there are binaries of gmp distributed with the source, they have are dependent on Visual Studio's implementations of <code>_ftol2_sse</code> and <code>_alloca_probe_16</code>. A fix may be found on [http://stackoverflow.com/questions/6753111/static-linking-with-openssl Stack Exchange], but requires that Visual Studio be installed, which defeats the purpose of attempting to use MinGW to compile the source. You can build gmp yourself:<br />
<ol><br />
<li>Download and extract the latest version of the [http://gmplib.org/ GNU MP Bignum Library (GMP)]. (You will need either cygwin with tar and bz2 installed or 7-zip to extract the archive.)</li><br />
<li>Install the following Cygwin packages if you have not already:<br />
* binutils<br />
* gcc<br />
* gcc-g++<br />
* m4<br />
* make<br />
</li><br />
<li>As part of the GMP compilation process, a file called <code>gen-fib.c</code> generates a table of numbers in the Fibonacci sequence. The generated file does not play nicely with Cygwin or MinGW, so you must fix it. Edit <code>gen-fib.c</code>, and at around line 100, change these lines<br />
<pre><br />
for (i = 0; i < fnum; i++)<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
printf ("), /* %d */\n", i-1);<br />
}<br />
printf ("};\n");<br />
</pre><br />
to look like this:<br />
<pre><br />
for (i = 0; i < fnum; i++)<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
printf (")%c /* %d */\n", (i == (fnum-1)) ? ' ' : ',', i-1);<br />
}<br />
printf ("};\n");<br />
</pre><br />
The patch file looks like this:<br />
<pre><br />
@@ -100,7 +100,7 @@<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
- printf ("), /* %d */\n", i-1);<br />
+ printf (")%c /* %d */\n", (i == (fnum-1)) ? ' ' : ',', i-1);<br />
}<br />
printf ("};\n");<br />
}<br />
</pre><br />
</li><br />
<li>Compiling with MinGW does not work, so you will need to compile with Cygwin. At the prompt:<br />
<pre><br />
$ ./configure --disable-static --enable-shared<br />
$ make<br />
</pre><br />
The <code>--disable-static</code> and <code>--enable-shared</code> flags configure GMP to build a DLL instead of a static library. You may optionally perform <code>make install</code>. Additional compilation instructions [http://www.cs.nyu.edu/exact/core/gmp/ are available].<br />
<p>If you experience difficulties with compilation and it appears that MinGW gcc is being detected by <code>configure</code> and not Cygwin gcc, you can try editing your <code>PATH</code> variable:</p><br />
<pre><br />
$ export PATH=`echo $PATH | sed "s|/cygdrive/c/MinGW/bin:||"`<br />
</pre><br />
Re-run <code>configure</code> and <code>make</code> afterwards.<br />
</ol><br />
</li><br />
<li>Download the [http://www.libsdl.org/release/SDL-1.2.15-win32.zip latest stable version] of SDL for Windows. Extract the archive and copy <code>SDL.dll</code> from it to the root of your build directory.</li><br />
<li>Set the following CMake flags:<br />
{| class="wikitable"<br />
! Setting<br />
! Description<br />
! Type<br />
! Value<br />
|-<br />
| <code>USE_INTERNAL_CRYPTO</code><br />
| Use the provided copies of crypto libraries. <!-- FIXME: I think these are nettle and something else --><br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_GLEW</code><br />
| Use the provided copy of GLEW.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_JPEG</code><br />
| Use the provided copy of JPEG.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SDL</code><br />
| Use the provided copy of SDL.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SPEEX</code><br />
| Use the provided copy of Speex.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_WEBP</code><br />
| Use the provided copy of WebP.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_CURSES</code><br />
| Enables/disables curses.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>PNG_LIBRARY</code><br />
| Path to the PNG library DLL.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng/libs/win32/libpng.lib</code><br />
|-<br />
| <code>PNG_PNG_INCLUDE_DIR</code><br />
| Path to the PNG library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng</code><br />
|-<br />
| <code>FREETYPE_LIBRARY</code><br />
| Path to the compiled FreeType library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/lib/freetype.lib</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_freetype2</code><br />
| Path to the FreeType library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/freetype2</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_ft2build</code><br />
| Path to the FreeType library file "ftbuild.h".<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/</code><br />
|-<br />
| <code>GMP_INCLUDE_DIR</code><br />
| Path to the GMP library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/gmp/include</code><br />
|-<br />
| <code>GMP_LIBRARY</code><br />
| Path to the GMP library.<br />
| <code>FILEPATH</code><br />
| <code><var>path/to/compiled/gmp/</var>.libs/cyggmp-10.dll</code><br />
|-<br />
| <code>ZLIB_INCLUDE_DIR</code><br />
| Path to the zlib library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/include</code><br />
|-<br />
| <code>ZLIB_LIBRARY</code><br />
| Path to the zlib library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/lib/x32/zlib1.dll</code><br />
|-<br />
| <code>CURL_LIBRARY</code><br />
| Path to the CURL library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/lib/win32/release/libcurl.dll</code><br />
|-<br />
| <code>CURL_INCLUDE_DIR</code><br />
| Path to the zlib library.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/include/curl</code><br />
|-<br />
| <code>USE_OPENAL</code><br />
| Enables/disables OpenAL support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_THEORA</code><br />
| Enables/disables Theora support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_XVID</code><br />
| Enables/disables Xvid support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CODEC_THEORA</code><br />
| Enables/disables Ogg support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>SDL_LIBRARY</code><br />
| The path to the SDL DLL.<br />
| <code>FILEPATH</code><br />
| <code><var>BuildPath</var>/SDL.dll</code><br />
|-<br />
| <code>SDLMAIN_LIBRARY</code><br />
| Enables/disables Ogg support.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code><br />
|-<br />
|}<br />
Do note that CMake is slash-direction&ndash;agnostic; it can handle both forward- and backslashes on Windows.<br />
<p>If you would like to compile a debug build, change <code>CMAKE_RELEASE_TYPE</code> from <code>Release</code> to <code>Debug</code>.</p><br />
</li><br />
<li>Open <code><var>SourcePath</var>/CMakeLists.txt</code> and edit the line<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi z )<br />
</pre><br />
(around line 1040) to look like this:<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi )<br />
</pre><br />
Also edit around line 1700:<br />
<pre><br />
###########################<br />
#Configure Download Script#<br />
###########################<br />
<br />
if( NOT MSVC )<br />
</pre><br />
to look like this:<br />
<pre><br />
###########################<br />
#Configure Download Script#<br />
###########################<br />
<br />
if( NOT WIN32 )<br />
<pre><br />
</li><br />
<li>Open <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code> and edit the lines:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "SDL.h"<br />
#include "SDL_main.h"<br />
</pre><br />
to look like:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "../../../include/SDL.h"<br />
#include "../../../include/SDL_main.h"<br />
</pre><br />
<li>Open a terminal and <code>cd</code> to your source directory.</li><br />
<li>Run <code>make</code>:<br />
<pre><br />
> mingw32-make<br />
</pre><br />
If you would like verbose output, set the <code>VERBOSE</code> environment variable before running <code>make</code>.<br />
<pre><br />
> set VERBOSE=1<br />
</pre><br />
To make it easier to build the source, you can create a batch file (call it something like <code>compile.bat</code>) and place it in your build directory:<br />
<pre><br />
@echo off<br />
<br />
set RETURN=compile<br />
<br />
:get_time<br />
:: Thank you, Rob van der Woude:<br />
:: (http://www.robvanderwoude.com/datetimentparse.php)<br />
FOR /F "tokens=1,2,3 delims=:." %%A IN ("%Time%") DO (<br />
SET /A HOURS = 100%%A %% 100<br />
SET /A MINUTES = 100%%B %% 100<br />
SET /A SECONDS = 100%%C %% 100<br />
)<br />
SET /A TICKS=( %HOURS% * 3600 ) + ( %MINUTES% * 60 ) + %SECONDS%<br />
GOTO %RETURN%<br />
<br />
:compile<br />
SET START_TICKS=%TICKS%<br />
<br />
SET VERBOSE=1<br />
:: mingw32-make clean<br />
mingw32-make -j4<br />
<br />
set RETURN=finish<br />
GOTO get_time<br />
<br />
:finish<br />
SET /A COMPILE_TIME=%TICKS% - %START_TICKS%<br />
SET /A MINUTES=%COMPILE_TIME% / 60<br />
SET /A SECONDS=%COMPILE_TIME% %% 60<br />
ECHO.<br />
ECHO Compilation took %MINUTES%m %SECONDS%s.<br />
PAUSE<br />
</pre><br />
</li><br />
<li>Once compilation finishes, you will find that the game will fail to run due to DLL dependencies. To resolve these:<br />
<ul><br />
<li>You will need to move <code>INTERNAL_GLEW</code> from the <code>Release/</code> folder of the build directory to the root of the build directory.</li><br />
<li>You will need to place the following other DLLs in your build directory:<br />
* freetype6.dll<br />
* libbz2.dll<br />
* libcurl.dll<br />
* libogg.dll<br />
* libpng14-14.dll<br />
* libtheora.dll<br />
* libvorbis.dll<br />
* libvorbisfile.dll<br />
* msvcr100.dll<br />
* msvcr100d.dll<br />
* zlib1.dll<br />
* zlibwapi.dll<br />
The easiest way to obtain these DLLs is by copying them from the installation directory of an [http://sourceforge.net/projects/unvanquished/files/latest/download official release] of Unvanquished.<br />
</li><br />
<li>You will need to copy your compiled DLL of GMP to your build directory. It may be found in <code><var>path/to/compiled/gmp/</var>.libs/cyggmp-10.dll</code>.</li><br />
<li>As you compiled GMP with Cygwin, it in turn depends on <code>cygwin1.dll</code>, which may typically be found in <code>C:\cygwin\bin\</code>. Copy and paste it into your build directory.</li><br />
</ul><br />
Once you have completed these steps, you should never have to do them again.<br />
</li><br />
</ol><br />
<br />
====Notes====<br />
<br />
* If you would like to use curses, try using [http://sourceforge.net/projects/pdcurses/files/pdcurses PDCurses].<br />
<br />
===QtCreator===<br />
<br />
# Install MinGW and follow the above instructions, except select Code::Blocks as the generator.<br />
# Start QtCreator, and select "Open File or Project&hellip;" from the File menu.<br />
# Navigate to your source directory and open CMakeLists.txt.<br />
# At the CMake Wizard, select the same build directory you already configured using CMake. (If you did not chose Code::Blocks as the generator, you will have to start over again, as QtCreator requires a Code::Blocks project file in order to compile the source.)<br />
# Ensure that a generator is selected in the combo box, and click "Run CMake". If there is no generator listed, see the [[#Troubleshooting|troubleshooting]] section below.<br />
# Click "Finish" to close the wizard.<br />
<br />
You should now be able to compile, run, and debug the code using QtCreator.<br />
<br />
====Troubleshooting====<br />
<br />
If at the "Run CMake" prompt of the the CMake Wizard, select "Run CMake" and are warned that no generator was selected, and notice that there are no generators in the combo box, you will likely have to [http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html manually configure your toolchain]. Select "Options&hellip;" from the "Tools" menu, then navigate to "Build &amp; Run".<br />
<br />
At the options window,<br />
* Go to the "Kits" tab, and mouse over the "Desktop (default)" kit under "Manual". If there were any errors in configuring this kit, they will be displayed in the tool tip. If there are problems, select the kit. You may need to manually specify the location of the MinGW debugger, for example, which is typically <code>C:\MinGW\bin\gdb.exe</code>.<br />
* Go to the "Compilers" tab, and ensure that MinGW is present. If not, you will need to add it manually.<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 />
libgmp3-dev libjpeg8-dev libncurses5-dev libogg-dev libopenal-dev \<br />
libpng12-dev libsdl1.2-dev libvorbis-dev zlib1g-dev nettle-dev \<br />
libwebp-dev libspeexdsp-dev libtheora-dev<br />
<br />
If the version of WebP supplied by your version of Debian or Ubuntu is older than v0.2.0, you will need to [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0.tar.gz download] and [https://developers.google.com/speed/webp/docs/compiling#unix compile it from source]. After compiling and installing with <code>sudo make install</code>, in CMake, you'll need to set <code>WEBP_INCLUDE_DIR</code> to <code>/usr/local/include/webp</code> and <code>WEBP_LIBRARY</code> to <code>/usr/local/lib/libwebp.so</code>.<br />
<br />
'''We currently provide a ready-to-use libwebp-dev in our [http://{{SERVERNAME}}/index.php/Download#ubuntu Debian and Ubuntu repositories], alongside .debs of the game and server.'''<br />
<br />
Actual dev package names may vary, e.g. libgmp-dev instead of libgmp3-dev and libglew-dev or libglew1.7-dev instead of libglew1.5-dev.<br />
<br />
Since we have a debian directory in the source, you can also to check what's needed then install the listed packages (choosing from alternatives as needed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ dpkg-checkbuilddeps<br />
…<br />
$ sudo apt-get install <var>package(s)</var><br />
<br />
If dpkg-checkbuilddeps produces no output, you have all necessary build dependencies. Also, debhelper's only needed if you're building .debs.<br />
<br />
====Gentoo====<br />
<br />
$ emerge curl freetype glew gmp jpeg ncurses libogg openal libpng libsdl libvorbis zlib<br />
<br />
====openSUSE====<br />
<br />
$ sudo install zypper gcc gcc-c++ Mesa-libGL-devel SDL-devel libjpeg8-devel \<br />
libpng12-devel glew-devel webp-devel ncurses-devel gmp-devel libcurl-devel \<br />
libnettle-devel openal-soft-devel speex-devel libvorbis-devel \<br />
libtheora-devel<br />
<br />
The latest version of WebP must be installed manually:<br />
<br />
$ wget https://webp.googlecode.com/files/libwebp-0.2.1.tar.gz<br />
$ tar xvzf libwebp-0.2.1.tar.gz<br />
$ cd libwebp-0.2.1<br />
$ ./configure && make<br />
$ sudo make install<br />
<br />
You must disable curses (set <code>USE_CURSES</code> appropriately in CMake) as failing to do so will cause Unvanquished to crash on startup.<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 />
On Debian or 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 />
Or, in Debian or Ubuntu, you can build a package (but you'll need to have devscripts and fakeroot installed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ fakeroot dpkg-buildpackage -b -uc<br />
$ sudo dpkg -i <var>../unvanquished_*.deb</var><br />
<br />
Once in <code>ccmake</code>, use the following keys:<br />
<br />
* Press {{Hotkey|c}} to configure. If an error occurs during this phase, make note of it and press {{Hotkey|e}} to dismiss it.<br />
* Use the up and down arrow keys to navigate the compilation options.<br />
* Press {{Hotkey|Enter}} to enable or disable boolean options (i.e., on/off) or to edit textual options.<br />
** Press {{Hotkey|Esc}} when editing a textual option to cancel the change.<br />
<br />
Once you have finished the configuration process, press {{Hotkey|C}} again, then {{Hotkey|G}} 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=====<br />
<br />
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_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 />
* <code>USE_CIN_THEORA</code> &mdash; Disabling this prevents videos from being recorded in Theora.<br />
* <code>USE_CIN_XVID</code> &mdash; Disabling this prevents videos from being recorded in Xvid.<br />
* <code>USE_VOIP</code> &mdash; Disabling this removes VOIP support. Alternatively enabling <code>USE_INTERNAL_SPEEX</code> will use the libraries distributed with Unvanquished for VoIP<br />
* <code>USE_INTERNAL_CRYPTO</code> &mdash; Enable this to use the crypto libraries provided by Unvanquished.<br />
<br />
===Compiling===<br />
<br />
$ cd <var>path/to/unvanquished/build</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 />
===Acquiring mandatory game files===<br />
<br />
The game files are not in the Git repository, and must be downloaded separately. This may be done on the command line or from your web browser. The downloads may be found on [http://sourceforge.net/projects/unvanquished/files/Assets SourceForge.net]. If you download the files from your browser, just download the files named "pak*.pk3", and save them to the [[Running_the_game#Data_locations|data location]] for your system.<br />
<br />
On Linux, this may be done as follows:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
wget -O $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On FreeBSD, using the <code>sh</code> shell:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
fetch -r -o $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On Mac OS X:<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
curl -L "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download" > $file<br />
fi<br />
done<br />
<br />
Linux users may also use the <code>download-pk3.sh</code> script that is distributed with the source code, which requires that curl be installed:<br />
<br />
$ cd <var>[path to Unvanquished source code]</var><br />
$ mkdir -p ~/.Unvanquished/main<br />
$ ./download-pk3.sh ~/.Unvanquished/main<br />
<br />
===Downloading the map pack===<br />
<br />
The map pack exists only for convenience; if you do not download the map pack, Unvanquished will automatically download maps as needed when you attempt to play online.<br />
<br />
To download the map pack on Linux:<br />
<br />
$ wget -O maps.7z "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z"; done<br />
<br />
To download the map pack on Mac OS X:<br />
<br />
$ curl -L "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z" > maps.7z; done<br />
<br />
Note that you will need to unzip the map pack on either system as it is compressed with LZMA. Mac users can use the [http://wakaba.c3.cx/s/apps/unarchiver.html Unarchiver]. Uncompressing the archive on Linux is highly dependent on your distribution.<br />
<br />
===Verifying the Files===<br />
<br />
Download the latest [http://sourceforge.net/projects/unvanquished/files/Assets/{{CurrentVersion|MD5HashFile}} MD5 hash file] and save it to your system's [[Running_the_game#Data_directory|data location]].<br />
<br />
On systems with the <code>md5</code> command (Mac OS X):<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ cat {{CurrentVersion|MD5HashFile}} | while read line; do<br />
file="`echo "$line" | sed -E "s/^[a-fA-F0-9]+ +\*?//"`"<br />
if [ -e "$file" ]; then<br />
if [ `md5 -r "$file" | cut -d\ -f1` = "`echo "$line" | cut -d\ -f1`" ]<br />
then echo "File \"$file\" appears okay."<br />
else echo "File \"$file\" is corrupt"'!' >&2<br />
fi; fi; done<br />
<br />
On systems with the <code>md5sum</code> command (most Linux distributions):<br />
<br />
$ cd <var>[[Running_the_game#Data_directory|/path/to/data/files]]</var><br />
$ md5sum -c {{CurrentVersion|MD5HashFile}} 2>&1 | grep -v "open or read\|file or directory"<br />
<br />
The <code>grep</code> invocation is used to strip output complaining about missing files.<br />
<br />
Any files that are found to be corrupt should be replaced; just download a [http://sourceforge.net/projects/unvanquished/files/Assets new copy] of the affected file(s).<br />
<br />
==Errors==<br />
<br />
===CMake cannot locate Newton===<br />
<br />
If CMake cannot find Newton, you'll need to set it up yourself.<br />
<br />
It should be in <code><var>/path/to/Unvanquished</var>/src/libs/libnewton/libs/<var>your_os</var>/libNewton.so</code>.<br />
Be sure to replace <var>your_os</var> with the proper directory name.<br />
<br />
Use CMake as before to change the <code>NEWTON_LIBRARY</code> build setting to the said path:<br />
<br />
# Start the CMake configurator:<pre>$ ccmake ..</pre><br />
# Scroll down and highlight <code>NEWTON_LIBRARY</code>.<br />
# Press {{Hotkey|Enter}} to begin editing and input in the path.<br />
# Press {{Hotkey|C}} to configure and {{Hotkey|G}} to generate the new makefiles.<br />
# Press {{Hotkey|Q}} to quit.<br />
# Recompile the source:<pre>$ make</pre><br />
<br />
===The C Compiler is not able to compile a simple test program===<br />
<br />
When attempting to generate a solution for Xcode CMake fails with the following error<br />
-- Check for working C compiler using: Xcode -- broken<br />
CMake Error at /Applications/CMake 2.8-8.app/Contents/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):<br />
The C compiler "/usr/bin/gcc" is not able to compile a simple test program.<br />
<br />
It fails with the following output:<br />
<br />
Change Dir: /Users/danielmaloney/Documents/Unvanquished/build-xcode/CMakeFiles/CMakeTmp<br />
<br />
<br />
<br />
Run Build Command:/Applications/CMake\ 2.8-8.app/Contents/bin/cmakexbuild<br />
-project CMAKE_TRY_COMPILE.xcodeproj build -target<br />
cmTryCompileExec1400153232 -configuration Debug<br />
<br />
Error: No developer directory found at /Developer. Run<br />
/usr/bin/xcode-select to update the developer directory path.<br />
<br />
<br />
<br />
<br />
<br />
CMake will not be able to correctly generate this project.<br />
Call Stack (most recent call first):<br />
CMakeLists.txt:19 (project)<br />
<br />
This is due to Xcode 4.3 having a different directory structure to previous versions. Simply running the following command will correct this error:<br />
sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer/</div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Compiling_the_source&diff=1960Compiling the source2013-04-14T18:09:08Z<p>Velociostrich: /* MinGW */ reformat headers a bit</p>
<hr />
<div>==Mac OS X==<br />
<br />
First, you need to [[Getting_the_source|acquire the source code]].<br />
<br />
Regardless of what interface you may use to compile the source, you will need [http://www.cmake.org/cmake/resources/software.html CMake] to generate makefiles. You will also need to install [https://developer.apple.com/xcode/ Xcode] (making sure to choose to install the command-line utilities when prompted by the installer).<br />
<br />
Then, you will need to acquire (and in some cases, manually compile) at a minimum the [[#Dependencies|necessary libraries]].<br />
<br />
Once you have the source code and the libraries installed, you may actually proceed to compile the source. You have several options:<br />
* '''Compile the source at the command line'''. This is the easiest if you would just like to compile the game to use yourself and you do not intend to work on the code.<br />
* '''Compile the source using an IDE'''. This is preferred if you intend on developing the source.<br />
** Xcode is Apple's flagship IDE and you should have installed to compile the source regardless of which method you use.<br />
** [http://qt-project.org/downloads QtCreator] is cross-platform and provides real-time feedback of syntax errors, a Vim mode, as well as other features.<br />
** [http://www.codeblocks.org/ Code::Blcoks] is also cross-platform but lacks some of the features of Xcode and QtCreator.<br />
<br />
===Dependencies===<br />
<br />
You only need to use one of the following methods (HomeBrew or compiling by hand). Please try and avoid mixing methods as this may produce unexpected results.<br />
<br />
Unvanquished requires the following libraries:<br />
* [[#JPEG|JPEG]], version 8 or higher. (Version 6 was known to have problems)<br />
* [[#Simple_DirectMedia_Layer_.28SDL.29|Simple DirectMedia Layer]] (The binary provided by libsdl.org causes graphical corruptions. Compile from source or use homebrew/macports)<br />
* [[#The_OpenGL_Extension_Wrangler_Library_.28GLEW.29|The OpenGL Extension Wrangler Library]]<br />
* CuRL<br />
* [[#The_GNU_MP_Bignum_Library_.28libgmp.29|GMP]]<br />
* [[#WebP|WebP]] (v0.2.0 or newer)<br />
<br />
The following libraries are optional:<br />
* Theora<br />
* Speex<br />
* [[#Ogg|Ogg]]<br />
* [[#Vorbis|Vorbis]]<br />
<br />
====HomeBrew====<br />
Install [http://mxcl.github.com/homebrew/ HomeBrew] and then run the following command<br />
<br />
$ brew install nettle libjpeg curl sdl webp xvid gmp glew speex libvorbis theora<br />
<br />
All the necessary libraries should now have been installed.<br />
<br />
====Compiling by hand====<br />
The following are shell scripts that download, compile, and install various libraries. This is more time consuming then other methods but might be useful if you need more control over your libraries<br />
<br />
=====JPEG=====<br />
<br />
$ curl http://www.ijg.org/files/jpegsrc.v8d.tar.gz > jpegsrc.v8d.tar.gz<br />
$ tar xvzf jpegsrc.v8d.tar.gz<br />
$ cd jpeg-8d<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The OpenGL Extension Wrangler Library (GLEW)=====<br />
<br />
$ curl -L https://sourceforge.net/projects/glew/files/glew/1.7.0/glew-1.7.0.tgz/download > glew-1.7.0.tgz<br />
$ tar xvzf glew-1.7.0.tgz<br />
$ cd glew-1.7.0<br />
$ make<br />
$ sudo make install<br />
<br />
=====Simple DirectMedia Layer (SDL)=====<br />
<br />
Do not use the binaries provided by libsdl.org, as these are known to cause issues with gamma and color display. Instead, compile your own:<br />
<br />
$ curl http://www.libsdl.org/release/SDL-1.2.15.tar.gz > SDL-1.2.15.tar.gz<br />
$ tar xvzf SDL-1.2.15.tar.gz<br />
$ cd SDL-1.2.15<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The GNU MP Bignum Library (libgmp)=====<br />
<br />
$ curl ftp://ftp.gmplib.org/pub/gmp-5.0.5/gmp-5.0.5.tar.bz2 > gmp-5.0.5.tar.bz2<br />
$ tar xvjf gmp-5.0.5.tar.bz2<br />
$ cd gmp-5.0.5<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Ogg=====<br />
<br />
$ curl http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz > libogg-1.3.0.tar.gz<br />
$ tar xvzf libogg-1.3.0.tar.gz<br />
$ cd libogg-1.3.0<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Vorbis=====<br />
<br />
$ curl http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz > libvorbis-1.3.3.tar.gz<br />
$ tar xvzf libvorbis-1.3.3.tar.gz<br />
$ cd libvorbis-1.3.3<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====WebP=====<br />
<br />
You do not need to compile WebP by hand; Google provides binaries for Mac OS X available from their [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0-mac-10.5.tar.gz project page]. You will need version 0.2.0 or newer.<br />
<br />
Once downloaded, you must still install the header files and the binary:<br />
<br />
$ curl https://webp.googlecode.com/files/libwebp-0.2.0-mac-10.5.tar.gz > libwebp-0.2.0-mac-10.5.tar.gz<br />
$ tar xvzf libwebp-0.2.0-mac-10.5.tar.gz<br />
$ cd libwebp-0.2.0-mac-10.5<br />
$ sudo cp include/webp /usr/local/include<br />
$ sudo cp lib/libwebp.a /usr/local/lib<br />
<br />
===Configuring with CMake===<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 should be a different directory.<br />
# Hit "Configure". You will be prompted as to which generator you would like to use. If you have Xcode installed, choose that. Wait while the configuration process runs. You may have to set the following:<br />
## If CMake did not find your jpeg headers for some reason, set <code>JPEG_INCLUDE_DIR</code> to <code>/path/to/Unvanquished/src/libs/jpeg</code>.<br />
## Check <code>USE_INTERNAL_CRYPTO</code> to avoid having to compile nettle and hogweed.<br />
## Check <code>USE_INTERNAL_SPEEX</code> to avoid having to compile Speex.<br />
## Uncheck <code>USE_CIN_THEORA</code> and <code>USE_CIN_XVID</code> to avoid having to compile Theora or Xvid. (At present, there are not cutscenes or any such that require it.)<br />
## '''You will probably not be able to compile with the GLSL optimizer enabled; uncheck <code>USE_GLSL_OPTIMIZER</code>'''<br />
## If you have selected to generate Xcode project files, make the <code>SDLMAIN_LIBRARY</code> field blank. This option is not available if you have the generator set to Unix makefiles.<br />
# Hit "Generate".<br />
# You may now close Xcode.<br />
<br />
===Compiling===<br />
<br />
====With Xcode====<br />
<br />
<ol><br />
<li>Compilation will fail unless you manually create certain directories needed by the build scripts:<br />
<pre><br />
$ cd /path/to/build/dir/CMakeFiles<br />
$ mkdir gpp{game,trem,ui}-qvm.dir<br />
</pre><br />
This is a workaround to {{Issue|101}}.<br />
</li><br />
<li>Either start Xcode and open the project file (in the build directory you specified) or double-click the project file in Finder.</li><br />
<li>Open the project file created by CMake, which should be in the build directory you specified.</li><br />
<li>Change the active target to "ALL_BUILD" and click Product&rarr;Build.</li><br />
</ol><br />
<br />
====With Unix Makefiles====<br />
<br />
<ul><br />
<li>Start Terminal (Applications &rarr; Utilities &rarr; Terminal).</li><br />
<li>Input the following commands:<br />
<pre><br />
$ cd /path/to/Unvanquished-build<br />
$ make<br />
</pre><br />
If you are on a multi-core or multi-processor machine, you may speed up the process by passing the <code>-j</code> argument followed by the number of available cores to <code>make</code>; e.g., <code>make -j4</code>. Note that doing so makes reading error messages more difficult, as multiple instances of the compiler will print to the screen at once, causing information to appear out of order.<br />
</li><br />
</ul><br />
<br />
===Testing the build===<br />
<br />
====With Xcode 4====<br />
<br />
To test the game, select the "client" scheme from the combo box on the toolbar, and click the run button or press {{Hotkey|MacCommand}}{{Hotkey|R}}.<br />
<br />
====With Unix Makefiles====<br />
<br />
After compiling, you'll have to place the data files in the <code>main</code> directory in your build directory. [[#Acquiring the Game Files|For download instructions, see below.]]<br />
<br />
Your file structure should look as follows:<br />
<br />
[[File:Build_dir_Mac_OS_X.png]]<br />
<br />
You may now start the application as such:<br />
<br />
$ ./daemon.i386<br />
<br />
Note that older machines will not support the new OpenGL 3 renderer, and must be started specifying the "vanilla" (aka "GL") renderer:<br />
<br />
$ ./daemon.i386 +set cl_renderer GL<br />
<br />
===Bundling the Application===<br />
<br />
====With CPack====<br />
<br />
CPack is able to create standalone bundles (as well as many other types of installers). However you must generate the files using Unix Makefiles instead of Xcode.<br />
<br />
$ cd /path/to/Unvanquished-build<br />
$ cpack -G Bundle<br />
<br />
Some warnings will be printed however these can be safely ignored. There should be a file called Unvanquished.dmg in the Unvanquished-build folder.<br />
<br />
====Manually====<br />
<br />
You'll find the Mac [http://macdylibbundler.sourceforge.net/ dynamic library bundler] to be quite useful (you must generate the files using Unix Makefiles instead of Xcode):<br />
<br />
$ curl -L http://sourceforge.net/projects/macdylibbundler/files/macdylibbundler/0.4.1/dylibbundler0.4.1.zip/download > \<br />
dylibbundler0.4.1.zip<br />
$ unzip dylibbundler0.4.1.zip<br />
$ cd dylibbundler<br />
$ make<br />
$ sudo make install<br />
<br />
Once you've done that, you can proceed to create the application bundle. Note that these steps assume that you have downloaded the data files to <code>main/</code> as shown above:<br />
<br />
<pre><br />
$ git=/path/to/Unvanquished-git-repo<br />
$ build=/path/to/Unvanquished-build-dir<br />
$ mkdir -pv Unvanquished.app/Contents/{libs,MacOS,Resources,Frameworks}<br />
$ cp -r $build/main Unvanquished.app/Contents/MacOS<br />
$ sips -s format tiff $git/debian/unvanquished.png --out temp.tiff<br />
$ tiff2icns temp.tiff Unvanquished.app/Contents/Resources/Unvanquished.icns<br />
$ rm temp.tiff<br />
$ cp $build/daemon{,ded}.i386 $build/*.dylib Unvanquished.app/Contents/MacOS<br />
$ cp -r /Library/Frameworks/SDL.framework Unvanquished.app/Contents/Frameworks<br />
$ install_name_tool -id \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/Frameworks/SDL.framework/Versions/A/SDL<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGLi386.dylib<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGL3i386.dylib<br />
$ for binary in Unvanquished.app/Contents/MacOS/*.{i386,dylib}; do<br />
dylibbundler -b -x $binary -d $dest/Unvanquished.app/Contents/libs/; done<br />
$ cp /usr/lib/libGLEW.1.7.0.dylib ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ chmod +w ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -id @executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -change /usr/lib/libGLEW.1.7.0.dylib \<br />
@executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ cat > Unvanquished.app/Contents/Info.plist<br />
<?xml version="1.0" encoding="UTF-8"?><br />
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"<br />
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"><br />
<plist version="1.0"><br />
<dict><br />
<key>CFBundleName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleDisplayName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleExecutable</key><br />
<string>daemon.i386</string><br />
<key>CFBundleIconFile</key><br />
<string>Unvanquished.icns</string><br />
<key>CFBundleIdentifier</key><br />
<string>net.Unvanquished</string><br />
<key>CFBundleInfoDictionaryVersion</key><br />
<string>6.0</string><br />
<key>CFBundlePackageType</key><br />
<string>APPL</string><br />
<key>CFBundleShortVersionString</key><br />
<string>0.4.0</string><br />
<key>CFBundleVersion</key><br />
<string>0.4.0</string><br />
</dict><br />
</plist><br />
^d<br />
</pre><br />
<br />
Note: <code>^d</code> indicates pressing {{Hotkey|Ctrl}}{{Hotkey|D}} on the keyboard.<br />
<br />
The contents of the completed application bundle should look like this:<br />
<br />
[[File:Bundle_dir_Mac_OS_X.png]]<br />
<br />
'''Note''': If you compiled SDL from source, you will not see a directory titled <code>SDL.framework</code>.<br />
<br />
==Windows==<br />
<br />
===Visual Studio===<br />
<br />
CMake can generate Visual Studio projects for unvanquished however this feature is relatively new and may have some bugs.<br />
<br />
Steps:<br />
<br />
# Double click on Visual_Studio32.bat<br />
# Open build-32/Daemon.sln in Visual Studio 2010.<br />
# In the two text boxes in the toolbar, select "Release" or "Debug" in the first one and Win32 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 />
====Important Notes====<br />
<br />
* LLVM is disabled and does not work correctly with CMake generated Visual Studio projects.<br />
* ncurses is not supported under Visual Studio.<br />
* The path to the build folder must not have any spaces otherwise generation of QVMs will fail. See [https://github.com/Unvanquished/Unvanquished/issues/102 issue 102]<br />
* Due to limitations with cmake neither the startup project nor the working directory can be specified. These must be manually set to the following values for debugging the client under Visual Studio<br />
** Right click on client and select "Set as StartUp project".<br />
** Right click on client, select properties, select Debugging and set "Working Directory" to $(TargetPath)\..<br />
<br />
===MinGW===<br />
<br />
It is possible to build Unvanquished with MinGW, although the process is rather arduous compared to Visual Studio or compiling for other platforms.<br />
<br />
====Notes====<br />
<br />
* The easiest way to acquire and install MinGW is with the graphical [http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/ mingw-get-inst installer]. <!-- TODO: maybe walk the user through the installer? --><br />
* When configuring the build with CMake, you will find that you will have to set a number of libraries manually. You can find precompiled DLLs for most of the dependencies; those that are not pre-compiled can be built with the corresponding <code>USE_INTERNAL_</code> setting.<br />
* On Windows, SDL requires that the Direct X SDK can be installed. You may download the June 2010 release from [http://www.microsoft.com/en-us/download/details.aspx?id=6812 Microsoft's site].<br />
* '''The build will fail during QVM compilation if your source or build directories contain spaces.''' This is due to a bug with lcc. If your home directory contains a space, you may want to create source and build directories at the root of one of your drives (e.g., <code>C:\Unvanquished\Source</code> and <code>C:\Unvanquished\Build</code>.)<br />
<br />
====Instructions====<br />
<br />
The easiest way to get a build up (at the time of writing) is as follows:<br />
<br />
{{Note|content=Although there are 64-bit binaries of most of the libraries required to build the game, these do not work with MinGW at present, so the following instructions all use the 32-bit binaries.}}<br />
<br />
<ol><br />
<li>Although there are binaries of gmp distributed with the source, they have are dependent on Visual Studio's implementations of <code>_ftol2_sse</code> and <code>_alloca_probe_16</code>. A fix may be found on [http://stackoverflow.com/questions/6753111/static-linking-with-openssl Stack Exchange], but requires that Visual Studio be installed, which defeats the purpose of attempting to use MinGW to compile the source. You can build gmp yourself:<br />
<ol><br />
<li>Download and extract the latest version of the [http://gmplib.org/ GNU MP Bignum Library (GMP)]. (You will need either cygwin with tar and bz2 installed or 7-zip to extract the archive.)</li><br />
<li>Install the following Cygwin packages if you have not already:<br />
* binutils<br />
* gcc<br />
* gcc-g++<br />
* m4<br />
* make<br />
</li><br />
<li>As part of the GMP compilation process, a file called <code>gen-fib.c</code> generates a table of numbers in the Fibonacci sequence. The generated file does not play nicely with Cygwin or MinGW, so you must fix it. Edit <code>gen-fib.c</code>, and at around line 100, change these lines<br />
<pre><br />
for (i = 0; i < fnum; i++)<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
printf ("), /* %d */\n", i-1);<br />
}<br />
printf ("};\n");<br />
</pre><br />
to look like this:<br />
<pre><br />
for (i = 0; i < fnum; i++)<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
printf (")%c /* %d */\n", (i == (fnum-1)) ? ' ' : ',', i-1);<br />
}<br />
printf ("};\n");<br />
</pre><br />
The patch file looks like this:<br />
<pre><br />
@@ -100,7 +100,7 @@<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
- printf ("), /* %d */\n", i-1);<br />
+ printf (")%c /* %d */\n", (i == (fnum-1)) ? ' ' : ',', i-1);<br />
}<br />
printf ("};\n");<br />
}<br />
</pre><br />
</li><br />
<li>Compiling with MinGW does not work, so you will need to compile with Cygwin. At the prompt:<br />
<pre><br />
$ ./configure --disable-static --enable-shared<br />
$ make<br />
</pre><br />
The <code>--disable-static</code> and <code>--enable-shared</code> flags configure GMP to build a DLL instead of a static library. You may optionally perform <code>make install</code>. Additional compilation instructions [http://www.cs.nyu.edu/exact/core/gmp/ are available].<br />
<p>If you experience difficulties with compilation and it appears that MinGW gcc is being detected by <code>configure</code> and not Cygwin gcc, you can try editing your <code>PATH</code> variable:</p><br />
<pre><br />
$ export PATH=`echo $PATH | sed "s|/cygdrive/c/MinGW/bin:||"`<br />
</pre><br />
Re-run <code>configure</code> and <code>make</code> afterwards.<br />
</ol><br />
</li><br />
<li>Download the [http://www.libsdl.org/release/SDL-1.2.15-win32.zip latest stable version] of SDL for Windows. Extract the archive and copy <code>SDL.dll</code> from it to the root of your build directory.</li><br />
<li>Set the following CMake flags:<br />
{| class="wikitable"<br />
! Setting<br />
! Description<br />
! Type<br />
! Value<br />
|-<br />
| <code>USE_INTERNAL_CRYPTO</code><br />
| Use the provided copies of crypto libraries. <!-- FIXME: I think these are nettle and something else --><br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_GLEW</code><br />
| Use the provided copy of GLEW.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_JPEG</code><br />
| Use the provided copy of JPEG.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SDL</code><br />
| Use the provided copy of SDL.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SPEEX</code><br />
| Use the provided copy of Speex.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_WEBP</code><br />
| Use the provided copy of WebP.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_CURSES</code><br />
| Enables/disables curses.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>PNG_LIBRARY</code><br />
| Path to the PNG library DLL.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng/libs/win32/libpng.lib</code><br />
|-<br />
| <code>PNG_PNG_INCLUDE_DIR</code><br />
| Path to the PNG library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng</code><br />
|-<br />
| <code>FREETYPE_LIBRARY</code><br />
| Path to the compiled FreeType library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/lib/freetype.lib</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_freetype2</code><br />
| Path to the FreeType library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/freetype2</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_ft2build</code><br />
| Path to the FreeType library file "ftbuild.h".<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/</code><br />
|-<br />
| <code>GMP_INCLUDE_DIR</code><br />
| Path to the GMP library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/gmp/include</code><br />
|-<br />
| <code>GMP_LIBRARY</code><br />
| Path to the GMP library.<br />
| <code>FILEPATH</code><br />
| <code><var>path/to/compiled/gmp/</var>.libs/cyggmp-10.dll</code><br />
|-<br />
| <code>ZLIB_INCLUDE_DIR</code><br />
| Path to the zlib library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/include</code><br />
|-<br />
| <code>ZLIB_LIBRARY</code><br />
| Path to the zlib library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/lib/x32/zlib1.dll</code><br />
|-<br />
| <code>CURL_LIBRARY</code><br />
| Path to the CURL library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/lib/win32/release/libcurl.dll</code><br />
|-<br />
| <code>CURL_INCLUDE_DIR</code><br />
| Path to the zlib library.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/include/curl</code><br />
|-<br />
| <code>USE_OPENAL</code><br />
| Enables/disables OpenAL support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_THEORA</code><br />
| Enables/disables Theora support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_XVID</code><br />
| Enables/disables Xvid support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CODEC_THEORA</code><br />
| Enables/disables Ogg support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>SDL_LIBRARY</code><br />
| The path to the SDL DLL.<br />
| <code>FILEPATH</code><br />
| <code><var>BuildPath</var>/SDL.dll</code><br />
|-<br />
| <code>SDLMAIN_LIBRARY</code><br />
| Enables/disables Ogg support.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code><br />
|-<br />
|}<br />
Do note that CMake is slash-direction&ndash;agnostic; it can handle both forward- and backslashes on Windows.<br />
</li><br />
<li>Open <code><var>SourcePath</var>/CMakeLists.txt</code> and edit the line<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi z )<br />
</pre><br />
(around line 1040) to look like this:<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi )<br />
</pre><br />
Also edit around line 1700:<br />
<pre><br />
###########################<br />
#Configure Download Script#<br />
###########################<br />
<br />
if( NOT MSVC )<br />
</pre><br />
to look like this:<br />
<pre><br />
###########################<br />
#Configure Download Script#<br />
###########################<br />
<br />
if( NOT WIN32 )<br />
<pre><br />
</li><br />
<li>Open <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code> and edit the lines:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "SDL.h"<br />
#include "SDL_main.h"<br />
</pre><br />
to look like:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "../../../include/SDL.h"<br />
#include "../../../include/SDL_main.h"<br />
</pre><br />
<li>Open a terminal and <code>cd</code> to your source directory.</li><br />
<li>Run <code>make</code>:<br />
<pre><br />
> mingw32-make<br />
</pre><br />
If you would like verbose output, set the <code>VERBOSE</code> environment variable before running <code>make</code>.<br />
<pre><br />
> set VERBOSE=1<br />
</pre><br />
To make it easier to build the source, you can create a batch file (call it something like <code>compile.bat</code>) and place it in your build directory:<br />
<pre><br />
@echo off<br />
<br />
set RETURN=compile<br />
<br />
:get_time<br />
:: Thank you, Rob van der Woude:<br />
:: (http://www.robvanderwoude.com/datetimentparse.php)<br />
FOR /F "tokens=1,2,3 delims=:." %%A IN ("%Time%") DO (<br />
SET /A HOURS = 100%%A %% 100<br />
SET /A MINUTES = 100%%B %% 100<br />
SET /A SECONDS = 100%%C %% 100<br />
)<br />
SET /A TICKS=( %HOURS% * 3600 ) + ( %MINUTES% * 60 ) + %SECONDS%<br />
GOTO %RETURN%<br />
<br />
:compile<br />
SET START_TICKS=%TICKS%<br />
<br />
SET VERBOSE=1<br />
:: mingw32-make clean<br />
mingw32-make -j4<br />
<br />
set RETURN=finish<br />
GOTO get_time<br />
<br />
:finish<br />
SET /A COMPILE_TIME=%TICKS% - %START_TICKS%<br />
SET /A MINUTES=%COMPILE_TIME% / 60<br />
SET /A SECONDS=%COMPILE_TIME% %% 60<br />
ECHO.<br />
ECHO Compilation took %MINUTES%m %SECONDS%s.<br />
PAUSE<br />
</pre><br />
</li><br />
<li>Once compilation finishes, you will find that the game will fail to run due to DLL dependencies. To resolve these:<br />
<ul><br />
<li>You will need to move <code>INTERNAL_GLEW</code> from the <code>Release/</code> folder of the build directory to the root of the build directory.</li><br />
<li>You will need to place the following other DLLs in your build directory:<br />
* freetype6.dll<br />
* libbz2.dll<br />
* libcurl.dll<br />
* libogg.dll<br />
* libpng14-14.dll<br />
* libtheora.dll<br />
* libvorbis.dll<br />
* libvorbisfile.dll<br />
* msvcr100.dll<br />
* msvcr100d.dll<br />
* zlib1.dll<br />
* zlibwapi.dll<br />
The easiest way to obtain these DLLs is by copying them from the installation directory of an [http://sourceforge.net/projects/unvanquished/files/latest/download official release] of Unvanquished.<br />
</li><br />
<li>You will need to copy your compiled DLL of GMP to your build directory. It may be found in <code><var>path/to/compiled/gmp/</var>.libs/cyggmp-10.dll</code>.</li><br />
<li>As you compiled GMP with Cygwin, it in turn depends on <code>cygwin1.dll</code>, which may typically be found in <code>C:\cygwin\bin\</code>. Copy and paste it into your build directory.</li><br />
</ul><br />
Once you have completed these steps, you should never have to do them again.<br />
</li><br />
</ol><br />
<br />
====Notes====<br />
<br />
* If you would like to use curses, try using [http://sourceforge.net/projects/pdcurses/files/pdcurses PDCurses].<br />
<br />
===QtCreator===<br />
<br />
# Install MinGW and follow the above instructions, except select Code::Blocks as the generator.<br />
# Start QtCreator, and select "Open File or Project&hellip;" from the File menu.<br />
# Navigate to your source directory and open CMakeLists.txt.<br />
# At the CMake Wizard, select the same build directory you already configured using CMake. (If you did not chose Code::Blocks as the generator, you will have to start over again, as QtCreator requires a Code::Blocks project file in order to compile the source.)<br />
# Ensure that a generator is selected in the combo box, and click "Run CMake". If there is no generator listed, see the [[#Troubleshooting|troubleshooting]] section below.<br />
# Click "Finish" to close the wizard.<br />
<br />
You should now be able to compile, run, and debug the code using QtCreator.<br />
<br />
====Troubleshooting====<br />
<br />
If at the "Run CMake" prompt of the the CMake Wizard, select "Run CMake" and are warned that no generator was selected, and notice that there are no generators in the combo box, you will likely have to [http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html manually configure your toolchain]. Select "Options&hellip;" from the "Tools" menu, then navigate to "Build &amp; Run".<br />
<br />
At the options window,<br />
* Go to the "Kits" tab, and mouse over the "Desktop (default)" kit under "Manual". If there were any errors in configuring this kit, they will be displayed in the tool tip. If there are problems, select the kit. You may need to manually specify the location of the MinGW debugger, for example, which is typically <code>C:\MinGW\bin\gdb.exe</code>.<br />
* Go to the "Compilers" tab, and ensure that MinGW is present. If not, you will need to add it manually.<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 />
libgmp3-dev libjpeg8-dev libncurses5-dev libogg-dev libopenal-dev \<br />
libpng12-dev libsdl1.2-dev libvorbis-dev zlib1g-dev nettle-dev \<br />
libwebp-dev libspeexdsp-dev libtheora-dev<br />
<br />
If the version of WebP supplied by your version of Debian or Ubuntu is older than v0.2.0, you will need to [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0.tar.gz download] and [https://developers.google.com/speed/webp/docs/compiling#unix compile it from source]. After compiling and installing with <code>sudo make install</code>, in CMake, you'll need to set <code>WEBP_INCLUDE_DIR</code> to <code>/usr/local/include/webp</code> and <code>WEBP_LIBRARY</code> to <code>/usr/local/lib/libwebp.so</code>.<br />
<br />
'''We currently provide a ready-to-use libwebp-dev in our [http://{{SERVERNAME}}/index.php/Download#ubuntu Debian and Ubuntu repositories], alongside .debs of the game and server.'''<br />
<br />
Actual dev package names may vary, e.g. libgmp-dev instead of libgmp3-dev and libglew-dev or libglew1.7-dev instead of libglew1.5-dev.<br />
<br />
Since we have a debian directory in the source, you can also to check what's needed then install the listed packages (choosing from alternatives as needed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ dpkg-checkbuilddeps<br />
…<br />
$ sudo apt-get install <var>package(s)</var><br />
<br />
If dpkg-checkbuilddeps produces no output, you have all necessary build dependencies. Also, debhelper's only needed if you're building .debs.<br />
<br />
====Gentoo====<br />
<br />
$ emerge curl freetype glew gmp jpeg ncurses libogg openal libpng libsdl libvorbis zlib<br />
<br />
====openSUSE====<br />
<br />
$ sudo install zypper gcc gcc-c++ Mesa-libGL-devel SDL-devel libjpeg8-devel \<br />
libpng12-devel glew-devel webp-devel ncurses-devel gmp-devel libcurl-devel \<br />
libnettle-devel openal-soft-devel speex-devel libvorbis-devel \<br />
libtheora-devel<br />
<br />
The latest version of WebP must be installed manually:<br />
<br />
$ wget https://webp.googlecode.com/files/libwebp-0.2.1.tar.gz<br />
$ tar xvzf libwebp-0.2.1.tar.gz<br />
$ cd libwebp-0.2.1<br />
$ ./configure && make<br />
$ sudo make install<br />
<br />
You must disable curses (set <code>USE_CURSES</code> appropriately in CMake) as failing to do so will cause Unvanquished to crash on startup.<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 />
On Debian or 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 />
Or, in Debian or Ubuntu, you can build a package (but you'll need to have devscripts and fakeroot installed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ fakeroot dpkg-buildpackage -b -uc<br />
$ sudo dpkg -i <var>../unvanquished_*.deb</var><br />
<br />
Once in <code>ccmake</code>, use the following keys:<br />
<br />
* Press {{Hotkey|c}} to configure. If an error occurs during this phase, make note of it and press {{Hotkey|e}} to dismiss it.<br />
* Use the up and down arrow keys to navigate the compilation options.<br />
* Press {{Hotkey|Enter}} to enable or disable boolean options (i.e., on/off) or to edit textual options.<br />
** Press {{Hotkey|Esc}} when editing a textual option to cancel the change.<br />
<br />
Once you have finished the configuration process, press {{Hotkey|C}} again, then {{Hotkey|G}} 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=====<br />
<br />
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_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 />
* <code>USE_CIN_THEORA</code> &mdash; Disabling this prevents videos from being recorded in Theora.<br />
* <code>USE_CIN_XVID</code> &mdash; Disabling this prevents videos from being recorded in Xvid.<br />
* <code>USE_VOIP</code> &mdash; Disabling this removes VOIP support. Alternatively enabling <code>USE_INTERNAL_SPEEX</code> will use the libraries distributed with Unvanquished for VoIP<br />
* <code>USE_INTERNAL_CRYPTO</code> &mdash; Enable this to use the crypto libraries provided by Unvanquished.<br />
<br />
===Compiling===<br />
<br />
$ cd <var>path/to/unvanquished/build</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 />
===Acquiring mandatory game files===<br />
<br />
The game files are not in the Git repository, and must be downloaded separately. This may be done on the command line or from your web browser. The downloads may be found on [http://sourceforge.net/projects/unvanquished/files/Assets SourceForge.net]. If you download the files from your browser, just download the files named "pak*.pk3", and save them to the [[Running_the_game#Data_locations|data location]] for your system.<br />
<br />
On Linux, this may be done as follows:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
wget -O $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On FreeBSD, using the <code>sh</code> shell:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
fetch -r -o $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On Mac OS X:<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
curl -L "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download" > $file<br />
fi<br />
done<br />
<br />
Linux users may also use the <code>download-pk3.sh</code> script that is distributed with the source code, which requires that curl be installed:<br />
<br />
$ cd <var>[path to Unvanquished source code]</var><br />
$ mkdir -p ~/.Unvanquished/main<br />
$ ./download-pk3.sh ~/.Unvanquished/main<br />
<br />
===Downloading the map pack===<br />
<br />
The map pack exists only for convenience; if you do not download the map pack, Unvanquished will automatically download maps as needed when you attempt to play online.<br />
<br />
To download the map pack on Linux:<br />
<br />
$ wget -O maps.7z "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z"; done<br />
<br />
To download the map pack on Mac OS X:<br />
<br />
$ curl -L "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z" > maps.7z; done<br />
<br />
Note that you will need to unzip the map pack on either system as it is compressed with LZMA. Mac users can use the [http://wakaba.c3.cx/s/apps/unarchiver.html Unarchiver]. Uncompressing the archive on Linux is highly dependent on your distribution.<br />
<br />
===Verifying the Files===<br />
<br />
Download the latest [http://sourceforge.net/projects/unvanquished/files/Assets/{{CurrentVersion|MD5HashFile}} MD5 hash file] and save it to your system's [[Running_the_game#Data_directory|data location]].<br />
<br />
On systems with the <code>md5</code> command (Mac OS X):<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ cat {{CurrentVersion|MD5HashFile}} | while read line; do<br />
file="`echo "$line" | sed -E "s/^[a-fA-F0-9]+ +\*?//"`"<br />
if [ -e "$file" ]; then<br />
if [ `md5 -r "$file" | cut -d\ -f1` = "`echo "$line" | cut -d\ -f1`" ]<br />
then echo "File \"$file\" appears okay."<br />
else echo "File \"$file\" is corrupt"'!' >&2<br />
fi; fi; done<br />
<br />
On systems with the <code>md5sum</code> command (most Linux distributions):<br />
<br />
$ cd <var>[[Running_the_game#Data_directory|/path/to/data/files]]</var><br />
$ md5sum -c {{CurrentVersion|MD5HashFile}} 2>&1 | grep -v "open or read\|file or directory"<br />
<br />
The <code>grep</code> invocation is used to strip output complaining about missing files.<br />
<br />
Any files that are found to be corrupt should be replaced; just download a [http://sourceforge.net/projects/unvanquished/files/Assets new copy] of the affected file(s).<br />
<br />
==Errors==<br />
<br />
===CMake cannot locate Newton===<br />
<br />
If CMake cannot find Newton, you'll need to set it up yourself.<br />
<br />
It should be in <code><var>/path/to/Unvanquished</var>/src/libs/libnewton/libs/<var>your_os</var>/libNewton.so</code>.<br />
Be sure to replace <var>your_os</var> with the proper directory name.<br />
<br />
Use CMake as before to change the <code>NEWTON_LIBRARY</code> build setting to the said path:<br />
<br />
# Start the CMake configurator:<pre>$ ccmake ..</pre><br />
# Scroll down and highlight <code>NEWTON_LIBRARY</code>.<br />
# Press {{Hotkey|Enter}} to begin editing and input in the path.<br />
# Press {{Hotkey|C}} to configure and {{Hotkey|G}} to generate the new makefiles.<br />
# Press {{Hotkey|Q}} to quit.<br />
# Recompile the source:<pre>$ make</pre><br />
<br />
===The C Compiler is not able to compile a simple test program===<br />
<br />
When attempting to generate a solution for Xcode CMake fails with the following error<br />
-- Check for working C compiler using: Xcode -- broken<br />
CMake Error at /Applications/CMake 2.8-8.app/Contents/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):<br />
The C compiler "/usr/bin/gcc" is not able to compile a simple test program.<br />
<br />
It fails with the following output:<br />
<br />
Change Dir: /Users/danielmaloney/Documents/Unvanquished/build-xcode/CMakeFiles/CMakeTmp<br />
<br />
<br />
<br />
Run Build Command:/Applications/CMake\ 2.8-8.app/Contents/bin/cmakexbuild<br />
-project CMAKE_TRY_COMPILE.xcodeproj build -target<br />
cmTryCompileExec1400153232 -configuration Debug<br />
<br />
Error: No developer directory found at /Developer. Run<br />
/usr/bin/xcode-select to update the developer directory path.<br />
<br />
<br />
<br />
<br />
<br />
CMake will not be able to correctly generate this project.<br />
Call Stack (most recent call first):<br />
CMakeLists.txt:19 (project)<br />
<br />
This is due to Xcode 4.3 having a different directory structure to previous versions. Simply running the following command will correct this error:<br />
sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer/</div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Compiling_the_source&diff=1959Compiling the source2013-04-14T18:07:56Z<p>Velociostrich: /* MinGW */ Add instructions on satisfying final DLL deps</p>
<hr />
<div>==Mac OS X==<br />
<br />
First, you need to [[Getting_the_source|acquire the source code]].<br />
<br />
Regardless of what interface you may use to compile the source, you will need [http://www.cmake.org/cmake/resources/software.html CMake] to generate makefiles. You will also need to install [https://developer.apple.com/xcode/ Xcode] (making sure to choose to install the command-line utilities when prompted by the installer).<br />
<br />
Then, you will need to acquire (and in some cases, manually compile) at a minimum the [[#Dependencies|necessary libraries]].<br />
<br />
Once you have the source code and the libraries installed, you may actually proceed to compile the source. You have several options:<br />
* '''Compile the source at the command line'''. This is the easiest if you would just like to compile the game to use yourself and you do not intend to work on the code.<br />
* '''Compile the source using an IDE'''. This is preferred if you intend on developing the source.<br />
** Xcode is Apple's flagship IDE and you should have installed to compile the source regardless of which method you use.<br />
** [http://qt-project.org/downloads QtCreator] is cross-platform and provides real-time feedback of syntax errors, a Vim mode, as well as other features.<br />
** [http://www.codeblocks.org/ Code::Blcoks] is also cross-platform but lacks some of the features of Xcode and QtCreator.<br />
<br />
===Dependencies===<br />
<br />
You only need to use one of the following methods (HomeBrew or compiling by hand). Please try and avoid mixing methods as this may produce unexpected results.<br />
<br />
Unvanquished requires the following libraries:<br />
* [[#JPEG|JPEG]], version 8 or higher. (Version 6 was known to have problems)<br />
* [[#Simple_DirectMedia_Layer_.28SDL.29|Simple DirectMedia Layer]] (The binary provided by libsdl.org causes graphical corruptions. Compile from source or use homebrew/macports)<br />
* [[#The_OpenGL_Extension_Wrangler_Library_.28GLEW.29|The OpenGL Extension Wrangler Library]]<br />
* CuRL<br />
* [[#The_GNU_MP_Bignum_Library_.28libgmp.29|GMP]]<br />
* [[#WebP|WebP]] (v0.2.0 or newer)<br />
<br />
The following libraries are optional:<br />
* Theora<br />
* Speex<br />
* [[#Ogg|Ogg]]<br />
* [[#Vorbis|Vorbis]]<br />
<br />
====HomeBrew====<br />
Install [http://mxcl.github.com/homebrew/ HomeBrew] and then run the following command<br />
<br />
$ brew install nettle libjpeg curl sdl webp xvid gmp glew speex libvorbis theora<br />
<br />
All the necessary libraries should now have been installed.<br />
<br />
====Compiling by hand====<br />
The following are shell scripts that download, compile, and install various libraries. This is more time consuming then other methods but might be useful if you need more control over your libraries<br />
<br />
=====JPEG=====<br />
<br />
$ curl http://www.ijg.org/files/jpegsrc.v8d.tar.gz > jpegsrc.v8d.tar.gz<br />
$ tar xvzf jpegsrc.v8d.tar.gz<br />
$ cd jpeg-8d<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The OpenGL Extension Wrangler Library (GLEW)=====<br />
<br />
$ curl -L https://sourceforge.net/projects/glew/files/glew/1.7.0/glew-1.7.0.tgz/download > glew-1.7.0.tgz<br />
$ tar xvzf glew-1.7.0.tgz<br />
$ cd glew-1.7.0<br />
$ make<br />
$ sudo make install<br />
<br />
=====Simple DirectMedia Layer (SDL)=====<br />
<br />
Do not use the binaries provided by libsdl.org, as these are known to cause issues with gamma and color display. Instead, compile your own:<br />
<br />
$ curl http://www.libsdl.org/release/SDL-1.2.15.tar.gz > SDL-1.2.15.tar.gz<br />
$ tar xvzf SDL-1.2.15.tar.gz<br />
$ cd SDL-1.2.15<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The GNU MP Bignum Library (libgmp)=====<br />
<br />
$ curl ftp://ftp.gmplib.org/pub/gmp-5.0.5/gmp-5.0.5.tar.bz2 > gmp-5.0.5.tar.bz2<br />
$ tar xvjf gmp-5.0.5.tar.bz2<br />
$ cd gmp-5.0.5<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Ogg=====<br />
<br />
$ curl http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz > libogg-1.3.0.tar.gz<br />
$ tar xvzf libogg-1.3.0.tar.gz<br />
$ cd libogg-1.3.0<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Vorbis=====<br />
<br />
$ curl http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz > libvorbis-1.3.3.tar.gz<br />
$ tar xvzf libvorbis-1.3.3.tar.gz<br />
$ cd libvorbis-1.3.3<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====WebP=====<br />
<br />
You do not need to compile WebP by hand; Google provides binaries for Mac OS X available from their [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0-mac-10.5.tar.gz project page]. You will need version 0.2.0 or newer.<br />
<br />
Once downloaded, you must still install the header files and the binary:<br />
<br />
$ curl https://webp.googlecode.com/files/libwebp-0.2.0-mac-10.5.tar.gz > libwebp-0.2.0-mac-10.5.tar.gz<br />
$ tar xvzf libwebp-0.2.0-mac-10.5.tar.gz<br />
$ cd libwebp-0.2.0-mac-10.5<br />
$ sudo cp include/webp /usr/local/include<br />
$ sudo cp lib/libwebp.a /usr/local/lib<br />
<br />
===Configuring with CMake===<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 should be a different directory.<br />
# Hit "Configure". You will be prompted as to which generator you would like to use. If you have Xcode installed, choose that. Wait while the configuration process runs. You may have to set the following:<br />
## If CMake did not find your jpeg headers for some reason, set <code>JPEG_INCLUDE_DIR</code> to <code>/path/to/Unvanquished/src/libs/jpeg</code>.<br />
## Check <code>USE_INTERNAL_CRYPTO</code> to avoid having to compile nettle and hogweed.<br />
## Check <code>USE_INTERNAL_SPEEX</code> to avoid having to compile Speex.<br />
## Uncheck <code>USE_CIN_THEORA</code> and <code>USE_CIN_XVID</code> to avoid having to compile Theora or Xvid. (At present, there are not cutscenes or any such that require it.)<br />
## '''You will probably not be able to compile with the GLSL optimizer enabled; uncheck <code>USE_GLSL_OPTIMIZER</code>'''<br />
## If you have selected to generate Xcode project files, make the <code>SDLMAIN_LIBRARY</code> field blank. This option is not available if you have the generator set to Unix makefiles.<br />
# Hit "Generate".<br />
# You may now close Xcode.<br />
<br />
===Compiling===<br />
<br />
====With Xcode====<br />
<br />
<ol><br />
<li>Compilation will fail unless you manually create certain directories needed by the build scripts:<br />
<pre><br />
$ cd /path/to/build/dir/CMakeFiles<br />
$ mkdir gpp{game,trem,ui}-qvm.dir<br />
</pre><br />
This is a workaround to {{Issue|101}}.<br />
</li><br />
<li>Either start Xcode and open the project file (in the build directory you specified) or double-click the project file in Finder.</li><br />
<li>Open the project file created by CMake, which should be in the build directory you specified.</li><br />
<li>Change the active target to "ALL_BUILD" and click Product&rarr;Build.</li><br />
</ol><br />
<br />
====With Unix Makefiles====<br />
<br />
<ul><br />
<li>Start Terminal (Applications &rarr; Utilities &rarr; Terminal).</li><br />
<li>Input the following commands:<br />
<pre><br />
$ cd /path/to/Unvanquished-build<br />
$ make<br />
</pre><br />
If you are on a multi-core or multi-processor machine, you may speed up the process by passing the <code>-j</code> argument followed by the number of available cores to <code>make</code>; e.g., <code>make -j4</code>. Note that doing so makes reading error messages more difficult, as multiple instances of the compiler will print to the screen at once, causing information to appear out of order.<br />
</li><br />
</ul><br />
<br />
===Testing the build===<br />
<br />
====With Xcode 4====<br />
<br />
To test the game, select the "client" scheme from the combo box on the toolbar, and click the run button or press {{Hotkey|MacCommand}}{{Hotkey|R}}.<br />
<br />
====With Unix Makefiles====<br />
<br />
After compiling, you'll have to place the data files in the <code>main</code> directory in your build directory. [[#Acquiring the Game Files|For download instructions, see below.]]<br />
<br />
Your file structure should look as follows:<br />
<br />
[[File:Build_dir_Mac_OS_X.png]]<br />
<br />
You may now start the application as such:<br />
<br />
$ ./daemon.i386<br />
<br />
Note that older machines will not support the new OpenGL 3 renderer, and must be started specifying the "vanilla" (aka "GL") renderer:<br />
<br />
$ ./daemon.i386 +set cl_renderer GL<br />
<br />
===Bundling the Application===<br />
<br />
====With CPack====<br />
<br />
CPack is able to create standalone bundles (as well as many other types of installers). However you must generate the files using Unix Makefiles instead of Xcode.<br />
<br />
$ cd /path/to/Unvanquished-build<br />
$ cpack -G Bundle<br />
<br />
Some warnings will be printed however these can be safely ignored. There should be a file called Unvanquished.dmg in the Unvanquished-build folder.<br />
<br />
====Manually====<br />
<br />
You'll find the Mac [http://macdylibbundler.sourceforge.net/ dynamic library bundler] to be quite useful (you must generate the files using Unix Makefiles instead of Xcode):<br />
<br />
$ curl -L http://sourceforge.net/projects/macdylibbundler/files/macdylibbundler/0.4.1/dylibbundler0.4.1.zip/download > \<br />
dylibbundler0.4.1.zip<br />
$ unzip dylibbundler0.4.1.zip<br />
$ cd dylibbundler<br />
$ make<br />
$ sudo make install<br />
<br />
Once you've done that, you can proceed to create the application bundle. Note that these steps assume that you have downloaded the data files to <code>main/</code> as shown above:<br />
<br />
<pre><br />
$ git=/path/to/Unvanquished-git-repo<br />
$ build=/path/to/Unvanquished-build-dir<br />
$ mkdir -pv Unvanquished.app/Contents/{libs,MacOS,Resources,Frameworks}<br />
$ cp -r $build/main Unvanquished.app/Contents/MacOS<br />
$ sips -s format tiff $git/debian/unvanquished.png --out temp.tiff<br />
$ tiff2icns temp.tiff Unvanquished.app/Contents/Resources/Unvanquished.icns<br />
$ rm temp.tiff<br />
$ cp $build/daemon{,ded}.i386 $build/*.dylib Unvanquished.app/Contents/MacOS<br />
$ cp -r /Library/Frameworks/SDL.framework Unvanquished.app/Contents/Frameworks<br />
$ install_name_tool -id \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/Frameworks/SDL.framework/Versions/A/SDL<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGLi386.dylib<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGL3i386.dylib<br />
$ for binary in Unvanquished.app/Contents/MacOS/*.{i386,dylib}; do<br />
dylibbundler -b -x $binary -d $dest/Unvanquished.app/Contents/libs/; done<br />
$ cp /usr/lib/libGLEW.1.7.0.dylib ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ chmod +w ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -id @executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -change /usr/lib/libGLEW.1.7.0.dylib \<br />
@executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ cat > Unvanquished.app/Contents/Info.plist<br />
<?xml version="1.0" encoding="UTF-8"?><br />
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"<br />
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"><br />
<plist version="1.0"><br />
<dict><br />
<key>CFBundleName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleDisplayName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleExecutable</key><br />
<string>daemon.i386</string><br />
<key>CFBundleIconFile</key><br />
<string>Unvanquished.icns</string><br />
<key>CFBundleIdentifier</key><br />
<string>net.Unvanquished</string><br />
<key>CFBundleInfoDictionaryVersion</key><br />
<string>6.0</string><br />
<key>CFBundlePackageType</key><br />
<string>APPL</string><br />
<key>CFBundleShortVersionString</key><br />
<string>0.4.0</string><br />
<key>CFBundleVersion</key><br />
<string>0.4.0</string><br />
</dict><br />
</plist><br />
^d<br />
</pre><br />
<br />
Note: <code>^d</code> indicates pressing {{Hotkey|Ctrl}}{{Hotkey|D}} on the keyboard.<br />
<br />
The contents of the completed application bundle should look like this:<br />
<br />
[[File:Bundle_dir_Mac_OS_X.png]]<br />
<br />
'''Note''': If you compiled SDL from source, you will not see a directory titled <code>SDL.framework</code>.<br />
<br />
==Windows==<br />
<br />
===Visual Studio===<br />
<br />
CMake can generate Visual Studio projects for unvanquished however this feature is relatively new and may have some bugs.<br />
<br />
Steps:<br />
<br />
# Double click on Visual_Studio32.bat<br />
# Open build-32/Daemon.sln in Visual Studio 2010.<br />
# In the two text boxes in the toolbar, select "Release" or "Debug" in the first one and Win32 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 />
====Important Notes====<br />
<br />
* LLVM is disabled and does not work correctly with CMake generated Visual Studio projects.<br />
* ncurses is not supported under Visual Studio.<br />
* The path to the build folder must not have any spaces otherwise generation of QVMs will fail. See [https://github.com/Unvanquished/Unvanquished/issues/102 issue 102]<br />
* Due to limitations with cmake neither the startup project nor the working directory can be specified. These must be manually set to the following values for debugging the client under Visual Studio<br />
** Right click on client and select "Set as StartUp project".<br />
** Right click on client, select properties, select Debugging and set "Working Directory" to $(TargetPath)\..<br />
<br />
===MinGW===<br />
<br />
It is possible to build Unvanquished with MinGW, although the process is rather arduous compared to Visual Studio or compiling for other platforms.<br />
<br />
Note:<br />
<br />
* The easiest way to acquire and install MinGW is with the graphical [http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/ mingw-get-inst installer]. <!-- TODO: maybe walk the user through the installer? --><br />
* When configuring the build with CMake, you will find that you will have to set a number of libraries manually. You can find precompiled DLLs for most of the dependencies; those that are not pre-compiled can be built with the corresponding <code>USE_INTERNAL_</code> setting.<br />
* On Windows, SDL requires that the Direct X SDK can be installed. You may download the June 2010 release from [http://www.microsoft.com/en-us/download/details.aspx?id=6812 Microsoft's site].<br />
* '''The build will fail during QVM compilation if your source or build directories contain spaces.''' This is due to a bug with lcc. If your home directory contains a space, you may want to create source and build directories at the root of one of your drives (e.g., <code>C:\Unvanquished\Source</code> and <code>C:\Unvanquished\Build</code>.)<br />
<br />
The easiest way to get a build up (at the time of writing) is as follows:<br />
<br />
{{Note|content=Although there are 64-bit binaries of most of the libraries required to build the game, these do not work with MinGW at present, so the following instructions all use the 32-bit binaries.}}<br />
<br />
<ol><br />
<li>Although there are binaries of gmp distributed with the source, they have are dependent on Visual Studio's implementations of <code>_ftol2_sse</code> and <code>_alloca_probe_16</code>. A fix may be found on [http://stackoverflow.com/questions/6753111/static-linking-with-openssl Stack Exchange], but requires that Visual Studio be installed, which defeats the purpose of attempting to use MinGW to compile the source. You can build gmp yourself:<br />
<ol><br />
<li>Download and extract the latest version of the [http://gmplib.org/ GNU MP Bignum Library (GMP)]. (You will need either cygwin with tar and bz2 installed or 7-zip to extract the archive.)</li><br />
<li>Install the following Cygwin packages if you have not already:<br />
* binutils<br />
* gcc<br />
* gcc-g++<br />
* m4<br />
* make<br />
</li><br />
<li>As part of the GMP compilation process, a file called <code>gen-fib.c</code> generates a table of numbers in the Fibonacci sequence. The generated file does not play nicely with Cygwin or MinGW, so you must fix it. Edit <code>gen-fib.c</code>, and at around line 100, change these lines<br />
<pre><br />
for (i = 0; i < fnum; i++)<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
printf ("), /* %d */\n", i-1);<br />
}<br />
printf ("};\n");<br />
</pre><br />
to look like this:<br />
<pre><br />
for (i = 0; i < fnum; i++)<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
printf (")%c /* %d */\n", (i == (fnum-1)) ? ' ' : ',', i-1);<br />
}<br />
printf ("};\n");<br />
</pre><br />
The patch file looks like this:<br />
<pre><br />
@@ -100,7 +100,7 @@<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
- printf ("), /* %d */\n", i-1);<br />
+ printf (")%c /* %d */\n", (i == (fnum-1)) ? ' ' : ',', i-1);<br />
}<br />
printf ("};\n");<br />
}<br />
</pre><br />
</li><br />
<li>Compiling with MinGW does not work, so you will need to compile with Cygwin. At the prompt:<br />
<pre><br />
$ ./configure --disable-static --enable-shared<br />
$ make<br />
</pre><br />
The <code>--disable-static</code> and <code>--enable-shared</code> flags configure GMP to build a DLL instead of a static library. You may optionally perform <code>make install</code>. Additional compilation instructions [http://www.cs.nyu.edu/exact/core/gmp/ are available].<br />
<p>If you experience difficulties with compilation and it appears that MinGW gcc is being detected by <code>configure</code> and not Cygwin gcc, you can try editing your <code>PATH</code> variable:</p><br />
<pre><br />
$ export PATH=`echo $PATH | sed "s|/cygdrive/c/MinGW/bin:||"`<br />
</pre><br />
Re-run <code>configure</code> and <code>make</code> afterwards.<br />
</ol><br />
</li><br />
<li>Download the [http://www.libsdl.org/release/SDL-1.2.15-win32.zip latest stable version] of SDL for Windows. Extract the archive and copy <code>SDL.dll</code> from it to the root of your build directory.</li><br />
<li>Set the following CMake flags:<br />
{| class="wikitable"<br />
! Setting<br />
! Description<br />
! Type<br />
! Value<br />
|-<br />
| <code>USE_INTERNAL_CRYPTO</code><br />
| Use the provided copies of crypto libraries. <!-- FIXME: I think these are nettle and something else --><br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_GLEW</code><br />
| Use the provided copy of GLEW.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_JPEG</code><br />
| Use the provided copy of JPEG.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SDL</code><br />
| Use the provided copy of SDL.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SPEEX</code><br />
| Use the provided copy of Speex.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_WEBP</code><br />
| Use the provided copy of WebP.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_CURSES</code><br />
| Enables/disables curses.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>PNG_LIBRARY</code><br />
| Path to the PNG library DLL.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng/libs/win32/libpng.lib</code><br />
|-<br />
| <code>PNG_PNG_INCLUDE_DIR</code><br />
| Path to the PNG library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng</code><br />
|-<br />
| <code>FREETYPE_LIBRARY</code><br />
| Path to the compiled FreeType library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/lib/freetype.lib</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_freetype2</code><br />
| Path to the FreeType library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/freetype2</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_ft2build</code><br />
| Path to the FreeType library file "ftbuild.h".<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/</code><br />
|-<br />
| <code>GMP_INCLUDE_DIR</code><br />
| Path to the GMP library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/gmp/include</code><br />
|-<br />
| <code>GMP_LIBRARY</code><br />
| Path to the GMP library.<br />
| <code>FILEPATH</code><br />
| <code><var>path/to/compiled/gmp/</var>.libs/cyggmp-10.dll</code><br />
|-<br />
| <code>ZLIB_INCLUDE_DIR</code><br />
| Path to the zlib library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/include</code><br />
|-<br />
| <code>ZLIB_LIBRARY</code><br />
| Path to the zlib library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/lib/x32/zlib1.dll</code><br />
|-<br />
| <code>CURL_LIBRARY</code><br />
| Path to the CURL library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/lib/win32/release/libcurl.dll</code><br />
|-<br />
| <code>CURL_INCLUDE_DIR</code><br />
| Path to the zlib library.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/include/curl</code><br />
|-<br />
| <code>USE_OPENAL</code><br />
| Enables/disables OpenAL support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_THEORA</code><br />
| Enables/disables Theora support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_XVID</code><br />
| Enables/disables Xvid support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CODEC_THEORA</code><br />
| Enables/disables Ogg support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>SDL_LIBRARY</code><br />
| The path to the SDL DLL.<br />
| <code>FILEPATH</code><br />
| <code><var>BuildPath</var>/SDL.dll</code><br />
|-<br />
| <code>SDLMAIN_LIBRARY</code><br />
| Enables/disables Ogg support.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code><br />
|-<br />
|}<br />
Do note that CMake is slash-direction&ndash;agnostic; it can handle both forward- and backslashes on Windows.<br />
</li><br />
<li>Open <code><var>SourcePath</var>/CMakeLists.txt</code> and edit the line<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi z )<br />
</pre><br />
(around line 1040) to look like this:<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi )<br />
</pre><br />
Also edit around line 1700:<br />
<pre><br />
###########################<br />
#Configure Download Script#<br />
###########################<br />
<br />
if( NOT MSVC )<br />
</pre><br />
to look like this:<br />
<pre><br />
###########################<br />
#Configure Download Script#<br />
###########################<br />
<br />
if( NOT WIN32 )<br />
<pre><br />
</li><br />
<li>Open <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code> and edit the lines:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "SDL.h"<br />
#include "SDL_main.h"<br />
</pre><br />
to look like:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "../../../include/SDL.h"<br />
#include "../../../include/SDL_main.h"<br />
</pre><br />
<li>Open a terminal and <code>cd</code> to your source directory.</li><br />
<li>Run <code>make</code>:<br />
<pre><br />
> mingw32-make<br />
</pre><br />
If you would like verbose output, set the <code>VERBOSE</code> environment variable before running <code>make</code>.<br />
<pre><br />
> set VERBOSE=1<br />
</pre><br />
To make it easier to build the source, you can create a batch file (call it something like <code>compile.bat</code>) and place it in your build directory:<br />
<pre><br />
@echo off<br />
<br />
set RETURN=compile<br />
<br />
:get_time<br />
:: Thank you, Rob van der Woude:<br />
:: (http://www.robvanderwoude.com/datetimentparse.php)<br />
FOR /F "tokens=1,2,3 delims=:." %%A IN ("%Time%") DO (<br />
SET /A HOURS = 100%%A %% 100<br />
SET /A MINUTES = 100%%B %% 100<br />
SET /A SECONDS = 100%%C %% 100<br />
)<br />
SET /A TICKS=( %HOURS% * 3600 ) + ( %MINUTES% * 60 ) + %SECONDS%<br />
GOTO %RETURN%<br />
<br />
:compile<br />
SET START_TICKS=%TICKS%<br />
<br />
SET VERBOSE=1<br />
:: mingw32-make clean<br />
mingw32-make -j4<br />
<br />
set RETURN=finish<br />
GOTO get_time<br />
<br />
:finish<br />
SET /A COMPILE_TIME=%TICKS% - %START_TICKS%<br />
SET /A MINUTES=%COMPILE_TIME% / 60<br />
SET /A SECONDS=%COMPILE_TIME% %% 60<br />
ECHO.<br />
ECHO Compilation took %MINUTES%m %SECONDS%s.<br />
PAUSE<br />
</pre><br />
</li><br />
<li>Once compilation finishes, you will find that the game will fail to run due to DLL dependencies. To resolve these:<br />
<ul><br />
<li>You will need to move <code>INTERNAL_GLEW</code> from the <code>Release/</code> folder of the build directory to the root of the build directory.</li><br />
<li>You will need to place the following other DLLs in your build directory:<br />
* freetype6.dll<br />
* libbz2.dll<br />
* libcurl.dll<br />
* libogg.dll<br />
* libpng14-14.dll<br />
* libtheora.dll<br />
* libvorbis.dll<br />
* libvorbisfile.dll<br />
* msvcr100.dll<br />
* msvcr100d.dll<br />
* zlib1.dll<br />
* zlibwapi.dll<br />
The easiest way to obtain these DLLs is by copying them from the installation directory of an [http://sourceforge.net/projects/unvanquished/files/latest/download official release] of Unvanquished.<br />
</li><br />
<li>You will need to copy your compiled DLL of GMP to your build directory. It may be found in <code><var>path/to/compiled/gmp/</var>.libs/cyggmp-10.dll</code>.</li><br />
<li>As you compiled GMP with Cygwin, it in turn depends on <code>cygwin1.dll</code>, which may typically be found in <code>C:\cygwin\bin\</code>. Copy and paste it into your build directory.</li><br />
</ul><br />
Once you have completed these steps, you should never have to do them again.<br />
</li><br />
</ol><br />
<br />
====Notes====<br />
<br />
* If you would like to use curses, try using [http://sourceforge.net/projects/pdcurses/files/pdcurses PDCurses].<br />
<br />
===QtCreator===<br />
<br />
# Install MinGW and follow the above instructions, except select Code::Blocks as the generator.<br />
# Start QtCreator, and select "Open File or Project&hellip;" from the File menu.<br />
# Navigate to your source directory and open CMakeLists.txt.<br />
# At the CMake Wizard, select the same build directory you already configured using CMake. (If you did not chose Code::Blocks as the generator, you will have to start over again, as QtCreator requires a Code::Blocks project file in order to compile the source.)<br />
# Ensure that a generator is selected in the combo box, and click "Run CMake". If there is no generator listed, see the [[#Troubleshooting|troubleshooting]] section below.<br />
# Click "Finish" to close the wizard.<br />
<br />
You should now be able to compile, run, and debug the code using QtCreator.<br />
<br />
====Troubleshooting====<br />
<br />
If at the "Run CMake" prompt of the the CMake Wizard, select "Run CMake" and are warned that no generator was selected, and notice that there are no generators in the combo box, you will likely have to [http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html manually configure your toolchain]. Select "Options&hellip;" from the "Tools" menu, then navigate to "Build &amp; Run".<br />
<br />
At the options window,<br />
* Go to the "Kits" tab, and mouse over the "Desktop (default)" kit under "Manual". If there were any errors in configuring this kit, they will be displayed in the tool tip. If there are problems, select the kit. You may need to manually specify the location of the MinGW debugger, for example, which is typically <code>C:\MinGW\bin\gdb.exe</code>.<br />
* Go to the "Compilers" tab, and ensure that MinGW is present. If not, you will need to add it manually.<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 />
libgmp3-dev libjpeg8-dev libncurses5-dev libogg-dev libopenal-dev \<br />
libpng12-dev libsdl1.2-dev libvorbis-dev zlib1g-dev nettle-dev \<br />
libwebp-dev libspeexdsp-dev libtheora-dev<br />
<br />
If the version of WebP supplied by your version of Debian or Ubuntu is older than v0.2.0, you will need to [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0.tar.gz download] and [https://developers.google.com/speed/webp/docs/compiling#unix compile it from source]. After compiling and installing with <code>sudo make install</code>, in CMake, you'll need to set <code>WEBP_INCLUDE_DIR</code> to <code>/usr/local/include/webp</code> and <code>WEBP_LIBRARY</code> to <code>/usr/local/lib/libwebp.so</code>.<br />
<br />
'''We currently provide a ready-to-use libwebp-dev in our [http://{{SERVERNAME}}/index.php/Download#ubuntu Debian and Ubuntu repositories], alongside .debs of the game and server.'''<br />
<br />
Actual dev package names may vary, e.g. libgmp-dev instead of libgmp3-dev and libglew-dev or libglew1.7-dev instead of libglew1.5-dev.<br />
<br />
Since we have a debian directory in the source, you can also to check what's needed then install the listed packages (choosing from alternatives as needed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ dpkg-checkbuilddeps<br />
…<br />
$ sudo apt-get install <var>package(s)</var><br />
<br />
If dpkg-checkbuilddeps produces no output, you have all necessary build dependencies. Also, debhelper's only needed if you're building .debs.<br />
<br />
====Gentoo====<br />
<br />
$ emerge curl freetype glew gmp jpeg ncurses libogg openal libpng libsdl libvorbis zlib<br />
<br />
====openSUSE====<br />
<br />
$ sudo install zypper gcc gcc-c++ Mesa-libGL-devel SDL-devel libjpeg8-devel \<br />
libpng12-devel glew-devel webp-devel ncurses-devel gmp-devel libcurl-devel \<br />
libnettle-devel openal-soft-devel speex-devel libvorbis-devel \<br />
libtheora-devel<br />
<br />
The latest version of WebP must be installed manually:<br />
<br />
$ wget https://webp.googlecode.com/files/libwebp-0.2.1.tar.gz<br />
$ tar xvzf libwebp-0.2.1.tar.gz<br />
$ cd libwebp-0.2.1<br />
$ ./configure && make<br />
$ sudo make install<br />
<br />
You must disable curses (set <code>USE_CURSES</code> appropriately in CMake) as failing to do so will cause Unvanquished to crash on startup.<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 />
On Debian or 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 />
Or, in Debian or Ubuntu, you can build a package (but you'll need to have devscripts and fakeroot installed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ fakeroot dpkg-buildpackage -b -uc<br />
$ sudo dpkg -i <var>../unvanquished_*.deb</var><br />
<br />
Once in <code>ccmake</code>, use the following keys:<br />
<br />
* Press {{Hotkey|c}} to configure. If an error occurs during this phase, make note of it and press {{Hotkey|e}} to dismiss it.<br />
* Use the up and down arrow keys to navigate the compilation options.<br />
* Press {{Hotkey|Enter}} to enable or disable boolean options (i.e., on/off) or to edit textual options.<br />
** Press {{Hotkey|Esc}} when editing a textual option to cancel the change.<br />
<br />
Once you have finished the configuration process, press {{Hotkey|C}} again, then {{Hotkey|G}} 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=====<br />
<br />
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_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 />
* <code>USE_CIN_THEORA</code> &mdash; Disabling this prevents videos from being recorded in Theora.<br />
* <code>USE_CIN_XVID</code> &mdash; Disabling this prevents videos from being recorded in Xvid.<br />
* <code>USE_VOIP</code> &mdash; Disabling this removes VOIP support. Alternatively enabling <code>USE_INTERNAL_SPEEX</code> will use the libraries distributed with Unvanquished for VoIP<br />
* <code>USE_INTERNAL_CRYPTO</code> &mdash; Enable this to use the crypto libraries provided by Unvanquished.<br />
<br />
===Compiling===<br />
<br />
$ cd <var>path/to/unvanquished/build</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 />
===Acquiring mandatory game files===<br />
<br />
The game files are not in the Git repository, and must be downloaded separately. This may be done on the command line or from your web browser. The downloads may be found on [http://sourceforge.net/projects/unvanquished/files/Assets SourceForge.net]. If you download the files from your browser, just download the files named "pak*.pk3", and save them to the [[Running_the_game#Data_locations|data location]] for your system.<br />
<br />
On Linux, this may be done as follows:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
wget -O $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On FreeBSD, using the <code>sh</code> shell:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
fetch -r -o $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On Mac OS X:<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
curl -L "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download" > $file<br />
fi<br />
done<br />
<br />
Linux users may also use the <code>download-pk3.sh</code> script that is distributed with the source code, which requires that curl be installed:<br />
<br />
$ cd <var>[path to Unvanquished source code]</var><br />
$ mkdir -p ~/.Unvanquished/main<br />
$ ./download-pk3.sh ~/.Unvanquished/main<br />
<br />
===Downloading the map pack===<br />
<br />
The map pack exists only for convenience; if you do not download the map pack, Unvanquished will automatically download maps as needed when you attempt to play online.<br />
<br />
To download the map pack on Linux:<br />
<br />
$ wget -O maps.7z "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z"; done<br />
<br />
To download the map pack on Mac OS X:<br />
<br />
$ curl -L "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z" > maps.7z; done<br />
<br />
Note that you will need to unzip the map pack on either system as it is compressed with LZMA. Mac users can use the [http://wakaba.c3.cx/s/apps/unarchiver.html Unarchiver]. Uncompressing the archive on Linux is highly dependent on your distribution.<br />
<br />
===Verifying the Files===<br />
<br />
Download the latest [http://sourceforge.net/projects/unvanquished/files/Assets/{{CurrentVersion|MD5HashFile}} MD5 hash file] and save it to your system's [[Running_the_game#Data_directory|data location]].<br />
<br />
On systems with the <code>md5</code> command (Mac OS X):<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ cat {{CurrentVersion|MD5HashFile}} | while read line; do<br />
file="`echo "$line" | sed -E "s/^[a-fA-F0-9]+ +\*?//"`"<br />
if [ -e "$file" ]; then<br />
if [ `md5 -r "$file" | cut -d\ -f1` = "`echo "$line" | cut -d\ -f1`" ]<br />
then echo "File \"$file\" appears okay."<br />
else echo "File \"$file\" is corrupt"'!' >&2<br />
fi; fi; done<br />
<br />
On systems with the <code>md5sum</code> command (most Linux distributions):<br />
<br />
$ cd <var>[[Running_the_game#Data_directory|/path/to/data/files]]</var><br />
$ md5sum -c {{CurrentVersion|MD5HashFile}} 2>&1 | grep -v "open or read\|file or directory"<br />
<br />
The <code>grep</code> invocation is used to strip output complaining about missing files.<br />
<br />
Any files that are found to be corrupt should be replaced; just download a [http://sourceforge.net/projects/unvanquished/files/Assets new copy] of the affected file(s).<br />
<br />
==Errors==<br />
<br />
===CMake cannot locate Newton===<br />
<br />
If CMake cannot find Newton, you'll need to set it up yourself.<br />
<br />
It should be in <code><var>/path/to/Unvanquished</var>/src/libs/libnewton/libs/<var>your_os</var>/libNewton.so</code>.<br />
Be sure to replace <var>your_os</var> with the proper directory name.<br />
<br />
Use CMake as before to change the <code>NEWTON_LIBRARY</code> build setting to the said path:<br />
<br />
# Start the CMake configurator:<pre>$ ccmake ..</pre><br />
# Scroll down and highlight <code>NEWTON_LIBRARY</code>.<br />
# Press {{Hotkey|Enter}} to begin editing and input in the path.<br />
# Press {{Hotkey|C}} to configure and {{Hotkey|G}} to generate the new makefiles.<br />
# Press {{Hotkey|Q}} to quit.<br />
# Recompile the source:<pre>$ make</pre><br />
<br />
===The C Compiler is not able to compile a simple test program===<br />
<br />
When attempting to generate a solution for Xcode CMake fails with the following error<br />
-- Check for working C compiler using: Xcode -- broken<br />
CMake Error at /Applications/CMake 2.8-8.app/Contents/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):<br />
The C compiler "/usr/bin/gcc" is not able to compile a simple test program.<br />
<br />
It fails with the following output:<br />
<br />
Change Dir: /Users/danielmaloney/Documents/Unvanquished/build-xcode/CMakeFiles/CMakeTmp<br />
<br />
<br />
<br />
Run Build Command:/Applications/CMake\ 2.8-8.app/Contents/bin/cmakexbuild<br />
-project CMAKE_TRY_COMPILE.xcodeproj build -target<br />
cmTryCompileExec1400153232 -configuration Debug<br />
<br />
Error: No developer directory found at /Developer. Run<br />
/usr/bin/xcode-select to update the developer directory path.<br />
<br />
<br />
<br />
<br />
<br />
CMake will not be able to correctly generate this project.<br />
Call Stack (most recent call first):<br />
CMakeLists.txt:19 (project)<br />
<br />
This is due to Xcode 4.3 having a different directory structure to previous versions. Simply running the following command will correct this error:<br />
sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer/</div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Compiling_the_source&diff=1958Compiling the source2013-04-14T17:47:54Z<p>Velociostrich: /* MinGW */ % must be escaped with another % inside a batch file.</p>
<hr />
<div>==Mac OS X==<br />
<br />
First, you need to [[Getting_the_source|acquire the source code]].<br />
<br />
Regardless of what interface you may use to compile the source, you will need [http://www.cmake.org/cmake/resources/software.html CMake] to generate makefiles. You will also need to install [https://developer.apple.com/xcode/ Xcode] (making sure to choose to install the command-line utilities when prompted by the installer).<br />
<br />
Then, you will need to acquire (and in some cases, manually compile) at a minimum the [[#Dependencies|necessary libraries]].<br />
<br />
Once you have the source code and the libraries installed, you may actually proceed to compile the source. You have several options:<br />
* '''Compile the source at the command line'''. This is the easiest if you would just like to compile the game to use yourself and you do not intend to work on the code.<br />
* '''Compile the source using an IDE'''. This is preferred if you intend on developing the source.<br />
** Xcode is Apple's flagship IDE and you should have installed to compile the source regardless of which method you use.<br />
** [http://qt-project.org/downloads QtCreator] is cross-platform and provides real-time feedback of syntax errors, a Vim mode, as well as other features.<br />
** [http://www.codeblocks.org/ Code::Blcoks] is also cross-platform but lacks some of the features of Xcode and QtCreator.<br />
<br />
===Dependencies===<br />
<br />
You only need to use one of the following methods (HomeBrew or compiling by hand). Please try and avoid mixing methods as this may produce unexpected results.<br />
<br />
Unvanquished requires the following libraries:<br />
* [[#JPEG|JPEG]], version 8 or higher. (Version 6 was known to have problems)<br />
* [[#Simple_DirectMedia_Layer_.28SDL.29|Simple DirectMedia Layer]] (The binary provided by libsdl.org causes graphical corruptions. Compile from source or use homebrew/macports)<br />
* [[#The_OpenGL_Extension_Wrangler_Library_.28GLEW.29|The OpenGL Extension Wrangler Library]]<br />
* CuRL<br />
* [[#The_GNU_MP_Bignum_Library_.28libgmp.29|GMP]]<br />
* [[#WebP|WebP]] (v0.2.0 or newer)<br />
<br />
The following libraries are optional:<br />
* Theora<br />
* Speex<br />
* [[#Ogg|Ogg]]<br />
* [[#Vorbis|Vorbis]]<br />
<br />
====HomeBrew====<br />
Install [http://mxcl.github.com/homebrew/ HomeBrew] and then run the following command<br />
<br />
$ brew install nettle libjpeg curl sdl webp xvid gmp glew speex libvorbis theora<br />
<br />
All the necessary libraries should now have been installed.<br />
<br />
====Compiling by hand====<br />
The following are shell scripts that download, compile, and install various libraries. This is more time consuming then other methods but might be useful if you need more control over your libraries<br />
<br />
=====JPEG=====<br />
<br />
$ curl http://www.ijg.org/files/jpegsrc.v8d.tar.gz > jpegsrc.v8d.tar.gz<br />
$ tar xvzf jpegsrc.v8d.tar.gz<br />
$ cd jpeg-8d<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The OpenGL Extension Wrangler Library (GLEW)=====<br />
<br />
$ curl -L https://sourceforge.net/projects/glew/files/glew/1.7.0/glew-1.7.0.tgz/download > glew-1.7.0.tgz<br />
$ tar xvzf glew-1.7.0.tgz<br />
$ cd glew-1.7.0<br />
$ make<br />
$ sudo make install<br />
<br />
=====Simple DirectMedia Layer (SDL)=====<br />
<br />
Do not use the binaries provided by libsdl.org, as these are known to cause issues with gamma and color display. Instead, compile your own:<br />
<br />
$ curl http://www.libsdl.org/release/SDL-1.2.15.tar.gz > SDL-1.2.15.tar.gz<br />
$ tar xvzf SDL-1.2.15.tar.gz<br />
$ cd SDL-1.2.15<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The GNU MP Bignum Library (libgmp)=====<br />
<br />
$ curl ftp://ftp.gmplib.org/pub/gmp-5.0.5/gmp-5.0.5.tar.bz2 > gmp-5.0.5.tar.bz2<br />
$ tar xvjf gmp-5.0.5.tar.bz2<br />
$ cd gmp-5.0.5<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Ogg=====<br />
<br />
$ curl http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz > libogg-1.3.0.tar.gz<br />
$ tar xvzf libogg-1.3.0.tar.gz<br />
$ cd libogg-1.3.0<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Vorbis=====<br />
<br />
$ curl http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz > libvorbis-1.3.3.tar.gz<br />
$ tar xvzf libvorbis-1.3.3.tar.gz<br />
$ cd libvorbis-1.3.3<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====WebP=====<br />
<br />
You do not need to compile WebP by hand; Google provides binaries for Mac OS X available from their [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0-mac-10.5.tar.gz project page]. You will need version 0.2.0 or newer.<br />
<br />
Once downloaded, you must still install the header files and the binary:<br />
<br />
$ curl https://webp.googlecode.com/files/libwebp-0.2.0-mac-10.5.tar.gz > libwebp-0.2.0-mac-10.5.tar.gz<br />
$ tar xvzf libwebp-0.2.0-mac-10.5.tar.gz<br />
$ cd libwebp-0.2.0-mac-10.5<br />
$ sudo cp include/webp /usr/local/include<br />
$ sudo cp lib/libwebp.a /usr/local/lib<br />
<br />
===Configuring with CMake===<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 should be a different directory.<br />
# Hit "Configure". You will be prompted as to which generator you would like to use. If you have Xcode installed, choose that. Wait while the configuration process runs. You may have to set the following:<br />
## If CMake did not find your jpeg headers for some reason, set <code>JPEG_INCLUDE_DIR</code> to <code>/path/to/Unvanquished/src/libs/jpeg</code>.<br />
## Check <code>USE_INTERNAL_CRYPTO</code> to avoid having to compile nettle and hogweed.<br />
## Check <code>USE_INTERNAL_SPEEX</code> to avoid having to compile Speex.<br />
## Uncheck <code>USE_CIN_THEORA</code> and <code>USE_CIN_XVID</code> to avoid having to compile Theora or Xvid. (At present, there are not cutscenes or any such that require it.)<br />
## '''You will probably not be able to compile with the GLSL optimizer enabled; uncheck <code>USE_GLSL_OPTIMIZER</code>'''<br />
## If you have selected to generate Xcode project files, make the <code>SDLMAIN_LIBRARY</code> field blank. This option is not available if you have the generator set to Unix makefiles.<br />
# Hit "Generate".<br />
# You may now close Xcode.<br />
<br />
===Compiling===<br />
<br />
====With Xcode====<br />
<br />
<ol><br />
<li>Compilation will fail unless you manually create certain directories needed by the build scripts:<br />
<pre><br />
$ cd /path/to/build/dir/CMakeFiles<br />
$ mkdir gpp{game,trem,ui}-qvm.dir<br />
</pre><br />
This is a workaround to {{Issue|101}}.<br />
</li><br />
<li>Either start Xcode and open the project file (in the build directory you specified) or double-click the project file in Finder.</li><br />
<li>Open the project file created by CMake, which should be in the build directory you specified.</li><br />
<li>Change the active target to "ALL_BUILD" and click Product&rarr;Build.</li><br />
</ol><br />
<br />
====With Unix Makefiles====<br />
<br />
<ul><br />
<li>Start Terminal (Applications &rarr; Utilities &rarr; Terminal).</li><br />
<li>Input the following commands:<br />
<pre><br />
$ cd /path/to/Unvanquished-build<br />
$ make<br />
</pre><br />
If you are on a multi-core or multi-processor machine, you may speed up the process by passing the <code>-j</code> argument followed by the number of available cores to <code>make</code>; e.g., <code>make -j4</code>. Note that doing so makes reading error messages more difficult, as multiple instances of the compiler will print to the screen at once, causing information to appear out of order.<br />
</li><br />
</ul><br />
<br />
===Testing the build===<br />
<br />
====With Xcode 4====<br />
<br />
To test the game, select the "client" scheme from the combo box on the toolbar, and click the run button or press {{Hotkey|MacCommand}}{{Hotkey|R}}.<br />
<br />
====With Unix Makefiles====<br />
<br />
After compiling, you'll have to place the data files in the <code>main</code> directory in your build directory. [[#Acquiring the Game Files|For download instructions, see below.]]<br />
<br />
Your file structure should look as follows:<br />
<br />
[[File:Build_dir_Mac_OS_X.png]]<br />
<br />
You may now start the application as such:<br />
<br />
$ ./daemon.i386<br />
<br />
Note that older machines will not support the new OpenGL 3 renderer, and must be started specifying the "vanilla" (aka "GL") renderer:<br />
<br />
$ ./daemon.i386 +set cl_renderer GL<br />
<br />
===Bundling the Application===<br />
<br />
====With CPack====<br />
<br />
CPack is able to create standalone bundles (as well as many other types of installers). However you must generate the files using Unix Makefiles instead of Xcode.<br />
<br />
$ cd /path/to/Unvanquished-build<br />
$ cpack -G Bundle<br />
<br />
Some warnings will be printed however these can be safely ignored. There should be a file called Unvanquished.dmg in the Unvanquished-build folder.<br />
<br />
====Manually====<br />
<br />
You'll find the Mac [http://macdylibbundler.sourceforge.net/ dynamic library bundler] to be quite useful (you must generate the files using Unix Makefiles instead of Xcode):<br />
<br />
$ curl -L http://sourceforge.net/projects/macdylibbundler/files/macdylibbundler/0.4.1/dylibbundler0.4.1.zip/download > \<br />
dylibbundler0.4.1.zip<br />
$ unzip dylibbundler0.4.1.zip<br />
$ cd dylibbundler<br />
$ make<br />
$ sudo make install<br />
<br />
Once you've done that, you can proceed to create the application bundle. Note that these steps assume that you have downloaded the data files to <code>main/</code> as shown above:<br />
<br />
<pre><br />
$ git=/path/to/Unvanquished-git-repo<br />
$ build=/path/to/Unvanquished-build-dir<br />
$ mkdir -pv Unvanquished.app/Contents/{libs,MacOS,Resources,Frameworks}<br />
$ cp -r $build/main Unvanquished.app/Contents/MacOS<br />
$ sips -s format tiff $git/debian/unvanquished.png --out temp.tiff<br />
$ tiff2icns temp.tiff Unvanquished.app/Contents/Resources/Unvanquished.icns<br />
$ rm temp.tiff<br />
$ cp $build/daemon{,ded}.i386 $build/*.dylib Unvanquished.app/Contents/MacOS<br />
$ cp -r /Library/Frameworks/SDL.framework Unvanquished.app/Contents/Frameworks<br />
$ install_name_tool -id \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/Frameworks/SDL.framework/Versions/A/SDL<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGLi386.dylib<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGL3i386.dylib<br />
$ for binary in Unvanquished.app/Contents/MacOS/*.{i386,dylib}; do<br />
dylibbundler -b -x $binary -d $dest/Unvanquished.app/Contents/libs/; done<br />
$ cp /usr/lib/libGLEW.1.7.0.dylib ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ chmod +w ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -id @executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -change /usr/lib/libGLEW.1.7.0.dylib \<br />
@executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ cat > Unvanquished.app/Contents/Info.plist<br />
<?xml version="1.0" encoding="UTF-8"?><br />
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"<br />
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"><br />
<plist version="1.0"><br />
<dict><br />
<key>CFBundleName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleDisplayName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleExecutable</key><br />
<string>daemon.i386</string><br />
<key>CFBundleIconFile</key><br />
<string>Unvanquished.icns</string><br />
<key>CFBundleIdentifier</key><br />
<string>net.Unvanquished</string><br />
<key>CFBundleInfoDictionaryVersion</key><br />
<string>6.0</string><br />
<key>CFBundlePackageType</key><br />
<string>APPL</string><br />
<key>CFBundleShortVersionString</key><br />
<string>0.4.0</string><br />
<key>CFBundleVersion</key><br />
<string>0.4.0</string><br />
</dict><br />
</plist><br />
^d<br />
</pre><br />
<br />
Note: <code>^d</code> indicates pressing {{Hotkey|Ctrl}}{{Hotkey|D}} on the keyboard.<br />
<br />
The contents of the completed application bundle should look like this:<br />
<br />
[[File:Bundle_dir_Mac_OS_X.png]]<br />
<br />
'''Note''': If you compiled SDL from source, you will not see a directory titled <code>SDL.framework</code>.<br />
<br />
==Windows==<br />
<br />
===Visual Studio===<br />
<br />
CMake can generate Visual Studio projects for unvanquished however this feature is relatively new and may have some bugs.<br />
<br />
Steps:<br />
<br />
# Double click on Visual_Studio32.bat<br />
# Open build-32/Daemon.sln in Visual Studio 2010.<br />
# In the two text boxes in the toolbar, select "Release" or "Debug" in the first one and Win32 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 />
====Important Notes====<br />
<br />
* LLVM is disabled and does not work correctly with CMake generated Visual Studio projects.<br />
* ncurses is not supported under Visual Studio.<br />
* The path to the build folder must not have any spaces otherwise generation of QVMs will fail. See [https://github.com/Unvanquished/Unvanquished/issues/102 issue 102]<br />
* Due to limitations with cmake neither the startup project nor the working directory can be specified. These must be manually set to the following values for debugging the client under Visual Studio<br />
** Right click on client and select "Set as StartUp project".<br />
** Right click on client, select properties, select Debugging and set "Working Directory" to $(TargetPath)\..<br />
<br />
===MinGW===<br />
<br />
It is possible to build Unvanquished with MinGW, although the process is rather arduous compared to Visual Studio or compiling for other platforms.<br />
<br />
Note:<br />
<br />
* The easiest way to acquire and install MinGW is with the graphical [http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/ mingw-get-inst installer]. <!-- TODO: maybe walk the user through the installer? --><br />
* When configuring the build with CMake, you will find that you will have to set a number of libraries manually. You can find precompiled DLLs for most of the dependencies; those that are not pre-compiled can be built with the corresponding <code>USE_INTERNAL_</code> setting.<br />
* On Windows, SDL requires that the Direct X SDK can be installed. You may download the June 2010 release from [http://www.microsoft.com/en-us/download/details.aspx?id=6812 Microsoft's site].<br />
* '''The build will fail during QVM compilation if your source or build directories contain spaces.''' This is due to a bug with lcc. If your home directory contains a space, you may want to create source and build directories at the root of one of your drives (e.g., <code>C:\Unvanquished\Source</code> and <code>C:\Unvanquished\Build</code>.)<br />
<br />
The easiest way to get a build up (at the time of writing) is as follows:<br />
<br />
{{Note|content=Although there are 64-bit binaries of most of the libraries required to build the game, these do not work with MinGW at present, so the following instructions all use the 32-bit binaries.}}<br />
<br />
<ol><br />
<li>Although there are binaries of gmp distributed with the source, they have are dependent on Visual Studio's implementations of <code>_ftol2_sse</code> and <code>_alloca_probe_16</code>. A fix may be found on [http://stackoverflow.com/questions/6753111/static-linking-with-openssl Stack Exchange], but requires that Visual Studio be installed, which defeats the purpose of attempting to use MinGW to compile the source. You can build gmp yourself:<br />
<ol><br />
<li>Download and extract the latest version of the [http://gmplib.org/ GNU MP Bignum Library (GMP)]. (You will need either cygwin with tar and bz2 installed or 7-zip to extract the archive.)</li><br />
<li>Install the following Cygwin packages if you have not already:<br />
* binutils<br />
* gcc<br />
* gcc-g++<br />
* m4<br />
* make<br />
</li><br />
<li>As part of the GMP compilation process, a file called <code>gen-fib.c</code> generates a table of numbers in the Fibonacci sequence. The generated file does not play nicely with Cygwin or MinGW, so you must fix it. Edit <code>gen-fib.c</code>, and at around line 100, change these lines<br />
<pre><br />
for (i = 0; i < fnum; i++)<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
printf ("), /* %d */\n", i-1);<br />
}<br />
printf ("};\n");<br />
</pre><br />
to look like this:<br />
<pre><br />
for (i = 0; i < fnum; i++)<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
printf (")%c /* %d */\n", (i == (fnum-1)) ? ' ' : ',', i-1);<br />
}<br />
printf ("};\n");<br />
</pre><br />
The patch file looks like this:<br />
<pre><br />
@@ -100,7 +100,7 @@<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
- printf ("), /* %d */\n", i-1);<br />
+ printf (")%c /* %d */\n", (i == (fnum-1)) ? ' ' : ',', i-1);<br />
}<br />
printf ("};\n");<br />
}<br />
</pre><br />
</li><br />
<li>Compiling with MinGW does not work, so you will need to compile with Cygwin. At the prompt:<br />
<pre><br />
$ ./configure --disable-static --enable-shared<br />
$ make<br />
</pre><br />
The <code>--disable-static</code> and <code>--enable-shared</code> flags configure GMP to build a DLL instead of a static library. You may optionally perform <code>make install</code>. Additional compilation instructions [http://www.cs.nyu.edu/exact/core/gmp/ are available].<br />
<p>If you experience difficulties with compilation and it appears that MinGW gcc is being detected by <code>configure</code> and not Cygwin gcc, you can try editing your <code>PATH</code> variable:</p><br />
<pre><br />
$ export PATH=`echo $PATH | sed "s|/cygdrive/c/MinGW/bin:||"`<br />
</pre><br />
Re-run <code>configure</code> and <code>make</code> afterwards.<br />
</ol><br />
</li><br />
<li>Download the [http://www.libsdl.org/release/SDL-1.2.15-win32.zip latest stable version] of SDL for Windows. Extract the archive and copy <code>SDL.dll</code> from it to the root of your build directory.</li><br />
<li>Set the following CMake flags:<br />
{| class="wikitable"<br />
! Setting<br />
! Description<br />
! Type<br />
! Value<br />
|-<br />
| <code>USE_INTERNAL_CRYPTO</code><br />
| Use the provided copies of crypto libraries. <!-- FIXME: I think these are nettle and something else --><br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_GLEW</code><br />
| Use the provided copy of GLEW.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_JPEG</code><br />
| Use the provided copy of JPEG.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SDL</code><br />
| Use the provided copy of SDL.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SPEEX</code><br />
| Use the provided copy of Speex.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_WEBP</code><br />
| Use the provided copy of WebP.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_CURSES</code><br />
| Enables/disables curses.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>PNG_LIBRARY</code><br />
| Path to the PNG library DLL.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng/libs/win32/libpng.lib</code><br />
|-<br />
| <code>PNG_PNG_INCLUDE_DIR</code><br />
| Path to the PNG library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng</code><br />
|-<br />
| <code>FREETYPE_LIBRARY</code><br />
| Path to the compiled FreeType library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/lib/freetype.lib</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_freetype2</code><br />
| Path to the FreeType library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/freetype2</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_ft2build</code><br />
| Path to the FreeType library file "ftbuild.h".<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/</code><br />
|-<br />
| <code>GMP_INCLUDE_DIR</code><br />
| Path to the GMP library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/gmp/include</code><br />
|-<br />
| <code>GMP_LIBRARY</code><br />
| Path to the GMP library.<br />
| <code>FILEPATH</code><br />
| <code><var>path/to/compiled/gmp/</var>.libs/cyggmp-10.dll</code><br />
|-<br />
| <code>ZLIB_INCLUDE_DIR</code><br />
| Path to the zlib library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/include</code><br />
|-<br />
| <code>ZLIB_LIBRARY</code><br />
| Path to the zlib library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/lib/x32/zlib1.dll</code><br />
|-<br />
| <code>CURL_LIBRARY</code><br />
| Path to the CURL library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/lib/win32/release/libcurl.dll</code><br />
|-<br />
| <code>CURL_INCLUDE_DIR</code><br />
| Path to the zlib library.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/include/curl</code><br />
|-<br />
| <code>USE_OPENAL</code><br />
| Enables/disables OpenAL support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_THEORA</code><br />
| Enables/disables Theora support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_XVID</code><br />
| Enables/disables Xvid support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CODEC_THEORA</code><br />
| Enables/disables Ogg support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>SDL_LIBRARY</code><br />
| The path to the SDL DLL.<br />
| <code>FILEPATH</code><br />
| <code><var>BuildPath</var>/SDL.dll</code><br />
|-<br />
| <code>SDLMAIN_LIBRARY</code><br />
| Enables/disables Ogg support.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code><br />
|-<br />
|}<br />
Do note that CMake is slash-direction&ndash;agnostic; it can handle both forward- and backslashes on Windows.<br />
</li><br />
<li>Open <code><var>SourcePath</var>/CMakeLists.txt</code> and edit the line<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi z )<br />
</pre><br />
(around line 1040) to look like this:<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi )<br />
</pre><br />
Also edit around line 1700:<br />
<pre><br />
###########################<br />
#Configure Download Script#<br />
###########################<br />
<br />
if( NOT MSVC )<br />
</pre><br />
to look like this:<br />
<pre><br />
###########################<br />
#Configure Download Script#<br />
###########################<br />
<br />
if( NOT WIN32 )<br />
<pre><br />
</li><br />
<li>Open <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code> and edit the lines:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "SDL.h"<br />
#include "SDL_main.h"<br />
</pre><br />
to look like:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "../../../include/SDL.h"<br />
#include "../../../include/SDL_main.h"<br />
</pre><br />
<li>Open a terminal and <code>cd</code> to your source directory.</li><br />
<li>Run <code>make</code>:<br />
<pre><br />
> mingw32-make<br />
</pre><br />
If you would like verbose output, set the <code>VERBOSE</code> environment variable before running <code>make</code>.<br />
<pre><br />
> set VERBOSE=1<br />
</pre><br />
To make it easier to build the source, you can create a batch file (call it something like <code>compile.bat</code>) and place it in your build directory:<br />
<pre><br />
@echo off<br />
<br />
set RETURN=compile<br />
<br />
:get_time<br />
:: Thank you, Rob van der Woude:<br />
:: (http://www.robvanderwoude.com/datetimentparse.php)<br />
FOR /F "tokens=1,2,3 delims=:." %%A IN ("%Time%") DO (<br />
SET /A HOURS = 100%%A %% 100<br />
SET /A MINUTES = 100%%B %% 100<br />
SET /A SECONDS = 100%%C %% 100<br />
)<br />
SET /A TICKS=( %HOURS% * 3600 ) + ( %MINUTES% * 60 ) + %SECONDS%<br />
GOTO %RETURN%<br />
<br />
:compile<br />
SET START_TICKS=%TICKS%<br />
<br />
SET VERBOSE=1<br />
:: mingw32-make clean<br />
mingw32-make -j4<br />
<br />
set RETURN=finish<br />
GOTO get_time<br />
<br />
:finish<br />
SET /A COMPILE_TIME=%TICKS% - %START_TICKS%<br />
SET /A MINUTES=%COMPILE_TIME% / 60<br />
SET /A SECONDS=%COMPILE_TIME% %% 60<br />
ECHO.<br />
ECHO Compilation took %MINUTES%m %SECONDS%s.<br />
PAUSE<br />
</pre><br />
</li><br />
</ol><br />
<br />
====Notes====<br />
<br />
* If you would like to use curses, try using [http://sourceforge.net/projects/pdcurses/files/pdcurses PDCurses].<br />
<br />
===QtCreator===<br />
<br />
# Install MinGW and follow the above instructions, except select Code::Blocks as the generator.<br />
# Start QtCreator, and select "Open File or Project&hellip;" from the File menu.<br />
# Navigate to your source directory and open CMakeLists.txt.<br />
# At the CMake Wizard, select the same build directory you already configured using CMake. (If you did not chose Code::Blocks as the generator, you will have to start over again, as QtCreator requires a Code::Blocks project file in order to compile the source.)<br />
# Ensure that a generator is selected in the combo box, and click "Run CMake". If there is no generator listed, see the [[#Troubleshooting|troubleshooting]] section below.<br />
# Click "Finish" to close the wizard.<br />
<br />
You should now be able to compile, run, and debug the code using QtCreator.<br />
<br />
====Troubleshooting====<br />
<br />
If at the "Run CMake" prompt of the the CMake Wizard, select "Run CMake" and are warned that no generator was selected, and notice that there are no generators in the combo box, you will likely have to [http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html manually configure your toolchain]. Select "Options&hellip;" from the "Tools" menu, then navigate to "Build &amp; Run".<br />
<br />
At the options window,<br />
* Go to the "Kits" tab, and mouse over the "Desktop (default)" kit under "Manual". If there were any errors in configuring this kit, they will be displayed in the tool tip. If there are problems, select the kit. You may need to manually specify the location of the MinGW debugger, for example, which is typically <code>C:\MinGW\bin\gdb.exe</code>.<br />
* Go to the "Compilers" tab, and ensure that MinGW is present. If not, you will need to add it manually.<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 />
libgmp3-dev libjpeg8-dev libncurses5-dev libogg-dev libopenal-dev \<br />
libpng12-dev libsdl1.2-dev libvorbis-dev zlib1g-dev nettle-dev \<br />
libwebp-dev libspeexdsp-dev libtheora-dev<br />
<br />
If the version of WebP supplied by your version of Debian or Ubuntu is older than v0.2.0, you will need to [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0.tar.gz download] and [https://developers.google.com/speed/webp/docs/compiling#unix compile it from source]. After compiling and installing with <code>sudo make install</code>, in CMake, you'll need to set <code>WEBP_INCLUDE_DIR</code> to <code>/usr/local/include/webp</code> and <code>WEBP_LIBRARY</code> to <code>/usr/local/lib/libwebp.so</code>.<br />
<br />
'''We currently provide a ready-to-use libwebp-dev in our [http://{{SERVERNAME}}/index.php/Download#ubuntu Debian and Ubuntu repositories], alongside .debs of the game and server.'''<br />
<br />
Actual dev package names may vary, e.g. libgmp-dev instead of libgmp3-dev and libglew-dev or libglew1.7-dev instead of libglew1.5-dev.<br />
<br />
Since we have a debian directory in the source, you can also to check what's needed then install the listed packages (choosing from alternatives as needed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ dpkg-checkbuilddeps<br />
…<br />
$ sudo apt-get install <var>package(s)</var><br />
<br />
If dpkg-checkbuilddeps produces no output, you have all necessary build dependencies. Also, debhelper's only needed if you're building .debs.<br />
<br />
====Gentoo====<br />
<br />
$ emerge curl freetype glew gmp jpeg ncurses libogg openal libpng libsdl libvorbis zlib<br />
<br />
====openSUSE====<br />
<br />
$ sudo install zypper gcc gcc-c++ Mesa-libGL-devel SDL-devel libjpeg8-devel \<br />
libpng12-devel glew-devel webp-devel ncurses-devel gmp-devel libcurl-devel \<br />
libnettle-devel openal-soft-devel speex-devel libvorbis-devel \<br />
libtheora-devel<br />
<br />
The latest version of WebP must be installed manually:<br />
<br />
$ wget https://webp.googlecode.com/files/libwebp-0.2.1.tar.gz<br />
$ tar xvzf libwebp-0.2.1.tar.gz<br />
$ cd libwebp-0.2.1<br />
$ ./configure && make<br />
$ sudo make install<br />
<br />
You must disable curses (set <code>USE_CURSES</code> appropriately in CMake) as failing to do so will cause Unvanquished to crash on startup.<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 />
On Debian or 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 />
Or, in Debian or Ubuntu, you can build a package (but you'll need to have devscripts and fakeroot installed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ fakeroot dpkg-buildpackage -b -uc<br />
$ sudo dpkg -i <var>../unvanquished_*.deb</var><br />
<br />
Once in <code>ccmake</code>, use the following keys:<br />
<br />
* Press {{Hotkey|c}} to configure. If an error occurs during this phase, make note of it and press {{Hotkey|e}} to dismiss it.<br />
* Use the up and down arrow keys to navigate the compilation options.<br />
* Press {{Hotkey|Enter}} to enable or disable boolean options (i.e., on/off) or to edit textual options.<br />
** Press {{Hotkey|Esc}} when editing a textual option to cancel the change.<br />
<br />
Once you have finished the configuration process, press {{Hotkey|C}} again, then {{Hotkey|G}} 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=====<br />
<br />
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_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 />
* <code>USE_CIN_THEORA</code> &mdash; Disabling this prevents videos from being recorded in Theora.<br />
* <code>USE_CIN_XVID</code> &mdash; Disabling this prevents videos from being recorded in Xvid.<br />
* <code>USE_VOIP</code> &mdash; Disabling this removes VOIP support. Alternatively enabling <code>USE_INTERNAL_SPEEX</code> will use the libraries distributed with Unvanquished for VoIP<br />
* <code>USE_INTERNAL_CRYPTO</code> &mdash; Enable this to use the crypto libraries provided by Unvanquished.<br />
<br />
===Compiling===<br />
<br />
$ cd <var>path/to/unvanquished/build</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 />
===Acquiring mandatory game files===<br />
<br />
The game files are not in the Git repository, and must be downloaded separately. This may be done on the command line or from your web browser. The downloads may be found on [http://sourceforge.net/projects/unvanquished/files/Assets SourceForge.net]. If you download the files from your browser, just download the files named "pak*.pk3", and save them to the [[Running_the_game#Data_locations|data location]] for your system.<br />
<br />
On Linux, this may be done as follows:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
wget -O $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On FreeBSD, using the <code>sh</code> shell:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
fetch -r -o $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On Mac OS X:<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
curl -L "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download" > $file<br />
fi<br />
done<br />
<br />
Linux users may also use the <code>download-pk3.sh</code> script that is distributed with the source code, which requires that curl be installed:<br />
<br />
$ cd <var>[path to Unvanquished source code]</var><br />
$ mkdir -p ~/.Unvanquished/main<br />
$ ./download-pk3.sh ~/.Unvanquished/main<br />
<br />
===Downloading the map pack===<br />
<br />
The map pack exists only for convenience; if you do not download the map pack, Unvanquished will automatically download maps as needed when you attempt to play online.<br />
<br />
To download the map pack on Linux:<br />
<br />
$ wget -O maps.7z "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z"; done<br />
<br />
To download the map pack on Mac OS X:<br />
<br />
$ curl -L "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z" > maps.7z; done<br />
<br />
Note that you will need to unzip the map pack on either system as it is compressed with LZMA. Mac users can use the [http://wakaba.c3.cx/s/apps/unarchiver.html Unarchiver]. Uncompressing the archive on Linux is highly dependent on your distribution.<br />
<br />
===Verifying the Files===<br />
<br />
Download the latest [http://sourceforge.net/projects/unvanquished/files/Assets/{{CurrentVersion|MD5HashFile}} MD5 hash file] and save it to your system's [[Running_the_game#Data_directory|data location]].<br />
<br />
On systems with the <code>md5</code> command (Mac OS X):<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ cat {{CurrentVersion|MD5HashFile}} | while read line; do<br />
file="`echo "$line" | sed -E "s/^[a-fA-F0-9]+ +\*?//"`"<br />
if [ -e "$file" ]; then<br />
if [ `md5 -r "$file" | cut -d\ -f1` = "`echo "$line" | cut -d\ -f1`" ]<br />
then echo "File \"$file\" appears okay."<br />
else echo "File \"$file\" is corrupt"'!' >&2<br />
fi; fi; done<br />
<br />
On systems with the <code>md5sum</code> command (most Linux distributions):<br />
<br />
$ cd <var>[[Running_the_game#Data_directory|/path/to/data/files]]</var><br />
$ md5sum -c {{CurrentVersion|MD5HashFile}} 2>&1 | grep -v "open or read\|file or directory"<br />
<br />
The <code>grep</code> invocation is used to strip output complaining about missing files.<br />
<br />
Any files that are found to be corrupt should be replaced; just download a [http://sourceforge.net/projects/unvanquished/files/Assets new copy] of the affected file(s).<br />
<br />
==Errors==<br />
<br />
===CMake cannot locate Newton===<br />
<br />
If CMake cannot find Newton, you'll need to set it up yourself.<br />
<br />
It should be in <code><var>/path/to/Unvanquished</var>/src/libs/libnewton/libs/<var>your_os</var>/libNewton.so</code>.<br />
Be sure to replace <var>your_os</var> with the proper directory name.<br />
<br />
Use CMake as before to change the <code>NEWTON_LIBRARY</code> build setting to the said path:<br />
<br />
# Start the CMake configurator:<pre>$ ccmake ..</pre><br />
# Scroll down and highlight <code>NEWTON_LIBRARY</code>.<br />
# Press {{Hotkey|Enter}} to begin editing and input in the path.<br />
# Press {{Hotkey|C}} to configure and {{Hotkey|G}} to generate the new makefiles.<br />
# Press {{Hotkey|Q}} to quit.<br />
# Recompile the source:<pre>$ make</pre><br />
<br />
===The C Compiler is not able to compile a simple test program===<br />
<br />
When attempting to generate a solution for Xcode CMake fails with the following error<br />
-- Check for working C compiler using: Xcode -- broken<br />
CMake Error at /Applications/CMake 2.8-8.app/Contents/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):<br />
The C compiler "/usr/bin/gcc" is not able to compile a simple test program.<br />
<br />
It fails with the following output:<br />
<br />
Change Dir: /Users/danielmaloney/Documents/Unvanquished/build-xcode/CMakeFiles/CMakeTmp<br />
<br />
<br />
<br />
Run Build Command:/Applications/CMake\ 2.8-8.app/Contents/bin/cmakexbuild<br />
-project CMAKE_TRY_COMPILE.xcodeproj build -target<br />
cmTryCompileExec1400153232 -configuration Debug<br />
<br />
Error: No developer directory found at /Developer. Run<br />
/usr/bin/xcode-select to update the developer directory path.<br />
<br />
<br />
<br />
<br />
<br />
CMake will not be able to correctly generate this project.<br />
Call Stack (most recent call first):<br />
CMakeLists.txt:19 (project)<br />
<br />
This is due to Xcode 4.3 having a different directory structure to previous versions. Simply running the following command will correct this error:<br />
sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer/</div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Compiling_the_source&diff=1957Compiling the source2013-04-14T17:41:29Z<p>Velociostrich: /* MinGW */ Add instructions for downloading SDL.dll.</p>
<hr />
<div>==Mac OS X==<br />
<br />
First, you need to [[Getting_the_source|acquire the source code]].<br />
<br />
Regardless of what interface you may use to compile the source, you will need [http://www.cmake.org/cmake/resources/software.html CMake] to generate makefiles. You will also need to install [https://developer.apple.com/xcode/ Xcode] (making sure to choose to install the command-line utilities when prompted by the installer).<br />
<br />
Then, you will need to acquire (and in some cases, manually compile) at a minimum the [[#Dependencies|necessary libraries]].<br />
<br />
Once you have the source code and the libraries installed, you may actually proceed to compile the source. You have several options:<br />
* '''Compile the source at the command line'''. This is the easiest if you would just like to compile the game to use yourself and you do not intend to work on the code.<br />
* '''Compile the source using an IDE'''. This is preferred if you intend on developing the source.<br />
** Xcode is Apple's flagship IDE and you should have installed to compile the source regardless of which method you use.<br />
** [http://qt-project.org/downloads QtCreator] is cross-platform and provides real-time feedback of syntax errors, a Vim mode, as well as other features.<br />
** [http://www.codeblocks.org/ Code::Blcoks] is also cross-platform but lacks some of the features of Xcode and QtCreator.<br />
<br />
===Dependencies===<br />
<br />
You only need to use one of the following methods (HomeBrew or compiling by hand). Please try and avoid mixing methods as this may produce unexpected results.<br />
<br />
Unvanquished requires the following libraries:<br />
* [[#JPEG|JPEG]], version 8 or higher. (Version 6 was known to have problems)<br />
* [[#Simple_DirectMedia_Layer_.28SDL.29|Simple DirectMedia Layer]] (The binary provided by libsdl.org causes graphical corruptions. Compile from source or use homebrew/macports)<br />
* [[#The_OpenGL_Extension_Wrangler_Library_.28GLEW.29|The OpenGL Extension Wrangler Library]]<br />
* CuRL<br />
* [[#The_GNU_MP_Bignum_Library_.28libgmp.29|GMP]]<br />
* [[#WebP|WebP]] (v0.2.0 or newer)<br />
<br />
The following libraries are optional:<br />
* Theora<br />
* Speex<br />
* [[#Ogg|Ogg]]<br />
* [[#Vorbis|Vorbis]]<br />
<br />
====HomeBrew====<br />
Install [http://mxcl.github.com/homebrew/ HomeBrew] and then run the following command<br />
<br />
$ brew install nettle libjpeg curl sdl webp xvid gmp glew speex libvorbis theora<br />
<br />
All the necessary libraries should now have been installed.<br />
<br />
====Compiling by hand====<br />
The following are shell scripts that download, compile, and install various libraries. This is more time consuming then other methods but might be useful if you need more control over your libraries<br />
<br />
=====JPEG=====<br />
<br />
$ curl http://www.ijg.org/files/jpegsrc.v8d.tar.gz > jpegsrc.v8d.tar.gz<br />
$ tar xvzf jpegsrc.v8d.tar.gz<br />
$ cd jpeg-8d<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The OpenGL Extension Wrangler Library (GLEW)=====<br />
<br />
$ curl -L https://sourceforge.net/projects/glew/files/glew/1.7.0/glew-1.7.0.tgz/download > glew-1.7.0.tgz<br />
$ tar xvzf glew-1.7.0.tgz<br />
$ cd glew-1.7.0<br />
$ make<br />
$ sudo make install<br />
<br />
=====Simple DirectMedia Layer (SDL)=====<br />
<br />
Do not use the binaries provided by libsdl.org, as these are known to cause issues with gamma and color display. Instead, compile your own:<br />
<br />
$ curl http://www.libsdl.org/release/SDL-1.2.15.tar.gz > SDL-1.2.15.tar.gz<br />
$ tar xvzf SDL-1.2.15.tar.gz<br />
$ cd SDL-1.2.15<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The GNU MP Bignum Library (libgmp)=====<br />
<br />
$ curl ftp://ftp.gmplib.org/pub/gmp-5.0.5/gmp-5.0.5.tar.bz2 > gmp-5.0.5.tar.bz2<br />
$ tar xvjf gmp-5.0.5.tar.bz2<br />
$ cd gmp-5.0.5<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Ogg=====<br />
<br />
$ curl http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz > libogg-1.3.0.tar.gz<br />
$ tar xvzf libogg-1.3.0.tar.gz<br />
$ cd libogg-1.3.0<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Vorbis=====<br />
<br />
$ curl http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz > libvorbis-1.3.3.tar.gz<br />
$ tar xvzf libvorbis-1.3.3.tar.gz<br />
$ cd libvorbis-1.3.3<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====WebP=====<br />
<br />
You do not need to compile WebP by hand; Google provides binaries for Mac OS X available from their [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0-mac-10.5.tar.gz project page]. You will need version 0.2.0 or newer.<br />
<br />
Once downloaded, you must still install the header files and the binary:<br />
<br />
$ curl https://webp.googlecode.com/files/libwebp-0.2.0-mac-10.5.tar.gz > libwebp-0.2.0-mac-10.5.tar.gz<br />
$ tar xvzf libwebp-0.2.0-mac-10.5.tar.gz<br />
$ cd libwebp-0.2.0-mac-10.5<br />
$ sudo cp include/webp /usr/local/include<br />
$ sudo cp lib/libwebp.a /usr/local/lib<br />
<br />
===Configuring with CMake===<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 should be a different directory.<br />
# Hit "Configure". You will be prompted as to which generator you would like to use. If you have Xcode installed, choose that. Wait while the configuration process runs. You may have to set the following:<br />
## If CMake did not find your jpeg headers for some reason, set <code>JPEG_INCLUDE_DIR</code> to <code>/path/to/Unvanquished/src/libs/jpeg</code>.<br />
## Check <code>USE_INTERNAL_CRYPTO</code> to avoid having to compile nettle and hogweed.<br />
## Check <code>USE_INTERNAL_SPEEX</code> to avoid having to compile Speex.<br />
## Uncheck <code>USE_CIN_THEORA</code> and <code>USE_CIN_XVID</code> to avoid having to compile Theora or Xvid. (At present, there are not cutscenes or any such that require it.)<br />
## '''You will probably not be able to compile with the GLSL optimizer enabled; uncheck <code>USE_GLSL_OPTIMIZER</code>'''<br />
## If you have selected to generate Xcode project files, make the <code>SDLMAIN_LIBRARY</code> field blank. This option is not available if you have the generator set to Unix makefiles.<br />
# Hit "Generate".<br />
# You may now close Xcode.<br />
<br />
===Compiling===<br />
<br />
====With Xcode====<br />
<br />
<ol><br />
<li>Compilation will fail unless you manually create certain directories needed by the build scripts:<br />
<pre><br />
$ cd /path/to/build/dir/CMakeFiles<br />
$ mkdir gpp{game,trem,ui}-qvm.dir<br />
</pre><br />
This is a workaround to {{Issue|101}}.<br />
</li><br />
<li>Either start Xcode and open the project file (in the build directory you specified) or double-click the project file in Finder.</li><br />
<li>Open the project file created by CMake, which should be in the build directory you specified.</li><br />
<li>Change the active target to "ALL_BUILD" and click Product&rarr;Build.</li><br />
</ol><br />
<br />
====With Unix Makefiles====<br />
<br />
<ul><br />
<li>Start Terminal (Applications &rarr; Utilities &rarr; Terminal).</li><br />
<li>Input the following commands:<br />
<pre><br />
$ cd /path/to/Unvanquished-build<br />
$ make<br />
</pre><br />
If you are on a multi-core or multi-processor machine, you may speed up the process by passing the <code>-j</code> argument followed by the number of available cores to <code>make</code>; e.g., <code>make -j4</code>. Note that doing so makes reading error messages more difficult, as multiple instances of the compiler will print to the screen at once, causing information to appear out of order.<br />
</li><br />
</ul><br />
<br />
===Testing the build===<br />
<br />
====With Xcode 4====<br />
<br />
To test the game, select the "client" scheme from the combo box on the toolbar, and click the run button or press {{Hotkey|MacCommand}}{{Hotkey|R}}.<br />
<br />
====With Unix Makefiles====<br />
<br />
After compiling, you'll have to place the data files in the <code>main</code> directory in your build directory. [[#Acquiring the Game Files|For download instructions, see below.]]<br />
<br />
Your file structure should look as follows:<br />
<br />
[[File:Build_dir_Mac_OS_X.png]]<br />
<br />
You may now start the application as such:<br />
<br />
$ ./daemon.i386<br />
<br />
Note that older machines will not support the new OpenGL 3 renderer, and must be started specifying the "vanilla" (aka "GL") renderer:<br />
<br />
$ ./daemon.i386 +set cl_renderer GL<br />
<br />
===Bundling the Application===<br />
<br />
====With CPack====<br />
<br />
CPack is able to create standalone bundles (as well as many other types of installers). However you must generate the files using Unix Makefiles instead of Xcode.<br />
<br />
$ cd /path/to/Unvanquished-build<br />
$ cpack -G Bundle<br />
<br />
Some warnings will be printed however these can be safely ignored. There should be a file called Unvanquished.dmg in the Unvanquished-build folder.<br />
<br />
====Manually====<br />
<br />
You'll find the Mac [http://macdylibbundler.sourceforge.net/ dynamic library bundler] to be quite useful (you must generate the files using Unix Makefiles instead of Xcode):<br />
<br />
$ curl -L http://sourceforge.net/projects/macdylibbundler/files/macdylibbundler/0.4.1/dylibbundler0.4.1.zip/download > \<br />
dylibbundler0.4.1.zip<br />
$ unzip dylibbundler0.4.1.zip<br />
$ cd dylibbundler<br />
$ make<br />
$ sudo make install<br />
<br />
Once you've done that, you can proceed to create the application bundle. Note that these steps assume that you have downloaded the data files to <code>main/</code> as shown above:<br />
<br />
<pre><br />
$ git=/path/to/Unvanquished-git-repo<br />
$ build=/path/to/Unvanquished-build-dir<br />
$ mkdir -pv Unvanquished.app/Contents/{libs,MacOS,Resources,Frameworks}<br />
$ cp -r $build/main Unvanquished.app/Contents/MacOS<br />
$ sips -s format tiff $git/debian/unvanquished.png --out temp.tiff<br />
$ tiff2icns temp.tiff Unvanquished.app/Contents/Resources/Unvanquished.icns<br />
$ rm temp.tiff<br />
$ cp $build/daemon{,ded}.i386 $build/*.dylib Unvanquished.app/Contents/MacOS<br />
$ cp -r /Library/Frameworks/SDL.framework Unvanquished.app/Contents/Frameworks<br />
$ install_name_tool -id \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/Frameworks/SDL.framework/Versions/A/SDL<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGLi386.dylib<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGL3i386.dylib<br />
$ for binary in Unvanquished.app/Contents/MacOS/*.{i386,dylib}; do<br />
dylibbundler -b -x $binary -d $dest/Unvanquished.app/Contents/libs/; done<br />
$ cp /usr/lib/libGLEW.1.7.0.dylib ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ chmod +w ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -id @executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -change /usr/lib/libGLEW.1.7.0.dylib \<br />
@executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ cat > Unvanquished.app/Contents/Info.plist<br />
<?xml version="1.0" encoding="UTF-8"?><br />
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"<br />
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"><br />
<plist version="1.0"><br />
<dict><br />
<key>CFBundleName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleDisplayName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleExecutable</key><br />
<string>daemon.i386</string><br />
<key>CFBundleIconFile</key><br />
<string>Unvanquished.icns</string><br />
<key>CFBundleIdentifier</key><br />
<string>net.Unvanquished</string><br />
<key>CFBundleInfoDictionaryVersion</key><br />
<string>6.0</string><br />
<key>CFBundlePackageType</key><br />
<string>APPL</string><br />
<key>CFBundleShortVersionString</key><br />
<string>0.4.0</string><br />
<key>CFBundleVersion</key><br />
<string>0.4.0</string><br />
</dict><br />
</plist><br />
^d<br />
</pre><br />
<br />
Note: <code>^d</code> indicates pressing {{Hotkey|Ctrl}}{{Hotkey|D}} on the keyboard.<br />
<br />
The contents of the completed application bundle should look like this:<br />
<br />
[[File:Bundle_dir_Mac_OS_X.png]]<br />
<br />
'''Note''': If you compiled SDL from source, you will not see a directory titled <code>SDL.framework</code>.<br />
<br />
==Windows==<br />
<br />
===Visual Studio===<br />
<br />
CMake can generate Visual Studio projects for unvanquished however this feature is relatively new and may have some bugs.<br />
<br />
Steps:<br />
<br />
# Double click on Visual_Studio32.bat<br />
# Open build-32/Daemon.sln in Visual Studio 2010.<br />
# In the two text boxes in the toolbar, select "Release" or "Debug" in the first one and Win32 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 />
====Important Notes====<br />
<br />
* LLVM is disabled and does not work correctly with CMake generated Visual Studio projects.<br />
* ncurses is not supported under Visual Studio.<br />
* The path to the build folder must not have any spaces otherwise generation of QVMs will fail. See [https://github.com/Unvanquished/Unvanquished/issues/102 issue 102]<br />
* Due to limitations with cmake neither the startup project nor the working directory can be specified. These must be manually set to the following values for debugging the client under Visual Studio<br />
** Right click on client and select "Set as StartUp project".<br />
** Right click on client, select properties, select Debugging and set "Working Directory" to $(TargetPath)\..<br />
<br />
===MinGW===<br />
<br />
It is possible to build Unvanquished with MinGW, although the process is rather arduous compared to Visual Studio or compiling for other platforms.<br />
<br />
Note:<br />
<br />
* The easiest way to acquire and install MinGW is with the graphical [http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/ mingw-get-inst installer]. <!-- TODO: maybe walk the user through the installer? --><br />
* When configuring the build with CMake, you will find that you will have to set a number of libraries manually. You can find precompiled DLLs for most of the dependencies; those that are not pre-compiled can be built with the corresponding <code>USE_INTERNAL_</code> setting.<br />
* On Windows, SDL requires that the Direct X SDK can be installed. You may download the June 2010 release from [http://www.microsoft.com/en-us/download/details.aspx?id=6812 Microsoft's site].<br />
* '''The build will fail during QVM compilation if your source or build directories contain spaces.''' This is due to a bug with lcc. If your home directory contains a space, you may want to create source and build directories at the root of one of your drives (e.g., <code>C:\Unvanquished\Source</code> and <code>C:\Unvanquished\Build</code>.)<br />
<br />
The easiest way to get a build up (at the time of writing) is as follows:<br />
<br />
{{Note|content=Although there are 64-bit binaries of most of the libraries required to build the game, these do not work with MinGW at present, so the following instructions all use the 32-bit binaries.}}<br />
<br />
<ol><br />
<li>Although there are binaries of gmp distributed with the source, they have are dependent on Visual Studio's implementations of <code>_ftol2_sse</code> and <code>_alloca_probe_16</code>. A fix may be found on [http://stackoverflow.com/questions/6753111/static-linking-with-openssl Stack Exchange], but requires that Visual Studio be installed, which defeats the purpose of attempting to use MinGW to compile the source. You can build gmp yourself:<br />
<ol><br />
<li>Download and extract the latest version of the [http://gmplib.org/ GNU MP Bignum Library (GMP)]. (You will need either cygwin with tar and bz2 installed or 7-zip to extract the archive.)</li><br />
<li>Install the following Cygwin packages if you have not already:<br />
* binutils<br />
* gcc<br />
* gcc-g++<br />
* m4<br />
* make<br />
</li><br />
<li>As part of the GMP compilation process, a file called <code>gen-fib.c</code> generates a table of numbers in the Fibonacci sequence. The generated file does not play nicely with Cygwin or MinGW, so you must fix it. Edit <code>gen-fib.c</code>, and at around line 100, change these lines<br />
<pre><br />
for (i = 0; i < fnum; i++)<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
printf ("), /* %d */\n", i-1);<br />
}<br />
printf ("};\n");<br />
</pre><br />
to look like this:<br />
<pre><br />
for (i = 0; i < fnum; i++)<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
printf (")%c /* %d */\n", (i == (fnum-1)) ? ' ' : ',', i-1);<br />
}<br />
printf ("};\n");<br />
</pre><br />
The patch file looks like this:<br />
<pre><br />
@@ -100,7 +100,7 @@<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
- printf ("), /* %d */\n", i-1);<br />
+ printf (")%c /* %d */\n", (i == (fnum-1)) ? ' ' : ',', i-1);<br />
}<br />
printf ("};\n");<br />
}<br />
</pre><br />
</li><br />
<li>Compiling with MinGW does not work, so you will need to compile with Cygwin. At the prompt:<br />
<pre><br />
$ ./configure --disable-static --enable-shared<br />
$ make<br />
</pre><br />
The <code>--disable-static</code> and <code>--enable-shared</code> flags configure GMP to build a DLL instead of a static library. You may optionally perform <code>make install</code>. Additional compilation instructions [http://www.cs.nyu.edu/exact/core/gmp/ are available].<br />
<p>If you experience difficulties with compilation and it appears that MinGW gcc is being detected by <code>configure</code> and not Cygwin gcc, you can try editing your <code>PATH</code> variable:</p><br />
<pre><br />
$ export PATH=`echo $PATH | sed "s|/cygdrive/c/MinGW/bin:||"`<br />
</pre><br />
Re-run <code>configure</code> and <code>make</code> afterwards.<br />
</ol><br />
</li><br />
<li>Download the [http://www.libsdl.org/release/SDL-1.2.15-win32.zip latest stable version] of SDL for Windows. Extract the archive and copy <code>SDL.dll</code> from it to the root of your build directory.</li><br />
<li>Set the following CMake flags:<br />
{| class="wikitable"<br />
! Setting<br />
! Description<br />
! Type<br />
! Value<br />
|-<br />
| <code>USE_INTERNAL_CRYPTO</code><br />
| Use the provided copies of crypto libraries. <!-- FIXME: I think these are nettle and something else --><br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_GLEW</code><br />
| Use the provided copy of GLEW.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_JPEG</code><br />
| Use the provided copy of JPEG.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SDL</code><br />
| Use the provided copy of SDL.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SPEEX</code><br />
| Use the provided copy of Speex.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_WEBP</code><br />
| Use the provided copy of WebP.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_CURSES</code><br />
| Enables/disables curses.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>PNG_LIBRARY</code><br />
| Path to the PNG library DLL.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng/libs/win32/libpng.lib</code><br />
|-<br />
| <code>PNG_PNG_INCLUDE_DIR</code><br />
| Path to the PNG library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng</code><br />
|-<br />
| <code>FREETYPE_LIBRARY</code><br />
| Path to the compiled FreeType library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/lib/freetype.lib</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_freetype2</code><br />
| Path to the FreeType library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/freetype2</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_ft2build</code><br />
| Path to the FreeType library file "ftbuild.h".<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/</code><br />
|-<br />
| <code>GMP_INCLUDE_DIR</code><br />
| Path to the GMP library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/gmp/include</code><br />
|-<br />
| <code>GMP_LIBRARY</code><br />
| Path to the GMP library.<br />
| <code>FILEPATH</code><br />
| <code><var>path/to/compiled/gmp/</var>.libs/cyggmp-10.dll</code><br />
|-<br />
| <code>ZLIB_INCLUDE_DIR</code><br />
| Path to the zlib library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/include</code><br />
|-<br />
| <code>ZLIB_LIBRARY</code><br />
| Path to the zlib library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/lib/x32/zlib1.dll</code><br />
|-<br />
| <code>CURL_LIBRARY</code><br />
| Path to the CURL library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/lib/win32/release/libcurl.dll</code><br />
|-<br />
| <code>CURL_INCLUDE_DIR</code><br />
| Path to the zlib library.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/include/curl</code><br />
|-<br />
| <code>USE_OPENAL</code><br />
| Enables/disables OpenAL support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_THEORA</code><br />
| Enables/disables Theora support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_XVID</code><br />
| Enables/disables Xvid support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CODEC_THEORA</code><br />
| Enables/disables Ogg support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>SDL_LIBRARY</code><br />
| The path to the SDL DLL.<br />
| <code>FILEPATH</code><br />
| <code><var>BuildPath</var>/SDL.dll</code><br />
|-<br />
| <code>SDLMAIN_LIBRARY</code><br />
| Enables/disables Ogg support.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code><br />
|-<br />
|}<br />
Do note that CMake is slash-direction&ndash;agnostic; it can handle both forward- and backslashes on Windows.<br />
</li><br />
<li>Open <code><var>SourcePath</var>/CMakeLists.txt</code> and edit the line<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi z )<br />
</pre><br />
(around line 1040) to look like this:<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi )<br />
</pre><br />
Also edit around line 1700:<br />
<pre><br />
###########################<br />
#Configure Download Script#<br />
###########################<br />
<br />
if( NOT MSVC )<br />
</pre><br />
to look like this:<br />
<pre><br />
###########################<br />
#Configure Download Script#<br />
###########################<br />
<br />
if( NOT WIN32 )<br />
<pre><br />
</li><br />
<li>Open <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code> and edit the lines:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "SDL.h"<br />
#include "SDL_main.h"<br />
</pre><br />
to look like:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "../../../include/SDL.h"<br />
#include "../../../include/SDL_main.h"<br />
</pre><br />
<li>Open a terminal and <code>cd</code> to your source directory.</li><br />
<li>Run <code>make</code>:<br />
<pre><br />
> mingw32-make<br />
</pre><br />
If you would like verbose output, set the <code>VERBOSE</code> environment variable before running <code>make</code>.<br />
<pre><br />
> set VERBOSE=1<br />
</pre><br />
To make it easier to build the source, you can create a batch file (call it something like <code>compile.bat</code>) and place it in your build directory:<br />
<pre><br />
@echo off<br />
<br />
set RETURN=compile<br />
<br />
:get_time<br />
:: Thank you, Rob van der Woude:<br />
:: (http://www.robvanderwoude.com/datetimentparse.php)<br />
FOR /F "tokens=1,2,3 delims=:." %%A IN ("%Time%") DO (<br />
SET /A HOURS = 100%%A %% 100<br />
SET /A MINUTES = 100%%B %% 100<br />
SET /A SECONDS = 100%%C %% 100<br />
)<br />
SET /A TICKS=( %HOURS% * 3600 ) + ( %MINUTES% * 60 ) + %SECONDS%<br />
GOTO %RETURN%<br />
<br />
:compile<br />
SET START_TICKS=%TICKS%<br />
<br />
SET VERBOSE=1<br />
:: mingw32-make clean<br />
mingw32-make -j4<br />
<br />
set RETURN=finish<br />
GOTO get_time<br />
<br />
:finish<br />
SET /A COMPILE_TIME=%TICKS% - %START_TICKS%<br />
SET /A MINUTES=%COMPILE_TIME% / 60<br />
SET /A SECONDS=%COMPILE_TIME% % 60<br />
ECHO.<br />
ECHO Compilation took %MINUTES%m %SECONDS%s.<br />
PAUSE<br />
</pre><br />
</li><br />
</ol><br />
<br />
====Notes====<br />
<br />
* If you would like to use curses, try using [http://sourceforge.net/projects/pdcurses/files/pdcurses PDCurses].<br />
<br />
===QtCreator===<br />
<br />
# Install MinGW and follow the above instructions, except select Code::Blocks as the generator.<br />
# Start QtCreator, and select "Open File or Project&hellip;" from the File menu.<br />
# Navigate to your source directory and open CMakeLists.txt.<br />
# At the CMake Wizard, select the same build directory you already configured using CMake. (If you did not chose Code::Blocks as the generator, you will have to start over again, as QtCreator requires a Code::Blocks project file in order to compile the source.)<br />
# Ensure that a generator is selected in the combo box, and click "Run CMake". If there is no generator listed, see the [[#Troubleshooting|troubleshooting]] section below.<br />
# Click "Finish" to close the wizard.<br />
<br />
You should now be able to compile, run, and debug the code using QtCreator.<br />
<br />
====Troubleshooting====<br />
<br />
If at the "Run CMake" prompt of the the CMake Wizard, select "Run CMake" and are warned that no generator was selected, and notice that there are no generators in the combo box, you will likely have to [http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html manually configure your toolchain]. Select "Options&hellip;" from the "Tools" menu, then navigate to "Build &amp; Run".<br />
<br />
At the options window,<br />
* Go to the "Kits" tab, and mouse over the "Desktop (default)" kit under "Manual". If there were any errors in configuring this kit, they will be displayed in the tool tip. If there are problems, select the kit. You may need to manually specify the location of the MinGW debugger, for example, which is typically <code>C:\MinGW\bin\gdb.exe</code>.<br />
* Go to the "Compilers" tab, and ensure that MinGW is present. If not, you will need to add it manually.<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 />
libgmp3-dev libjpeg8-dev libncurses5-dev libogg-dev libopenal-dev \<br />
libpng12-dev libsdl1.2-dev libvorbis-dev zlib1g-dev nettle-dev \<br />
libwebp-dev libspeexdsp-dev libtheora-dev<br />
<br />
If the version of WebP supplied by your version of Debian or Ubuntu is older than v0.2.0, you will need to [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0.tar.gz download] and [https://developers.google.com/speed/webp/docs/compiling#unix compile it from source]. After compiling and installing with <code>sudo make install</code>, in CMake, you'll need to set <code>WEBP_INCLUDE_DIR</code> to <code>/usr/local/include/webp</code> and <code>WEBP_LIBRARY</code> to <code>/usr/local/lib/libwebp.so</code>.<br />
<br />
'''We currently provide a ready-to-use libwebp-dev in our [http://{{SERVERNAME}}/index.php/Download#ubuntu Debian and Ubuntu repositories], alongside .debs of the game and server.'''<br />
<br />
Actual dev package names may vary, e.g. libgmp-dev instead of libgmp3-dev and libglew-dev or libglew1.7-dev instead of libglew1.5-dev.<br />
<br />
Since we have a debian directory in the source, you can also to check what's needed then install the listed packages (choosing from alternatives as needed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ dpkg-checkbuilddeps<br />
…<br />
$ sudo apt-get install <var>package(s)</var><br />
<br />
If dpkg-checkbuilddeps produces no output, you have all necessary build dependencies. Also, debhelper's only needed if you're building .debs.<br />
<br />
====Gentoo====<br />
<br />
$ emerge curl freetype glew gmp jpeg ncurses libogg openal libpng libsdl libvorbis zlib<br />
<br />
====openSUSE====<br />
<br />
$ sudo install zypper gcc gcc-c++ Mesa-libGL-devel SDL-devel libjpeg8-devel \<br />
libpng12-devel glew-devel webp-devel ncurses-devel gmp-devel libcurl-devel \<br />
libnettle-devel openal-soft-devel speex-devel libvorbis-devel \<br />
libtheora-devel<br />
<br />
The latest version of WebP must be installed manually:<br />
<br />
$ wget https://webp.googlecode.com/files/libwebp-0.2.1.tar.gz<br />
$ tar xvzf libwebp-0.2.1.tar.gz<br />
$ cd libwebp-0.2.1<br />
$ ./configure && make<br />
$ sudo make install<br />
<br />
You must disable curses (set <code>USE_CURSES</code> appropriately in CMake) as failing to do so will cause Unvanquished to crash on startup.<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 />
On Debian or 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 />
Or, in Debian or Ubuntu, you can build a package (but you'll need to have devscripts and fakeroot installed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ fakeroot dpkg-buildpackage -b -uc<br />
$ sudo dpkg -i <var>../unvanquished_*.deb</var><br />
<br />
Once in <code>ccmake</code>, use the following keys:<br />
<br />
* Press {{Hotkey|c}} to configure. If an error occurs during this phase, make note of it and press {{Hotkey|e}} to dismiss it.<br />
* Use the up and down arrow keys to navigate the compilation options.<br />
* Press {{Hotkey|Enter}} to enable or disable boolean options (i.e., on/off) or to edit textual options.<br />
** Press {{Hotkey|Esc}} when editing a textual option to cancel the change.<br />
<br />
Once you have finished the configuration process, press {{Hotkey|C}} again, then {{Hotkey|G}} 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=====<br />
<br />
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_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 />
* <code>USE_CIN_THEORA</code> &mdash; Disabling this prevents videos from being recorded in Theora.<br />
* <code>USE_CIN_XVID</code> &mdash; Disabling this prevents videos from being recorded in Xvid.<br />
* <code>USE_VOIP</code> &mdash; Disabling this removes VOIP support. Alternatively enabling <code>USE_INTERNAL_SPEEX</code> will use the libraries distributed with Unvanquished for VoIP<br />
* <code>USE_INTERNAL_CRYPTO</code> &mdash; Enable this to use the crypto libraries provided by Unvanquished.<br />
<br />
===Compiling===<br />
<br />
$ cd <var>path/to/unvanquished/build</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 />
===Acquiring mandatory game files===<br />
<br />
The game files are not in the Git repository, and must be downloaded separately. This may be done on the command line or from your web browser. The downloads may be found on [http://sourceforge.net/projects/unvanquished/files/Assets SourceForge.net]. If you download the files from your browser, just download the files named "pak*.pk3", and save them to the [[Running_the_game#Data_locations|data location]] for your system.<br />
<br />
On Linux, this may be done as follows:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
wget -O $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On FreeBSD, using the <code>sh</code> shell:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
fetch -r -o $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On Mac OS X:<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
curl -L "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download" > $file<br />
fi<br />
done<br />
<br />
Linux users may also use the <code>download-pk3.sh</code> script that is distributed with the source code, which requires that curl be installed:<br />
<br />
$ cd <var>[path to Unvanquished source code]</var><br />
$ mkdir -p ~/.Unvanquished/main<br />
$ ./download-pk3.sh ~/.Unvanquished/main<br />
<br />
===Downloading the map pack===<br />
<br />
The map pack exists only for convenience; if you do not download the map pack, Unvanquished will automatically download maps as needed when you attempt to play online.<br />
<br />
To download the map pack on Linux:<br />
<br />
$ wget -O maps.7z "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z"; done<br />
<br />
To download the map pack on Mac OS X:<br />
<br />
$ curl -L "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z" > maps.7z; done<br />
<br />
Note that you will need to unzip the map pack on either system as it is compressed with LZMA. Mac users can use the [http://wakaba.c3.cx/s/apps/unarchiver.html Unarchiver]. Uncompressing the archive on Linux is highly dependent on your distribution.<br />
<br />
===Verifying the Files===<br />
<br />
Download the latest [http://sourceforge.net/projects/unvanquished/files/Assets/{{CurrentVersion|MD5HashFile}} MD5 hash file] and save it to your system's [[Running_the_game#Data_directory|data location]].<br />
<br />
On systems with the <code>md5</code> command (Mac OS X):<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ cat {{CurrentVersion|MD5HashFile}} | while read line; do<br />
file="`echo "$line" | sed -E "s/^[a-fA-F0-9]+ +\*?//"`"<br />
if [ -e "$file" ]; then<br />
if [ `md5 -r "$file" | cut -d\ -f1` = "`echo "$line" | cut -d\ -f1`" ]<br />
then echo "File \"$file\" appears okay."<br />
else echo "File \"$file\" is corrupt"'!' >&2<br />
fi; fi; done<br />
<br />
On systems with the <code>md5sum</code> command (most Linux distributions):<br />
<br />
$ cd <var>[[Running_the_game#Data_directory|/path/to/data/files]]</var><br />
$ md5sum -c {{CurrentVersion|MD5HashFile}} 2>&1 | grep -v "open or read\|file or directory"<br />
<br />
The <code>grep</code> invocation is used to strip output complaining about missing files.<br />
<br />
Any files that are found to be corrupt should be replaced; just download a [http://sourceforge.net/projects/unvanquished/files/Assets new copy] of the affected file(s).<br />
<br />
==Errors==<br />
<br />
===CMake cannot locate Newton===<br />
<br />
If CMake cannot find Newton, you'll need to set it up yourself.<br />
<br />
It should be in <code><var>/path/to/Unvanquished</var>/src/libs/libnewton/libs/<var>your_os</var>/libNewton.so</code>.<br />
Be sure to replace <var>your_os</var> with the proper directory name.<br />
<br />
Use CMake as before to change the <code>NEWTON_LIBRARY</code> build setting to the said path:<br />
<br />
# Start the CMake configurator:<pre>$ ccmake ..</pre><br />
# Scroll down and highlight <code>NEWTON_LIBRARY</code>.<br />
# Press {{Hotkey|Enter}} to begin editing and input in the path.<br />
# Press {{Hotkey|C}} to configure and {{Hotkey|G}} to generate the new makefiles.<br />
# Press {{Hotkey|Q}} to quit.<br />
# Recompile the source:<pre>$ make</pre><br />
<br />
===The C Compiler is not able to compile a simple test program===<br />
<br />
When attempting to generate a solution for Xcode CMake fails with the following error<br />
-- Check for working C compiler using: Xcode -- broken<br />
CMake Error at /Applications/CMake 2.8-8.app/Contents/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):<br />
The C compiler "/usr/bin/gcc" is not able to compile a simple test program.<br />
<br />
It fails with the following output:<br />
<br />
Change Dir: /Users/danielmaloney/Documents/Unvanquished/build-xcode/CMakeFiles/CMakeTmp<br />
<br />
<br />
<br />
Run Build Command:/Applications/CMake\ 2.8-8.app/Contents/bin/cmakexbuild<br />
-project CMAKE_TRY_COMPILE.xcodeproj build -target<br />
cmTryCompileExec1400153232 -configuration Debug<br />
<br />
Error: No developer directory found at /Developer. Run<br />
/usr/bin/xcode-select to update the developer directory path.<br />
<br />
<br />
<br />
<br />
<br />
CMake will not be able to correctly generate this project.<br />
Call Stack (most recent call first):<br />
CMakeLists.txt:19 (project)<br />
<br />
This is due to Xcode 4.3 having a different directory structure to previous versions. Simply running the following command will correct this error:<br />
sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer/</div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Compiling_the_source&diff=1956Compiling the source2013-04-14T17:35:51Z<p>Velociostrich: /* MinGW */ Update note on DLL compatibility</p>
<hr />
<div>==Mac OS X==<br />
<br />
First, you need to [[Getting_the_source|acquire the source code]].<br />
<br />
Regardless of what interface you may use to compile the source, you will need [http://www.cmake.org/cmake/resources/software.html CMake] to generate makefiles. You will also need to install [https://developer.apple.com/xcode/ Xcode] (making sure to choose to install the command-line utilities when prompted by the installer).<br />
<br />
Then, you will need to acquire (and in some cases, manually compile) at a minimum the [[#Dependencies|necessary libraries]].<br />
<br />
Once you have the source code and the libraries installed, you may actually proceed to compile the source. You have several options:<br />
* '''Compile the source at the command line'''. This is the easiest if you would just like to compile the game to use yourself and you do not intend to work on the code.<br />
* '''Compile the source using an IDE'''. This is preferred if you intend on developing the source.<br />
** Xcode is Apple's flagship IDE and you should have installed to compile the source regardless of which method you use.<br />
** [http://qt-project.org/downloads QtCreator] is cross-platform and provides real-time feedback of syntax errors, a Vim mode, as well as other features.<br />
** [http://www.codeblocks.org/ Code::Blcoks] is also cross-platform but lacks some of the features of Xcode and QtCreator.<br />
<br />
===Dependencies===<br />
<br />
You only need to use one of the following methods (HomeBrew or compiling by hand). Please try and avoid mixing methods as this may produce unexpected results.<br />
<br />
Unvanquished requires the following libraries:<br />
* [[#JPEG|JPEG]], version 8 or higher. (Version 6 was known to have problems)<br />
* [[#Simple_DirectMedia_Layer_.28SDL.29|Simple DirectMedia Layer]] (The binary provided by libsdl.org causes graphical corruptions. Compile from source or use homebrew/macports)<br />
* [[#The_OpenGL_Extension_Wrangler_Library_.28GLEW.29|The OpenGL Extension Wrangler Library]]<br />
* CuRL<br />
* [[#The_GNU_MP_Bignum_Library_.28libgmp.29|GMP]]<br />
* [[#WebP|WebP]] (v0.2.0 or newer)<br />
<br />
The following libraries are optional:<br />
* Theora<br />
* Speex<br />
* [[#Ogg|Ogg]]<br />
* [[#Vorbis|Vorbis]]<br />
<br />
====HomeBrew====<br />
Install [http://mxcl.github.com/homebrew/ HomeBrew] and then run the following command<br />
<br />
$ brew install nettle libjpeg curl sdl webp xvid gmp glew speex libvorbis theora<br />
<br />
All the necessary libraries should now have been installed.<br />
<br />
====Compiling by hand====<br />
The following are shell scripts that download, compile, and install various libraries. This is more time consuming then other methods but might be useful if you need more control over your libraries<br />
<br />
=====JPEG=====<br />
<br />
$ curl http://www.ijg.org/files/jpegsrc.v8d.tar.gz > jpegsrc.v8d.tar.gz<br />
$ tar xvzf jpegsrc.v8d.tar.gz<br />
$ cd jpeg-8d<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The OpenGL Extension Wrangler Library (GLEW)=====<br />
<br />
$ curl -L https://sourceforge.net/projects/glew/files/glew/1.7.0/glew-1.7.0.tgz/download > glew-1.7.0.tgz<br />
$ tar xvzf glew-1.7.0.tgz<br />
$ cd glew-1.7.0<br />
$ make<br />
$ sudo make install<br />
<br />
=====Simple DirectMedia Layer (SDL)=====<br />
<br />
Do not use the binaries provided by libsdl.org, as these are known to cause issues with gamma and color display. Instead, compile your own:<br />
<br />
$ curl http://www.libsdl.org/release/SDL-1.2.15.tar.gz > SDL-1.2.15.tar.gz<br />
$ tar xvzf SDL-1.2.15.tar.gz<br />
$ cd SDL-1.2.15<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The GNU MP Bignum Library (libgmp)=====<br />
<br />
$ curl ftp://ftp.gmplib.org/pub/gmp-5.0.5/gmp-5.0.5.tar.bz2 > gmp-5.0.5.tar.bz2<br />
$ tar xvjf gmp-5.0.5.tar.bz2<br />
$ cd gmp-5.0.5<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Ogg=====<br />
<br />
$ curl http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz > libogg-1.3.0.tar.gz<br />
$ tar xvzf libogg-1.3.0.tar.gz<br />
$ cd libogg-1.3.0<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Vorbis=====<br />
<br />
$ curl http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz > libvorbis-1.3.3.tar.gz<br />
$ tar xvzf libvorbis-1.3.3.tar.gz<br />
$ cd libvorbis-1.3.3<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====WebP=====<br />
<br />
You do not need to compile WebP by hand; Google provides binaries for Mac OS X available from their [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0-mac-10.5.tar.gz project page]. You will need version 0.2.0 or newer.<br />
<br />
Once downloaded, you must still install the header files and the binary:<br />
<br />
$ curl https://webp.googlecode.com/files/libwebp-0.2.0-mac-10.5.tar.gz > libwebp-0.2.0-mac-10.5.tar.gz<br />
$ tar xvzf libwebp-0.2.0-mac-10.5.tar.gz<br />
$ cd libwebp-0.2.0-mac-10.5<br />
$ sudo cp include/webp /usr/local/include<br />
$ sudo cp lib/libwebp.a /usr/local/lib<br />
<br />
===Configuring with CMake===<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 should be a different directory.<br />
# Hit "Configure". You will be prompted as to which generator you would like to use. If you have Xcode installed, choose that. Wait while the configuration process runs. You may have to set the following:<br />
## If CMake did not find your jpeg headers for some reason, set <code>JPEG_INCLUDE_DIR</code> to <code>/path/to/Unvanquished/src/libs/jpeg</code>.<br />
## Check <code>USE_INTERNAL_CRYPTO</code> to avoid having to compile nettle and hogweed.<br />
## Check <code>USE_INTERNAL_SPEEX</code> to avoid having to compile Speex.<br />
## Uncheck <code>USE_CIN_THEORA</code> and <code>USE_CIN_XVID</code> to avoid having to compile Theora or Xvid. (At present, there are not cutscenes or any such that require it.)<br />
## '''You will probably not be able to compile with the GLSL optimizer enabled; uncheck <code>USE_GLSL_OPTIMIZER</code>'''<br />
## If you have selected to generate Xcode project files, make the <code>SDLMAIN_LIBRARY</code> field blank. This option is not available if you have the generator set to Unix makefiles.<br />
# Hit "Generate".<br />
# You may now close Xcode.<br />
<br />
===Compiling===<br />
<br />
====With Xcode====<br />
<br />
<ol><br />
<li>Compilation will fail unless you manually create certain directories needed by the build scripts:<br />
<pre><br />
$ cd /path/to/build/dir/CMakeFiles<br />
$ mkdir gpp{game,trem,ui}-qvm.dir<br />
</pre><br />
This is a workaround to {{Issue|101}}.<br />
</li><br />
<li>Either start Xcode and open the project file (in the build directory you specified) or double-click the project file in Finder.</li><br />
<li>Open the project file created by CMake, which should be in the build directory you specified.</li><br />
<li>Change the active target to "ALL_BUILD" and click Product&rarr;Build.</li><br />
</ol><br />
<br />
====With Unix Makefiles====<br />
<br />
<ul><br />
<li>Start Terminal (Applications &rarr; Utilities &rarr; Terminal).</li><br />
<li>Input the following commands:<br />
<pre><br />
$ cd /path/to/Unvanquished-build<br />
$ make<br />
</pre><br />
If you are on a multi-core or multi-processor machine, you may speed up the process by passing the <code>-j</code> argument followed by the number of available cores to <code>make</code>; e.g., <code>make -j4</code>. Note that doing so makes reading error messages more difficult, as multiple instances of the compiler will print to the screen at once, causing information to appear out of order.<br />
</li><br />
</ul><br />
<br />
===Testing the build===<br />
<br />
====With Xcode 4====<br />
<br />
To test the game, select the "client" scheme from the combo box on the toolbar, and click the run button or press {{Hotkey|MacCommand}}{{Hotkey|R}}.<br />
<br />
====With Unix Makefiles====<br />
<br />
After compiling, you'll have to place the data files in the <code>main</code> directory in your build directory. [[#Acquiring the Game Files|For download instructions, see below.]]<br />
<br />
Your file structure should look as follows:<br />
<br />
[[File:Build_dir_Mac_OS_X.png]]<br />
<br />
You may now start the application as such:<br />
<br />
$ ./daemon.i386<br />
<br />
Note that older machines will not support the new OpenGL 3 renderer, and must be started specifying the "vanilla" (aka "GL") renderer:<br />
<br />
$ ./daemon.i386 +set cl_renderer GL<br />
<br />
===Bundling the Application===<br />
<br />
====With CPack====<br />
<br />
CPack is able to create standalone bundles (as well as many other types of installers). However you must generate the files using Unix Makefiles instead of Xcode.<br />
<br />
$ cd /path/to/Unvanquished-build<br />
$ cpack -G Bundle<br />
<br />
Some warnings will be printed however these can be safely ignored. There should be a file called Unvanquished.dmg in the Unvanquished-build folder.<br />
<br />
====Manually====<br />
<br />
You'll find the Mac [http://macdylibbundler.sourceforge.net/ dynamic library bundler] to be quite useful (you must generate the files using Unix Makefiles instead of Xcode):<br />
<br />
$ curl -L http://sourceforge.net/projects/macdylibbundler/files/macdylibbundler/0.4.1/dylibbundler0.4.1.zip/download > \<br />
dylibbundler0.4.1.zip<br />
$ unzip dylibbundler0.4.1.zip<br />
$ cd dylibbundler<br />
$ make<br />
$ sudo make install<br />
<br />
Once you've done that, you can proceed to create the application bundle. Note that these steps assume that you have downloaded the data files to <code>main/</code> as shown above:<br />
<br />
<pre><br />
$ git=/path/to/Unvanquished-git-repo<br />
$ build=/path/to/Unvanquished-build-dir<br />
$ mkdir -pv Unvanquished.app/Contents/{libs,MacOS,Resources,Frameworks}<br />
$ cp -r $build/main Unvanquished.app/Contents/MacOS<br />
$ sips -s format tiff $git/debian/unvanquished.png --out temp.tiff<br />
$ tiff2icns temp.tiff Unvanquished.app/Contents/Resources/Unvanquished.icns<br />
$ rm temp.tiff<br />
$ cp $build/daemon{,ded}.i386 $build/*.dylib Unvanquished.app/Contents/MacOS<br />
$ cp -r /Library/Frameworks/SDL.framework Unvanquished.app/Contents/Frameworks<br />
$ install_name_tool -id \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/Frameworks/SDL.framework/Versions/A/SDL<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGLi386.dylib<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGL3i386.dylib<br />
$ for binary in Unvanquished.app/Contents/MacOS/*.{i386,dylib}; do<br />
dylibbundler -b -x $binary -d $dest/Unvanquished.app/Contents/libs/; done<br />
$ cp /usr/lib/libGLEW.1.7.0.dylib ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ chmod +w ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -id @executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -change /usr/lib/libGLEW.1.7.0.dylib \<br />
@executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ cat > Unvanquished.app/Contents/Info.plist<br />
<?xml version="1.0" encoding="UTF-8"?><br />
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"<br />
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"><br />
<plist version="1.0"><br />
<dict><br />
<key>CFBundleName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleDisplayName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleExecutable</key><br />
<string>daemon.i386</string><br />
<key>CFBundleIconFile</key><br />
<string>Unvanquished.icns</string><br />
<key>CFBundleIdentifier</key><br />
<string>net.Unvanquished</string><br />
<key>CFBundleInfoDictionaryVersion</key><br />
<string>6.0</string><br />
<key>CFBundlePackageType</key><br />
<string>APPL</string><br />
<key>CFBundleShortVersionString</key><br />
<string>0.4.0</string><br />
<key>CFBundleVersion</key><br />
<string>0.4.0</string><br />
</dict><br />
</plist><br />
^d<br />
</pre><br />
<br />
Note: <code>^d</code> indicates pressing {{Hotkey|Ctrl}}{{Hotkey|D}} on the keyboard.<br />
<br />
The contents of the completed application bundle should look like this:<br />
<br />
[[File:Bundle_dir_Mac_OS_X.png]]<br />
<br />
'''Note''': If you compiled SDL from source, you will not see a directory titled <code>SDL.framework</code>.<br />
<br />
==Windows==<br />
<br />
===Visual Studio===<br />
<br />
CMake can generate Visual Studio projects for unvanquished however this feature is relatively new and may have some bugs.<br />
<br />
Steps:<br />
<br />
# Double click on Visual_Studio32.bat<br />
# Open build-32/Daemon.sln in Visual Studio 2010.<br />
# In the two text boxes in the toolbar, select "Release" or "Debug" in the first one and Win32 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 />
====Important Notes====<br />
<br />
* LLVM is disabled and does not work correctly with CMake generated Visual Studio projects.<br />
* ncurses is not supported under Visual Studio.<br />
* The path to the build folder must not have any spaces otherwise generation of QVMs will fail. See [https://github.com/Unvanquished/Unvanquished/issues/102 issue 102]<br />
* Due to limitations with cmake neither the startup project nor the working directory can be specified. These must be manually set to the following values for debugging the client under Visual Studio<br />
** Right click on client and select "Set as StartUp project".<br />
** Right click on client, select properties, select Debugging and set "Working Directory" to $(TargetPath)\..<br />
<br />
===MinGW===<br />
<br />
Unvanquished is supported under MinGW. The build process should be fairly similar to the Linux instructions.<br />
<br />
Note:<br />
<br />
* The easiest way to acquire and install MinGW is with the graphical [http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/ mingw-get-inst installer]. <!-- TODO: maybe walk the user through the installer? --><br />
* When configuring the build with CMake, you will find that you will have to set a number of libraries manually. You can find precompiled DLLs for most of the dependencies; those that are not pre-compiled can be built with the corresponding <code>USE_INTERNAL_</code> setting.<br />
* On Windows, SDL requires that the Direct X SDK can be installed. You may download the June 2010 release from [http://www.microsoft.com/en-us/download/details.aspx?id=6812 Microsoft's site].<br />
* '''The build will fail during QVM compilation if your source or build directories contain spaces.''' This is due to a bug with lcc. If your home directory contains a space, you may want to create source and build directories at the root of one of your drives (e.g., <code>C:\Unvanquished\Source</code> and <code>C:\Unvanquished\Build</code>.)<br />
<br />
The easiest way to get a build up (at the time of writing) is as follows:<br />
<br />
{{Note|content=Although there are 64-bit binaries of most of the libraries required to build the game, these do not work with MinGW at present, so the following instructions all use the 32-bit binaries.}}<br />
<br />
<ol><br />
<li>Although there are binaries of gmp distributed with the source, they have are dependent on Visual Studio's implementations of <code>_ftol2_sse</code> and <code>_alloca_probe_16</code>. A fix may be found on [http://stackoverflow.com/questions/6753111/static-linking-with-openssl Stack Exchange], but requires that Visual Studio be installed, which defeats the purpose of attempting to use MinGW to compile the source. You can build gmp yourself:<br />
<ol><br />
<li>Download and extract the latest version of the [http://gmplib.org/ GNU MP Bignum Library (GMP)]. (You will need either cygwin with tar and bz2 installed or 7-zip to extract the archive.)</li><br />
<li>Install the following Cygwin packages if you have not already:<br />
* binutils<br />
* gcc<br />
* gcc-g++<br />
* m4<br />
* make<br />
</li><br />
<li>As part of the GMP compilation process, a file called <code>gen-fib.c</code> generates a table of numbers in the Fibonacci sequence. The generated file does not play nicely with Cygwin or MinGW, so you must fix it. Edit <code>gen-fib.c</code>, and at around line 100, change these lines<br />
<pre><br />
for (i = 0; i < fnum; i++)<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
printf ("), /* %d */\n", i-1);<br />
}<br />
printf ("};\n");<br />
</pre><br />
to look like this:<br />
<pre><br />
for (i = 0; i < fnum; i++)<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
printf (")%c /* %d */\n", (i == (fnum-1)) ? ' ' : ',', i-1);<br />
}<br />
printf ("};\n");<br />
</pre><br />
The patch file looks like this:<br />
<pre><br />
@@ -100,7 +100,7 @@<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
- printf ("), /* %d */\n", i-1);<br />
+ printf (")%c /* %d */\n", (i == (fnum-1)) ? ' ' : ',', i-1);<br />
}<br />
printf ("};\n");<br />
}<br />
</pre><br />
</li><br />
<li>Compiling with MinGW does not work, so you will need to compile with Cygwin. At the prompt:<br />
<pre><br />
$ ./configure --disable-static --enable-shared<br />
$ make<br />
</pre><br />
The <code>--disable-static</code> and <code>--enable-shared</code> flags configure GMP to build a DLL instead of a static library. You may optionally perform <code>make install</code>. Additional compilation instructions [http://www.cs.nyu.edu/exact/core/gmp/ are available].<br />
<p>If you experience difficulties with compilation and it appears that MinGW gcc is being detected by <code>configure</code> and not Cygwin gcc, you can try editing your <code>PATH</code> variable:</p><br />
<pre><br />
$ export PATH=`echo $PATH | sed "s|/cygdrive/c/MinGW/bin:||"`<br />
</pre><br />
Re-run <code>configure</code> and <code>make</code> afterwards.<br />
</ol><br />
</li><br />
<li>Set the following CMake flags:<br />
{| class="wikitable"<br />
! Setting<br />
! Description<br />
! Type<br />
! Value<br />
|-<br />
| <code>USE_INTERNAL_CRYPTO</code><br />
| Use the provided copies of crypto libraries. <!-- FIXME: I think these are nettle and something else --><br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_GLEW</code><br />
| Use the provided copy of GLEW.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_JPEG</code><br />
| Use the provided copy of JPEG.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SDL</code><br />
| Use the provided copy of SDL.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SPEEX</code><br />
| Use the provided copy of Speex.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_WEBP</code><br />
| Use the provided copy of WebP.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_CURSES</code><br />
| Enables/disables curses.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>PNG_LIBRARY</code><br />
| Path to the PNG library DLL.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng/libs/win32/libpng.lib</code><br />
|-<br />
| <code>PNG_PNG_INCLUDE_DIR</code><br />
| Path to the PNG library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng</code><br />
|-<br />
| <code>FREETYPE_LIBRARY</code><br />
| Path to the compiled FreeType library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/lib/freetype.lib</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_freetype2</code><br />
| Path to the FreeType library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/freetype2</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_ft2build</code><br />
| Path to the FreeType library file "ftbuild.h".<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/</code><br />
|-<br />
| <code>GMP_INCLUDE_DIR</code><br />
| Path to the GMP library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/gmp/include</code><br />
|-<br />
| <code>GMP_LIBRARY</code><br />
| Path to the GMP library.<br />
| <code>FILEPATH</code><br />
| <code><var>path/to/compiled/gmp/</var>.libs/cyggmp-10.dll</code><br />
|-<br />
| <code>ZLIB_INCLUDE_DIR</code><br />
| Path to the zlib library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/include</code><br />
|-<br />
| <code>ZLIB_LIBRARY</code><br />
| Path to the zlib library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/lib/x32/zlib1.dll</code><br />
|-<br />
| <code>CURL_LIBRARY</code><br />
| Path to the CURL library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/lib/win32/release/libcurl.dll</code><br />
|-<br />
| <code>CURL_INCLUDE_DIR</code><br />
| Path to the zlib library.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/include/curl</code><br />
|-<br />
| <code>USE_OPENAL</code><br />
| Enables/disables OpenAL support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_THEORA</code><br />
| Enables/disables Theora support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_XVID</code><br />
| Enables/disables Xvid support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CODEC_THEORA</code><br />
| Enables/disables Ogg support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>SDLMAIN_LIBRARY</code><br />
| Enables/disables Ogg support.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code><br />
|-<br />
|}<br />
Do note that CMake is slash-direction&ndash;agnostic; it can handle both forward- and backslashes on Windows.<br />
</li><br />
<li>Open <code><var>SourcePath</var>/CMakeLists.txt</code> and edit the line<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi z )<br />
</pre><br />
(around line 1040) to look like this:<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi )<br />
</pre><br />
Also edit around line 1700:<br />
<pre><br />
###########################<br />
#Configure Download Script#<br />
###########################<br />
<br />
if( NOT MSVC )<br />
</pre><br />
to look like this:<br />
<pre><br />
###########################<br />
#Configure Download Script#<br />
###########################<br />
<br />
if( NOT WIN32 )<br />
<pre><br />
</li><br />
<li>Open <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code> and edit the lines:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "SDL.h"<br />
#include "SDL_main.h"<br />
</pre><br />
to look like:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "../../../include/SDL.h"<br />
#include "../../../include/SDL_main.h"<br />
</pre><br />
<li>Open a terminal and <code>cd</code> to your source directory.</li><br />
<li>Run <code>make</code>:<br />
<pre><br />
> mingw32-make<br />
</pre><br />
If you would like verbose output, set the <code>VERBOSE</code> environment variable before running <code>make</code>.<br />
<pre><br />
> set VERBOSE=1<br />
</pre><br />
To make it easier to build the source, you can create a batch file (call it something like <code>compile.bat</code>) and place it in your build directory:<br />
<pre><br />
@echo off<br />
<br />
set RETURN=compile<br />
<br />
:get_time<br />
:: Thank you, Rob van der Woude:<br />
:: (http://www.robvanderwoude.com/datetimentparse.php)<br />
FOR /F "tokens=1,2,3 delims=:." %%A IN ("%Time%") DO (<br />
SET /A HOURS = 100%%A %% 100<br />
SET /A MINUTES = 100%%B %% 100<br />
SET /A SECONDS = 100%%C %% 100<br />
)<br />
SET /A TICKS=( %HOURS% * 3600 ) + ( %MINUTES% * 60 ) + %SECONDS%<br />
GOTO %RETURN%<br />
<br />
:compile<br />
SET START_TICKS=%TICKS%<br />
<br />
SET VERBOSE=1<br />
:: mingw32-make clean<br />
mingw32-make -j4<br />
<br />
set RETURN=finish<br />
GOTO get_time<br />
<br />
:finish<br />
SET /A COMPILE_TIME=%TICKS% - %START_TICKS%<br />
SET /A MINUTES=%COMPILE_TIME% / 60<br />
SET /A SECONDS=%COMPILE_TIME% % 60<br />
ECHO.<br />
ECHO Compilation took %MINUTES%m %SECONDS%s.<br />
PAUSE<br />
</pre><br />
</li><br />
</ol><br />
<br />
====Notes====<br />
<br />
* If you would like to use curses, try using [http://sourceforge.net/projects/pdcurses/files/pdcurses PDCurses].<br />
<br />
===QtCreator===<br />
<br />
# Install MinGW and follow the above instructions, except select Code::Blocks as the generator.<br />
# Start QtCreator, and select "Open File or Project&hellip;" from the File menu.<br />
# Navigate to your source directory and open CMakeLists.txt.<br />
# At the CMake Wizard, select the same build directory you already configured using CMake. (If you did not chose Code::Blocks as the generator, you will have to start over again, as QtCreator requires a Code::Blocks project file in order to compile the source.)<br />
# Ensure that a generator is selected in the combo box, and click "Run CMake". If there is no generator listed, see the [[#Troubleshooting|troubleshooting]] section below.<br />
# Click "Finish" to close the wizard.<br />
<br />
You should now be able to compile, run, and debug the code using QtCreator.<br />
<br />
====Troubleshooting====<br />
<br />
If at the "Run CMake" prompt of the the CMake Wizard, select "Run CMake" and are warned that no generator was selected, and notice that there are no generators in the combo box, you will likely have to [http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html manually configure your toolchain]. Select "Options&hellip;" from the "Tools" menu, then navigate to "Build &amp; Run".<br />
<br />
At the options window,<br />
* Go to the "Kits" tab, and mouse over the "Desktop (default)" kit under "Manual". If there were any errors in configuring this kit, they will be displayed in the tool tip. If there are problems, select the kit. You may need to manually specify the location of the MinGW debugger, for example, which is typically <code>C:\MinGW\bin\gdb.exe</code>.<br />
* Go to the "Compilers" tab, and ensure that MinGW is present. If not, you will need to add it manually.<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 />
libgmp3-dev libjpeg8-dev libncurses5-dev libogg-dev libopenal-dev \<br />
libpng12-dev libsdl1.2-dev libvorbis-dev zlib1g-dev nettle-dev \<br />
libwebp-dev libspeexdsp-dev libtheora-dev<br />
<br />
If the version of WebP supplied by your version of Debian or Ubuntu is older than v0.2.0, you will need to [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0.tar.gz download] and [https://developers.google.com/speed/webp/docs/compiling#unix compile it from source]. After compiling and installing with <code>sudo make install</code>, in CMake, you'll need to set <code>WEBP_INCLUDE_DIR</code> to <code>/usr/local/include/webp</code> and <code>WEBP_LIBRARY</code> to <code>/usr/local/lib/libwebp.so</code>.<br />
<br />
'''We currently provide a ready-to-use libwebp-dev in our [http://{{SERVERNAME}}/index.php/Download#ubuntu Debian and Ubuntu repositories], alongside .debs of the game and server.'''<br />
<br />
Actual dev package names may vary, e.g. libgmp-dev instead of libgmp3-dev and libglew-dev or libglew1.7-dev instead of libglew1.5-dev.<br />
<br />
Since we have a debian directory in the source, you can also to check what's needed then install the listed packages (choosing from alternatives as needed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ dpkg-checkbuilddeps<br />
…<br />
$ sudo apt-get install <var>package(s)</var><br />
<br />
If dpkg-checkbuilddeps produces no output, you have all necessary build dependencies. Also, debhelper's only needed if you're building .debs.<br />
<br />
====Gentoo====<br />
<br />
$ emerge curl freetype glew gmp jpeg ncurses libogg openal libpng libsdl libvorbis zlib<br />
<br />
====openSUSE====<br />
<br />
$ sudo install zypper gcc gcc-c++ Mesa-libGL-devel SDL-devel libjpeg8-devel \<br />
libpng12-devel glew-devel webp-devel ncurses-devel gmp-devel libcurl-devel \<br />
libnettle-devel openal-soft-devel speex-devel libvorbis-devel \<br />
libtheora-devel<br />
<br />
The latest version of WebP must be installed manually:<br />
<br />
$ wget https://webp.googlecode.com/files/libwebp-0.2.1.tar.gz<br />
$ tar xvzf libwebp-0.2.1.tar.gz<br />
$ cd libwebp-0.2.1<br />
$ ./configure && make<br />
$ sudo make install<br />
<br />
You must disable curses (set <code>USE_CURSES</code> appropriately in CMake) as failing to do so will cause Unvanquished to crash on startup.<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 />
On Debian or 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 />
Or, in Debian or Ubuntu, you can build a package (but you'll need to have devscripts and fakeroot installed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ fakeroot dpkg-buildpackage -b -uc<br />
$ sudo dpkg -i <var>../unvanquished_*.deb</var><br />
<br />
Once in <code>ccmake</code>, use the following keys:<br />
<br />
* Press {{Hotkey|c}} to configure. If an error occurs during this phase, make note of it and press {{Hotkey|e}} to dismiss it.<br />
* Use the up and down arrow keys to navigate the compilation options.<br />
* Press {{Hotkey|Enter}} to enable or disable boolean options (i.e., on/off) or to edit textual options.<br />
** Press {{Hotkey|Esc}} when editing a textual option to cancel the change.<br />
<br />
Once you have finished the configuration process, press {{Hotkey|C}} again, then {{Hotkey|G}} 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=====<br />
<br />
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_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 />
* <code>USE_CIN_THEORA</code> &mdash; Disabling this prevents videos from being recorded in Theora.<br />
* <code>USE_CIN_XVID</code> &mdash; Disabling this prevents videos from being recorded in Xvid.<br />
* <code>USE_VOIP</code> &mdash; Disabling this removes VOIP support. Alternatively enabling <code>USE_INTERNAL_SPEEX</code> will use the libraries distributed with Unvanquished for VoIP<br />
* <code>USE_INTERNAL_CRYPTO</code> &mdash; Enable this to use the crypto libraries provided by Unvanquished.<br />
<br />
===Compiling===<br />
<br />
$ cd <var>path/to/unvanquished/build</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 />
===Acquiring mandatory game files===<br />
<br />
The game files are not in the Git repository, and must be downloaded separately. This may be done on the command line or from your web browser. The downloads may be found on [http://sourceforge.net/projects/unvanquished/files/Assets SourceForge.net]. If you download the files from your browser, just download the files named "pak*.pk3", and save them to the [[Running_the_game#Data_locations|data location]] for your system.<br />
<br />
On Linux, this may be done as follows:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
wget -O $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On FreeBSD, using the <code>sh</code> shell:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
fetch -r -o $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On Mac OS X:<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
curl -L "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download" > $file<br />
fi<br />
done<br />
<br />
Linux users may also use the <code>download-pk3.sh</code> script that is distributed with the source code, which requires that curl be installed:<br />
<br />
$ cd <var>[path to Unvanquished source code]</var><br />
$ mkdir -p ~/.Unvanquished/main<br />
$ ./download-pk3.sh ~/.Unvanquished/main<br />
<br />
===Downloading the map pack===<br />
<br />
The map pack exists only for convenience; if you do not download the map pack, Unvanquished will automatically download maps as needed when you attempt to play online.<br />
<br />
To download the map pack on Linux:<br />
<br />
$ wget -O maps.7z "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z"; done<br />
<br />
To download the map pack on Mac OS X:<br />
<br />
$ curl -L "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z" > maps.7z; done<br />
<br />
Note that you will need to unzip the map pack on either system as it is compressed with LZMA. Mac users can use the [http://wakaba.c3.cx/s/apps/unarchiver.html Unarchiver]. Uncompressing the archive on Linux is highly dependent on your distribution.<br />
<br />
===Verifying the Files===<br />
<br />
Download the latest [http://sourceforge.net/projects/unvanquished/files/Assets/{{CurrentVersion|MD5HashFile}} MD5 hash file] and save it to your system's [[Running_the_game#Data_directory|data location]].<br />
<br />
On systems with the <code>md5</code> command (Mac OS X):<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ cat {{CurrentVersion|MD5HashFile}} | while read line; do<br />
file="`echo "$line" | sed -E "s/^[a-fA-F0-9]+ +\*?//"`"<br />
if [ -e "$file" ]; then<br />
if [ `md5 -r "$file" | cut -d\ -f1` = "`echo "$line" | cut -d\ -f1`" ]<br />
then echo "File \"$file\" appears okay."<br />
else echo "File \"$file\" is corrupt"'!' >&2<br />
fi; fi; done<br />
<br />
On systems with the <code>md5sum</code> command (most Linux distributions):<br />
<br />
$ cd <var>[[Running_the_game#Data_directory|/path/to/data/files]]</var><br />
$ md5sum -c {{CurrentVersion|MD5HashFile}} 2>&1 | grep -v "open or read\|file or directory"<br />
<br />
The <code>grep</code> invocation is used to strip output complaining about missing files.<br />
<br />
Any files that are found to be corrupt should be replaced; just download a [http://sourceforge.net/projects/unvanquished/files/Assets new copy] of the affected file(s).<br />
<br />
==Errors==<br />
<br />
===CMake cannot locate Newton===<br />
<br />
If CMake cannot find Newton, you'll need to set it up yourself.<br />
<br />
It should be in <code><var>/path/to/Unvanquished</var>/src/libs/libnewton/libs/<var>your_os</var>/libNewton.so</code>.<br />
Be sure to replace <var>your_os</var> with the proper directory name.<br />
<br />
Use CMake as before to change the <code>NEWTON_LIBRARY</code> build setting to the said path:<br />
<br />
# Start the CMake configurator:<pre>$ ccmake ..</pre><br />
# Scroll down and highlight <code>NEWTON_LIBRARY</code>.<br />
# Press {{Hotkey|Enter}} to begin editing and input in the path.<br />
# Press {{Hotkey|C}} to configure and {{Hotkey|G}} to generate the new makefiles.<br />
# Press {{Hotkey|Q}} to quit.<br />
# Recompile the source:<pre>$ make</pre><br />
<br />
===The C Compiler is not able to compile a simple test program===<br />
<br />
When attempting to generate a solution for Xcode CMake fails with the following error<br />
-- Check for working C compiler using: Xcode -- broken<br />
CMake Error at /Applications/CMake 2.8-8.app/Contents/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):<br />
The C compiler "/usr/bin/gcc" is not able to compile a simple test program.<br />
<br />
It fails with the following output:<br />
<br />
Change Dir: /Users/danielmaloney/Documents/Unvanquished/build-xcode/CMakeFiles/CMakeTmp<br />
<br />
<br />
<br />
Run Build Command:/Applications/CMake\ 2.8-8.app/Contents/bin/cmakexbuild<br />
-project CMAKE_TRY_COMPILE.xcodeproj build -target<br />
cmTryCompileExec1400153232 -configuration Debug<br />
<br />
Error: No developer directory found at /Developer. Run<br />
/usr/bin/xcode-select to update the developer directory path.<br />
<br />
<br />
<br />
<br />
<br />
CMake will not be able to correctly generate this project.<br />
Call Stack (most recent call first):<br />
CMakeLists.txt:19 (project)<br />
<br />
This is due to Xcode 4.3 having a different directory structure to previous versions. Simply running the following command will correct this error:<br />
sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer/</div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Compiling_the_source&diff=1955Compiling the source2013-04-14T17:34:12Z<p>Velociostrich: /* MinGW */ Make note of the fact that the build will fail if there are spaces in the build dir names and add a build script</p>
<hr />
<div>==Mac OS X==<br />
<br />
First, you need to [[Getting_the_source|acquire the source code]].<br />
<br />
Regardless of what interface you may use to compile the source, you will need [http://www.cmake.org/cmake/resources/software.html CMake] to generate makefiles. You will also need to install [https://developer.apple.com/xcode/ Xcode] (making sure to choose to install the command-line utilities when prompted by the installer).<br />
<br />
Then, you will need to acquire (and in some cases, manually compile) at a minimum the [[#Dependencies|necessary libraries]].<br />
<br />
Once you have the source code and the libraries installed, you may actually proceed to compile the source. You have several options:<br />
* '''Compile the source at the command line'''. This is the easiest if you would just like to compile the game to use yourself and you do not intend to work on the code.<br />
* '''Compile the source using an IDE'''. This is preferred if you intend on developing the source.<br />
** Xcode is Apple's flagship IDE and you should have installed to compile the source regardless of which method you use.<br />
** [http://qt-project.org/downloads QtCreator] is cross-platform and provides real-time feedback of syntax errors, a Vim mode, as well as other features.<br />
** [http://www.codeblocks.org/ Code::Blcoks] is also cross-platform but lacks some of the features of Xcode and QtCreator.<br />
<br />
===Dependencies===<br />
<br />
You only need to use one of the following methods (HomeBrew or compiling by hand). Please try and avoid mixing methods as this may produce unexpected results.<br />
<br />
Unvanquished requires the following libraries:<br />
* [[#JPEG|JPEG]], version 8 or higher. (Version 6 was known to have problems)<br />
* [[#Simple_DirectMedia_Layer_.28SDL.29|Simple DirectMedia Layer]] (The binary provided by libsdl.org causes graphical corruptions. Compile from source or use homebrew/macports)<br />
* [[#The_OpenGL_Extension_Wrangler_Library_.28GLEW.29|The OpenGL Extension Wrangler Library]]<br />
* CuRL<br />
* [[#The_GNU_MP_Bignum_Library_.28libgmp.29|GMP]]<br />
* [[#WebP|WebP]] (v0.2.0 or newer)<br />
<br />
The following libraries are optional:<br />
* Theora<br />
* Speex<br />
* [[#Ogg|Ogg]]<br />
* [[#Vorbis|Vorbis]]<br />
<br />
====HomeBrew====<br />
Install [http://mxcl.github.com/homebrew/ HomeBrew] and then run the following command<br />
<br />
$ brew install nettle libjpeg curl sdl webp xvid gmp glew speex libvorbis theora<br />
<br />
All the necessary libraries should now have been installed.<br />
<br />
====Compiling by hand====<br />
The following are shell scripts that download, compile, and install various libraries. This is more time consuming then other methods but might be useful if you need more control over your libraries<br />
<br />
=====JPEG=====<br />
<br />
$ curl http://www.ijg.org/files/jpegsrc.v8d.tar.gz > jpegsrc.v8d.tar.gz<br />
$ tar xvzf jpegsrc.v8d.tar.gz<br />
$ cd jpeg-8d<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The OpenGL Extension Wrangler Library (GLEW)=====<br />
<br />
$ curl -L https://sourceforge.net/projects/glew/files/glew/1.7.0/glew-1.7.0.tgz/download > glew-1.7.0.tgz<br />
$ tar xvzf glew-1.7.0.tgz<br />
$ cd glew-1.7.0<br />
$ make<br />
$ sudo make install<br />
<br />
=====Simple DirectMedia Layer (SDL)=====<br />
<br />
Do not use the binaries provided by libsdl.org, as these are known to cause issues with gamma and color display. Instead, compile your own:<br />
<br />
$ curl http://www.libsdl.org/release/SDL-1.2.15.tar.gz > SDL-1.2.15.tar.gz<br />
$ tar xvzf SDL-1.2.15.tar.gz<br />
$ cd SDL-1.2.15<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The GNU MP Bignum Library (libgmp)=====<br />
<br />
$ curl ftp://ftp.gmplib.org/pub/gmp-5.0.5/gmp-5.0.5.tar.bz2 > gmp-5.0.5.tar.bz2<br />
$ tar xvjf gmp-5.0.5.tar.bz2<br />
$ cd gmp-5.0.5<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Ogg=====<br />
<br />
$ curl http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz > libogg-1.3.0.tar.gz<br />
$ tar xvzf libogg-1.3.0.tar.gz<br />
$ cd libogg-1.3.0<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Vorbis=====<br />
<br />
$ curl http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz > libvorbis-1.3.3.tar.gz<br />
$ tar xvzf libvorbis-1.3.3.tar.gz<br />
$ cd libvorbis-1.3.3<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====WebP=====<br />
<br />
You do not need to compile WebP by hand; Google provides binaries for Mac OS X available from their [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0-mac-10.5.tar.gz project page]. You will need version 0.2.0 or newer.<br />
<br />
Once downloaded, you must still install the header files and the binary:<br />
<br />
$ curl https://webp.googlecode.com/files/libwebp-0.2.0-mac-10.5.tar.gz > libwebp-0.2.0-mac-10.5.tar.gz<br />
$ tar xvzf libwebp-0.2.0-mac-10.5.tar.gz<br />
$ cd libwebp-0.2.0-mac-10.5<br />
$ sudo cp include/webp /usr/local/include<br />
$ sudo cp lib/libwebp.a /usr/local/lib<br />
<br />
===Configuring with CMake===<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 should be a different directory.<br />
# Hit "Configure". You will be prompted as to which generator you would like to use. If you have Xcode installed, choose that. Wait while the configuration process runs. You may have to set the following:<br />
## If CMake did not find your jpeg headers for some reason, set <code>JPEG_INCLUDE_DIR</code> to <code>/path/to/Unvanquished/src/libs/jpeg</code>.<br />
## Check <code>USE_INTERNAL_CRYPTO</code> to avoid having to compile nettle and hogweed.<br />
## Check <code>USE_INTERNAL_SPEEX</code> to avoid having to compile Speex.<br />
## Uncheck <code>USE_CIN_THEORA</code> and <code>USE_CIN_XVID</code> to avoid having to compile Theora or Xvid. (At present, there are not cutscenes or any such that require it.)<br />
## '''You will probably not be able to compile with the GLSL optimizer enabled; uncheck <code>USE_GLSL_OPTIMIZER</code>'''<br />
## If you have selected to generate Xcode project files, make the <code>SDLMAIN_LIBRARY</code> field blank. This option is not available if you have the generator set to Unix makefiles.<br />
# Hit "Generate".<br />
# You may now close Xcode.<br />
<br />
===Compiling===<br />
<br />
====With Xcode====<br />
<br />
<ol><br />
<li>Compilation will fail unless you manually create certain directories needed by the build scripts:<br />
<pre><br />
$ cd /path/to/build/dir/CMakeFiles<br />
$ mkdir gpp{game,trem,ui}-qvm.dir<br />
</pre><br />
This is a workaround to {{Issue|101}}.<br />
</li><br />
<li>Either start Xcode and open the project file (in the build directory you specified) or double-click the project file in Finder.</li><br />
<li>Open the project file created by CMake, which should be in the build directory you specified.</li><br />
<li>Change the active target to "ALL_BUILD" and click Product&rarr;Build.</li><br />
</ol><br />
<br />
====With Unix Makefiles====<br />
<br />
<ul><br />
<li>Start Terminal (Applications &rarr; Utilities &rarr; Terminal).</li><br />
<li>Input the following commands:<br />
<pre><br />
$ cd /path/to/Unvanquished-build<br />
$ make<br />
</pre><br />
If you are on a multi-core or multi-processor machine, you may speed up the process by passing the <code>-j</code> argument followed by the number of available cores to <code>make</code>; e.g., <code>make -j4</code>. Note that doing so makes reading error messages more difficult, as multiple instances of the compiler will print to the screen at once, causing information to appear out of order.<br />
</li><br />
</ul><br />
<br />
===Testing the build===<br />
<br />
====With Xcode 4====<br />
<br />
To test the game, select the "client" scheme from the combo box on the toolbar, and click the run button or press {{Hotkey|MacCommand}}{{Hotkey|R}}.<br />
<br />
====With Unix Makefiles====<br />
<br />
After compiling, you'll have to place the data files in the <code>main</code> directory in your build directory. [[#Acquiring the Game Files|For download instructions, see below.]]<br />
<br />
Your file structure should look as follows:<br />
<br />
[[File:Build_dir_Mac_OS_X.png]]<br />
<br />
You may now start the application as such:<br />
<br />
$ ./daemon.i386<br />
<br />
Note that older machines will not support the new OpenGL 3 renderer, and must be started specifying the "vanilla" (aka "GL") renderer:<br />
<br />
$ ./daemon.i386 +set cl_renderer GL<br />
<br />
===Bundling the Application===<br />
<br />
====With CPack====<br />
<br />
CPack is able to create standalone bundles (as well as many other types of installers). However you must generate the files using Unix Makefiles instead of Xcode.<br />
<br />
$ cd /path/to/Unvanquished-build<br />
$ cpack -G Bundle<br />
<br />
Some warnings will be printed however these can be safely ignored. There should be a file called Unvanquished.dmg in the Unvanquished-build folder.<br />
<br />
====Manually====<br />
<br />
You'll find the Mac [http://macdylibbundler.sourceforge.net/ dynamic library bundler] to be quite useful (you must generate the files using Unix Makefiles instead of Xcode):<br />
<br />
$ curl -L http://sourceforge.net/projects/macdylibbundler/files/macdylibbundler/0.4.1/dylibbundler0.4.1.zip/download > \<br />
dylibbundler0.4.1.zip<br />
$ unzip dylibbundler0.4.1.zip<br />
$ cd dylibbundler<br />
$ make<br />
$ sudo make install<br />
<br />
Once you've done that, you can proceed to create the application bundle. Note that these steps assume that you have downloaded the data files to <code>main/</code> as shown above:<br />
<br />
<pre><br />
$ git=/path/to/Unvanquished-git-repo<br />
$ build=/path/to/Unvanquished-build-dir<br />
$ mkdir -pv Unvanquished.app/Contents/{libs,MacOS,Resources,Frameworks}<br />
$ cp -r $build/main Unvanquished.app/Contents/MacOS<br />
$ sips -s format tiff $git/debian/unvanquished.png --out temp.tiff<br />
$ tiff2icns temp.tiff Unvanquished.app/Contents/Resources/Unvanquished.icns<br />
$ rm temp.tiff<br />
$ cp $build/daemon{,ded}.i386 $build/*.dylib Unvanquished.app/Contents/MacOS<br />
$ cp -r /Library/Frameworks/SDL.framework Unvanquished.app/Contents/Frameworks<br />
$ install_name_tool -id \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/Frameworks/SDL.framework/Versions/A/SDL<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGLi386.dylib<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGL3i386.dylib<br />
$ for binary in Unvanquished.app/Contents/MacOS/*.{i386,dylib}; do<br />
dylibbundler -b -x $binary -d $dest/Unvanquished.app/Contents/libs/; done<br />
$ cp /usr/lib/libGLEW.1.7.0.dylib ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ chmod +w ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -id @executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -change /usr/lib/libGLEW.1.7.0.dylib \<br />
@executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ cat > Unvanquished.app/Contents/Info.plist<br />
<?xml version="1.0" encoding="UTF-8"?><br />
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"<br />
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"><br />
<plist version="1.0"><br />
<dict><br />
<key>CFBundleName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleDisplayName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleExecutable</key><br />
<string>daemon.i386</string><br />
<key>CFBundleIconFile</key><br />
<string>Unvanquished.icns</string><br />
<key>CFBundleIdentifier</key><br />
<string>net.Unvanquished</string><br />
<key>CFBundleInfoDictionaryVersion</key><br />
<string>6.0</string><br />
<key>CFBundlePackageType</key><br />
<string>APPL</string><br />
<key>CFBundleShortVersionString</key><br />
<string>0.4.0</string><br />
<key>CFBundleVersion</key><br />
<string>0.4.0</string><br />
</dict><br />
</plist><br />
^d<br />
</pre><br />
<br />
Note: <code>^d</code> indicates pressing {{Hotkey|Ctrl}}{{Hotkey|D}} on the keyboard.<br />
<br />
The contents of the completed application bundle should look like this:<br />
<br />
[[File:Bundle_dir_Mac_OS_X.png]]<br />
<br />
'''Note''': If you compiled SDL from source, you will not see a directory titled <code>SDL.framework</code>.<br />
<br />
==Windows==<br />
<br />
===Visual Studio===<br />
<br />
CMake can generate Visual Studio projects for unvanquished however this feature is relatively new and may have some bugs.<br />
<br />
Steps:<br />
<br />
# Double click on Visual_Studio32.bat<br />
# Open build-32/Daemon.sln in Visual Studio 2010.<br />
# In the two text boxes in the toolbar, select "Release" or "Debug" in the first one and Win32 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 />
====Important Notes====<br />
<br />
* LLVM is disabled and does not work correctly with CMake generated Visual Studio projects.<br />
* ncurses is not supported under Visual Studio.<br />
* The path to the build folder must not have any spaces otherwise generation of QVMs will fail. See [https://github.com/Unvanquished/Unvanquished/issues/102 issue 102]<br />
* Due to limitations with cmake neither the startup project nor the working directory can be specified. These must be manually set to the following values for debugging the client under Visual Studio<br />
** Right click on client and select "Set as StartUp project".<br />
** Right click on client, select properties, select Debugging and set "Working Directory" to $(TargetPath)\..<br />
<br />
===MinGW===<br />
<br />
Unvanquished is supported under MinGW. The build process should be fairly similar to the Linux instructions.<br />
<br />
Note:<br />
<br />
* The easiest way to acquire and install MinGW is with the graphical [http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/ mingw-get-inst installer]. <!-- TODO: maybe walk the user through the installer? --><br />
* When configuring the build with CMake, you will find that you will have to set a number of libraries manually. You can find precompiled DLLs for most of the dependencies; those that are not pre-compiled can be built with the corresponding <code>USE_INTERNAL_</code> setting.<br />
* On Windows, SDL requires that the Direct X SDK can be installed. You may download the June 2010 release from [http://www.microsoft.com/en-us/download/details.aspx?id=6812 Microsoft's site].<br />
* '''The build will fail during QVM compilation if your source or build directories contain spaces.''' This is due to a bug with lcc. If your home directory contains a space, you may want to create source and build directories at the root of one of your drives (e.g., <code>C:\Unvanquished\Source</code> and <code>C:\Unvanquished\Build</code>.)<br />
<br />
The easiest way to get a build up (at the time of writing) is as follows:<br />
<br />
{{Note|content=Be aware that some of these paths are for the 64 bit versions of libraries; if you are on a 32-bit system, you will need to change some of these paths. The easiest way to locate libraries is to navigate in Windows Explorer to the <code>src/libs</code> directory and search for files matching <code>dll</code>.}}<br />
<br />
<ol><br />
<li>Although there are binaries of gmp distributed with the source, they have are dependent on Visual Studio's implementations of <code>_ftol2_sse</code> and <code>_alloca_probe_16</code>. A fix may be found on [http://stackoverflow.com/questions/6753111/static-linking-with-openssl Stack Exchange], but requires that Visual Studio be installed, which defeats the purpose of attempting to use MinGW to compile the source. You can build gmp yourself:<br />
<ol><br />
<li>Download and extract the latest version of the [http://gmplib.org/ GNU MP Bignum Library (GMP)]. (You will need either cygwin with tar and bz2 installed or 7-zip to extract the archive.)</li><br />
<li>Install the following Cygwin packages if you have not already:<br />
* binutils<br />
* gcc<br />
* gcc-g++<br />
* m4<br />
* make<br />
</li><br />
<li>As part of the GMP compilation process, a file called <code>gen-fib.c</code> generates a table of numbers in the Fibonacci sequence. The generated file does not play nicely with Cygwin or MinGW, so you must fix it. Edit <code>gen-fib.c</code>, and at around line 100, change these lines<br />
<pre><br />
for (i = 0; i < fnum; i++)<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
printf ("), /* %d */\n", i-1);<br />
}<br />
printf ("};\n");<br />
</pre><br />
to look like this:<br />
<pre><br />
for (i = 0; i < fnum; i++)<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
printf (")%c /* %d */\n", (i == (fnum-1)) ? ' ' : ',', i-1);<br />
}<br />
printf ("};\n");<br />
</pre><br />
The patch file looks like this:<br />
<pre><br />
@@ -100,7 +100,7 @@<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
- printf ("), /* %d */\n", i-1);<br />
+ printf (")%c /* %d */\n", (i == (fnum-1)) ? ' ' : ',', i-1);<br />
}<br />
printf ("};\n");<br />
}<br />
</pre><br />
</li><br />
<li>Compiling with MinGW does not work, so you will need to compile with Cygwin. At the prompt:<br />
<pre><br />
$ ./configure --disable-static --enable-shared<br />
$ make<br />
</pre><br />
The <code>--disable-static</code> and <code>--enable-shared</code> flags configure GMP to build a DLL instead of a static library. You may optionally perform <code>make install</code>. Additional compilation instructions [http://www.cs.nyu.edu/exact/core/gmp/ are available].<br />
<p>If you experience difficulties with compilation and it appears that MinGW gcc is being detected by <code>configure</code> and not Cygwin gcc, you can try editing your <code>PATH</code> variable:</p><br />
<pre><br />
$ export PATH=`echo $PATH | sed "s|/cygdrive/c/MinGW/bin:||"`<br />
</pre><br />
Re-run <code>configure</code> and <code>make</code> afterwards.<br />
</ol><br />
</li><br />
<li>Set the following CMake flags:<br />
{| class="wikitable"<br />
! Setting<br />
! Description<br />
! Type<br />
! Value<br />
|-<br />
| <code>USE_INTERNAL_CRYPTO</code><br />
| Use the provided copies of crypto libraries. <!-- FIXME: I think these are nettle and something else --><br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_GLEW</code><br />
| Use the provided copy of GLEW.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_JPEG</code><br />
| Use the provided copy of JPEG.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SDL</code><br />
| Use the provided copy of SDL.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SPEEX</code><br />
| Use the provided copy of Speex.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_WEBP</code><br />
| Use the provided copy of WebP.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_CURSES</code><br />
| Enables/disables curses.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>PNG_LIBRARY</code><br />
| Path to the PNG library DLL.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng/libs/win32/libpng.lib</code><br />
|-<br />
| <code>PNG_PNG_INCLUDE_DIR</code><br />
| Path to the PNG library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng</code><br />
|-<br />
| <code>FREETYPE_LIBRARY</code><br />
| Path to the compiled FreeType library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/lib/freetype.lib</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_freetype2</code><br />
| Path to the FreeType library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/freetype2</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_ft2build</code><br />
| Path to the FreeType library file "ftbuild.h".<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/</code><br />
|-<br />
| <code>GMP_INCLUDE_DIR</code><br />
| Path to the GMP library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/gmp/include</code><br />
|-<br />
| <code>GMP_LIBRARY</code><br />
| Path to the GMP library.<br />
| <code>FILEPATH</code><br />
| <code><var>path/to/compiled/gmp/</var>.libs/cyggmp-10.dll</code><br />
|-<br />
| <code>ZLIB_INCLUDE_DIR</code><br />
| Path to the zlib library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/include</code><br />
|-<br />
| <code>ZLIB_LIBRARY</code><br />
| Path to the zlib library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/lib/x32/zlib1.dll</code><br />
|-<br />
| <code>CURL_LIBRARY</code><br />
| Path to the CURL library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/lib/win32/release/libcurl.dll</code><br />
|-<br />
| <code>CURL_INCLUDE_DIR</code><br />
| Path to the zlib library.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/include/curl</code><br />
|-<br />
| <code>USE_OPENAL</code><br />
| Enables/disables OpenAL support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_THEORA</code><br />
| Enables/disables Theora support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_XVID</code><br />
| Enables/disables Xvid support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CODEC_THEORA</code><br />
| Enables/disables Ogg support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>SDLMAIN_LIBRARY</code><br />
| Enables/disables Ogg support.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code><br />
|-<br />
|}<br />
Do note that CMake is slash-direction&ndash;agnostic; it can handle both forward- and backslashes on Windows.<br />
</li><br />
<li>Open <code><var>SourcePath</var>/CMakeLists.txt</code> and edit the line<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi z )<br />
</pre><br />
(around line 1040) to look like this:<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi )<br />
</pre><br />
Also edit around line 1700:<br />
<pre><br />
###########################<br />
#Configure Download Script#<br />
###########################<br />
<br />
if( NOT MSVC )<br />
</pre><br />
to look like this:<br />
<pre><br />
###########################<br />
#Configure Download Script#<br />
###########################<br />
<br />
if( NOT WIN32 )<br />
<pre><br />
</li><br />
<li>Open <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code> and edit the lines:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "SDL.h"<br />
#include "SDL_main.h"<br />
</pre><br />
to look like:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "../../../include/SDL.h"<br />
#include "../../../include/SDL_main.h"<br />
</pre><br />
<li>Open a terminal and <code>cd</code> to your source directory.</li><br />
<li>Run <code>make</code>:<br />
<pre><br />
> mingw32-make<br />
</pre><br />
If you would like verbose output, set the <code>VERBOSE</code> environment variable before running <code>make</code>.<br />
<pre><br />
> set VERBOSE=1<br />
</pre><br />
To make it easier to build the source, you can create a batch file (call it something like <code>compile.bat</code>) and place it in your build directory:<br />
<pre><br />
@echo off<br />
<br />
set RETURN=compile<br />
<br />
:get_time<br />
:: Thank you, Rob van der Woude:<br />
:: (http://www.robvanderwoude.com/datetimentparse.php)<br />
FOR /F "tokens=1,2,3 delims=:." %%A IN ("%Time%") DO (<br />
SET /A HOURS = 100%%A %% 100<br />
SET /A MINUTES = 100%%B %% 100<br />
SET /A SECONDS = 100%%C %% 100<br />
)<br />
SET /A TICKS=( %HOURS% * 3600 ) + ( %MINUTES% * 60 ) + %SECONDS%<br />
GOTO %RETURN%<br />
<br />
:compile<br />
SET START_TICKS=%TICKS%<br />
<br />
SET VERBOSE=1<br />
:: mingw32-make clean<br />
mingw32-make -j4<br />
<br />
set RETURN=finish<br />
GOTO get_time<br />
<br />
:finish<br />
SET /A COMPILE_TIME=%TICKS% - %START_TICKS%<br />
SET /A MINUTES=%COMPILE_TIME% / 60<br />
SET /A SECONDS=%COMPILE_TIME% % 60<br />
ECHO.<br />
ECHO Compilation took %MINUTES%m %SECONDS%s.<br />
PAUSE<br />
</pre><br />
</li><br />
</ol><br />
<br />
====Notes====<br />
<br />
* If you would like to use curses, try using [http://sourceforge.net/projects/pdcurses/files/pdcurses PDCurses].<br />
<br />
===QtCreator===<br />
<br />
# Install MinGW and follow the above instructions, except select Code::Blocks as the generator.<br />
# Start QtCreator, and select "Open File or Project&hellip;" from the File menu.<br />
# Navigate to your source directory and open CMakeLists.txt.<br />
# At the CMake Wizard, select the same build directory you already configured using CMake. (If you did not chose Code::Blocks as the generator, you will have to start over again, as QtCreator requires a Code::Blocks project file in order to compile the source.)<br />
# Ensure that a generator is selected in the combo box, and click "Run CMake". If there is no generator listed, see the [[#Troubleshooting|troubleshooting]] section below.<br />
# Click "Finish" to close the wizard.<br />
<br />
You should now be able to compile, run, and debug the code using QtCreator.<br />
<br />
====Troubleshooting====<br />
<br />
If at the "Run CMake" prompt of the the CMake Wizard, select "Run CMake" and are warned that no generator was selected, and notice that there are no generators in the combo box, you will likely have to [http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html manually configure your toolchain]. Select "Options&hellip;" from the "Tools" menu, then navigate to "Build &amp; Run".<br />
<br />
At the options window,<br />
* Go to the "Kits" tab, and mouse over the "Desktop (default)" kit under "Manual". If there were any errors in configuring this kit, they will be displayed in the tool tip. If there are problems, select the kit. You may need to manually specify the location of the MinGW debugger, for example, which is typically <code>C:\MinGW\bin\gdb.exe</code>.<br />
* Go to the "Compilers" tab, and ensure that MinGW is present. If not, you will need to add it manually.<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 />
libgmp3-dev libjpeg8-dev libncurses5-dev libogg-dev libopenal-dev \<br />
libpng12-dev libsdl1.2-dev libvorbis-dev zlib1g-dev nettle-dev \<br />
libwebp-dev libspeexdsp-dev libtheora-dev<br />
<br />
If the version of WebP supplied by your version of Debian or Ubuntu is older than v0.2.0, you will need to [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0.tar.gz download] and [https://developers.google.com/speed/webp/docs/compiling#unix compile it from source]. After compiling and installing with <code>sudo make install</code>, in CMake, you'll need to set <code>WEBP_INCLUDE_DIR</code> to <code>/usr/local/include/webp</code> and <code>WEBP_LIBRARY</code> to <code>/usr/local/lib/libwebp.so</code>.<br />
<br />
'''We currently provide a ready-to-use libwebp-dev in our [http://{{SERVERNAME}}/index.php/Download#ubuntu Debian and Ubuntu repositories], alongside .debs of the game and server.'''<br />
<br />
Actual dev package names may vary, e.g. libgmp-dev instead of libgmp3-dev and libglew-dev or libglew1.7-dev instead of libglew1.5-dev.<br />
<br />
Since we have a debian directory in the source, you can also to check what's needed then install the listed packages (choosing from alternatives as needed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ dpkg-checkbuilddeps<br />
…<br />
$ sudo apt-get install <var>package(s)</var><br />
<br />
If dpkg-checkbuilddeps produces no output, you have all necessary build dependencies. Also, debhelper's only needed if you're building .debs.<br />
<br />
====Gentoo====<br />
<br />
$ emerge curl freetype glew gmp jpeg ncurses libogg openal libpng libsdl libvorbis zlib<br />
<br />
====openSUSE====<br />
<br />
$ sudo install zypper gcc gcc-c++ Mesa-libGL-devel SDL-devel libjpeg8-devel \<br />
libpng12-devel glew-devel webp-devel ncurses-devel gmp-devel libcurl-devel \<br />
libnettle-devel openal-soft-devel speex-devel libvorbis-devel \<br />
libtheora-devel<br />
<br />
The latest version of WebP must be installed manually:<br />
<br />
$ wget https://webp.googlecode.com/files/libwebp-0.2.1.tar.gz<br />
$ tar xvzf libwebp-0.2.1.tar.gz<br />
$ cd libwebp-0.2.1<br />
$ ./configure && make<br />
$ sudo make install<br />
<br />
You must disable curses (set <code>USE_CURSES</code> appropriately in CMake) as failing to do so will cause Unvanquished to crash on startup.<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 />
On Debian or 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 />
Or, in Debian or Ubuntu, you can build a package (but you'll need to have devscripts and fakeroot installed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ fakeroot dpkg-buildpackage -b -uc<br />
$ sudo dpkg -i <var>../unvanquished_*.deb</var><br />
<br />
Once in <code>ccmake</code>, use the following keys:<br />
<br />
* Press {{Hotkey|c}} to configure. If an error occurs during this phase, make note of it and press {{Hotkey|e}} to dismiss it.<br />
* Use the up and down arrow keys to navigate the compilation options.<br />
* Press {{Hotkey|Enter}} to enable or disable boolean options (i.e., on/off) or to edit textual options.<br />
** Press {{Hotkey|Esc}} when editing a textual option to cancel the change.<br />
<br />
Once you have finished the configuration process, press {{Hotkey|C}} again, then {{Hotkey|G}} 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=====<br />
<br />
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_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 />
* <code>USE_CIN_THEORA</code> &mdash; Disabling this prevents videos from being recorded in Theora.<br />
* <code>USE_CIN_XVID</code> &mdash; Disabling this prevents videos from being recorded in Xvid.<br />
* <code>USE_VOIP</code> &mdash; Disabling this removes VOIP support. Alternatively enabling <code>USE_INTERNAL_SPEEX</code> will use the libraries distributed with Unvanquished for VoIP<br />
* <code>USE_INTERNAL_CRYPTO</code> &mdash; Enable this to use the crypto libraries provided by Unvanquished.<br />
<br />
===Compiling===<br />
<br />
$ cd <var>path/to/unvanquished/build</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 />
===Acquiring mandatory game files===<br />
<br />
The game files are not in the Git repository, and must be downloaded separately. This may be done on the command line or from your web browser. The downloads may be found on [http://sourceforge.net/projects/unvanquished/files/Assets SourceForge.net]. If you download the files from your browser, just download the files named "pak*.pk3", and save them to the [[Running_the_game#Data_locations|data location]] for your system.<br />
<br />
On Linux, this may be done as follows:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
wget -O $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On FreeBSD, using the <code>sh</code> shell:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
fetch -r -o $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On Mac OS X:<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
curl -L "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download" > $file<br />
fi<br />
done<br />
<br />
Linux users may also use the <code>download-pk3.sh</code> script that is distributed with the source code, which requires that curl be installed:<br />
<br />
$ cd <var>[path to Unvanquished source code]</var><br />
$ mkdir -p ~/.Unvanquished/main<br />
$ ./download-pk3.sh ~/.Unvanquished/main<br />
<br />
===Downloading the map pack===<br />
<br />
The map pack exists only for convenience; if you do not download the map pack, Unvanquished will automatically download maps as needed when you attempt to play online.<br />
<br />
To download the map pack on Linux:<br />
<br />
$ wget -O maps.7z "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z"; done<br />
<br />
To download the map pack on Mac OS X:<br />
<br />
$ curl -L "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z" > maps.7z; done<br />
<br />
Note that you will need to unzip the map pack on either system as it is compressed with LZMA. Mac users can use the [http://wakaba.c3.cx/s/apps/unarchiver.html Unarchiver]. Uncompressing the archive on Linux is highly dependent on your distribution.<br />
<br />
===Verifying the Files===<br />
<br />
Download the latest [http://sourceforge.net/projects/unvanquished/files/Assets/{{CurrentVersion|MD5HashFile}} MD5 hash file] and save it to your system's [[Running_the_game#Data_directory|data location]].<br />
<br />
On systems with the <code>md5</code> command (Mac OS X):<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ cat {{CurrentVersion|MD5HashFile}} | while read line; do<br />
file="`echo "$line" | sed -E "s/^[a-fA-F0-9]+ +\*?//"`"<br />
if [ -e "$file" ]; then<br />
if [ `md5 -r "$file" | cut -d\ -f1` = "`echo "$line" | cut -d\ -f1`" ]<br />
then echo "File \"$file\" appears okay."<br />
else echo "File \"$file\" is corrupt"'!' >&2<br />
fi; fi; done<br />
<br />
On systems with the <code>md5sum</code> command (most Linux distributions):<br />
<br />
$ cd <var>[[Running_the_game#Data_directory|/path/to/data/files]]</var><br />
$ md5sum -c {{CurrentVersion|MD5HashFile}} 2>&1 | grep -v "open or read\|file or directory"<br />
<br />
The <code>grep</code> invocation is used to strip output complaining about missing files.<br />
<br />
Any files that are found to be corrupt should be replaced; just download a [http://sourceforge.net/projects/unvanquished/files/Assets new copy] of the affected file(s).<br />
<br />
==Errors==<br />
<br />
===CMake cannot locate Newton===<br />
<br />
If CMake cannot find Newton, you'll need to set it up yourself.<br />
<br />
It should be in <code><var>/path/to/Unvanquished</var>/src/libs/libnewton/libs/<var>your_os</var>/libNewton.so</code>.<br />
Be sure to replace <var>your_os</var> with the proper directory name.<br />
<br />
Use CMake as before to change the <code>NEWTON_LIBRARY</code> build setting to the said path:<br />
<br />
# Start the CMake configurator:<pre>$ ccmake ..</pre><br />
# Scroll down and highlight <code>NEWTON_LIBRARY</code>.<br />
# Press {{Hotkey|Enter}} to begin editing and input in the path.<br />
# Press {{Hotkey|C}} to configure and {{Hotkey|G}} to generate the new makefiles.<br />
# Press {{Hotkey|Q}} to quit.<br />
# Recompile the source:<pre>$ make</pre><br />
<br />
===The C Compiler is not able to compile a simple test program===<br />
<br />
When attempting to generate a solution for Xcode CMake fails with the following error<br />
-- Check for working C compiler using: Xcode -- broken<br />
CMake Error at /Applications/CMake 2.8-8.app/Contents/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):<br />
The C compiler "/usr/bin/gcc" is not able to compile a simple test program.<br />
<br />
It fails with the following output:<br />
<br />
Change Dir: /Users/danielmaloney/Documents/Unvanquished/build-xcode/CMakeFiles/CMakeTmp<br />
<br />
<br />
<br />
Run Build Command:/Applications/CMake\ 2.8-8.app/Contents/bin/cmakexbuild<br />
-project CMAKE_TRY_COMPILE.xcodeproj build -target<br />
cmTryCompileExec1400153232 -configuration Debug<br />
<br />
Error: No developer directory found at /Developer. Run<br />
/usr/bin/xcode-select to update the developer directory path.<br />
<br />
<br />
<br />
<br />
<br />
CMake will not be able to correctly generate this project.<br />
Call Stack (most recent call first):<br />
CMakeLists.txt:19 (project)<br />
<br />
This is due to Xcode 4.3 having a different directory structure to previous versions. Simply running the following command will correct this error:<br />
sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer/</div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Compiling_the_source&diff=1954Compiling the source2013-04-14T17:10:20Z<p>Velociostrich: /* MinGW */ Add instructions for disabling the download-pk3.sh target</p>
<hr />
<div>==Mac OS X==<br />
<br />
First, you need to [[Getting_the_source|acquire the source code]].<br />
<br />
Regardless of what interface you may use to compile the source, you will need [http://www.cmake.org/cmake/resources/software.html CMake] to generate makefiles. You will also need to install [https://developer.apple.com/xcode/ Xcode] (making sure to choose to install the command-line utilities when prompted by the installer).<br />
<br />
Then, you will need to acquire (and in some cases, manually compile) at a minimum the [[#Dependencies|necessary libraries]].<br />
<br />
Once you have the source code and the libraries installed, you may actually proceed to compile the source. You have several options:<br />
* '''Compile the source at the command line'''. This is the easiest if you would just like to compile the game to use yourself and you do not intend to work on the code.<br />
* '''Compile the source using an IDE'''. This is preferred if you intend on developing the source.<br />
** Xcode is Apple's flagship IDE and you should have installed to compile the source regardless of which method you use.<br />
** [http://qt-project.org/downloads QtCreator] is cross-platform and provides real-time feedback of syntax errors, a Vim mode, as well as other features.<br />
** [http://www.codeblocks.org/ Code::Blcoks] is also cross-platform but lacks some of the features of Xcode and QtCreator.<br />
<br />
===Dependencies===<br />
<br />
You only need to use one of the following methods (HomeBrew or compiling by hand). Please try and avoid mixing methods as this may produce unexpected results.<br />
<br />
Unvanquished requires the following libraries:<br />
* [[#JPEG|JPEG]], version 8 or higher. (Version 6 was known to have problems)<br />
* [[#Simple_DirectMedia_Layer_.28SDL.29|Simple DirectMedia Layer]] (The binary provided by libsdl.org causes graphical corruptions. Compile from source or use homebrew/macports)<br />
* [[#The_OpenGL_Extension_Wrangler_Library_.28GLEW.29|The OpenGL Extension Wrangler Library]]<br />
* CuRL<br />
* [[#The_GNU_MP_Bignum_Library_.28libgmp.29|GMP]]<br />
* [[#WebP|WebP]] (v0.2.0 or newer)<br />
<br />
The following libraries are optional:<br />
* Theora<br />
* Speex<br />
* [[#Ogg|Ogg]]<br />
* [[#Vorbis|Vorbis]]<br />
<br />
====HomeBrew====<br />
Install [http://mxcl.github.com/homebrew/ HomeBrew] and then run the following command<br />
<br />
$ brew install nettle libjpeg curl sdl webp xvid gmp glew speex libvorbis theora<br />
<br />
All the necessary libraries should now have been installed.<br />
<br />
====Compiling by hand====<br />
The following are shell scripts that download, compile, and install various libraries. This is more time consuming then other methods but might be useful if you need more control over your libraries<br />
<br />
=====JPEG=====<br />
<br />
$ curl http://www.ijg.org/files/jpegsrc.v8d.tar.gz > jpegsrc.v8d.tar.gz<br />
$ tar xvzf jpegsrc.v8d.tar.gz<br />
$ cd jpeg-8d<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The OpenGL Extension Wrangler Library (GLEW)=====<br />
<br />
$ curl -L https://sourceforge.net/projects/glew/files/glew/1.7.0/glew-1.7.0.tgz/download > glew-1.7.0.tgz<br />
$ tar xvzf glew-1.7.0.tgz<br />
$ cd glew-1.7.0<br />
$ make<br />
$ sudo make install<br />
<br />
=====Simple DirectMedia Layer (SDL)=====<br />
<br />
Do not use the binaries provided by libsdl.org, as these are known to cause issues with gamma and color display. Instead, compile your own:<br />
<br />
$ curl http://www.libsdl.org/release/SDL-1.2.15.tar.gz > SDL-1.2.15.tar.gz<br />
$ tar xvzf SDL-1.2.15.tar.gz<br />
$ cd SDL-1.2.15<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The GNU MP Bignum Library (libgmp)=====<br />
<br />
$ curl ftp://ftp.gmplib.org/pub/gmp-5.0.5/gmp-5.0.5.tar.bz2 > gmp-5.0.5.tar.bz2<br />
$ tar xvjf gmp-5.0.5.tar.bz2<br />
$ cd gmp-5.0.5<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Ogg=====<br />
<br />
$ curl http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz > libogg-1.3.0.tar.gz<br />
$ tar xvzf libogg-1.3.0.tar.gz<br />
$ cd libogg-1.3.0<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Vorbis=====<br />
<br />
$ curl http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz > libvorbis-1.3.3.tar.gz<br />
$ tar xvzf libvorbis-1.3.3.tar.gz<br />
$ cd libvorbis-1.3.3<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====WebP=====<br />
<br />
You do not need to compile WebP by hand; Google provides binaries for Mac OS X available from their [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0-mac-10.5.tar.gz project page]. You will need version 0.2.0 or newer.<br />
<br />
Once downloaded, you must still install the header files and the binary:<br />
<br />
$ curl https://webp.googlecode.com/files/libwebp-0.2.0-mac-10.5.tar.gz > libwebp-0.2.0-mac-10.5.tar.gz<br />
$ tar xvzf libwebp-0.2.0-mac-10.5.tar.gz<br />
$ cd libwebp-0.2.0-mac-10.5<br />
$ sudo cp include/webp /usr/local/include<br />
$ sudo cp lib/libwebp.a /usr/local/lib<br />
<br />
===Configuring with CMake===<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 should be a different directory.<br />
# Hit "Configure". You will be prompted as to which generator you would like to use. If you have Xcode installed, choose that. Wait while the configuration process runs. You may have to set the following:<br />
## If CMake did not find your jpeg headers for some reason, set <code>JPEG_INCLUDE_DIR</code> to <code>/path/to/Unvanquished/src/libs/jpeg</code>.<br />
## Check <code>USE_INTERNAL_CRYPTO</code> to avoid having to compile nettle and hogweed.<br />
## Check <code>USE_INTERNAL_SPEEX</code> to avoid having to compile Speex.<br />
## Uncheck <code>USE_CIN_THEORA</code> and <code>USE_CIN_XVID</code> to avoid having to compile Theora or Xvid. (At present, there are not cutscenes or any such that require it.)<br />
## '''You will probably not be able to compile with the GLSL optimizer enabled; uncheck <code>USE_GLSL_OPTIMIZER</code>'''<br />
## If you have selected to generate Xcode project files, make the <code>SDLMAIN_LIBRARY</code> field blank. This option is not available if you have the generator set to Unix makefiles.<br />
# Hit "Generate".<br />
# You may now close Xcode.<br />
<br />
===Compiling===<br />
<br />
====With Xcode====<br />
<br />
<ol><br />
<li>Compilation will fail unless you manually create certain directories needed by the build scripts:<br />
<pre><br />
$ cd /path/to/build/dir/CMakeFiles<br />
$ mkdir gpp{game,trem,ui}-qvm.dir<br />
</pre><br />
This is a workaround to {{Issue|101}}.<br />
</li><br />
<li>Either start Xcode and open the project file (in the build directory you specified) or double-click the project file in Finder.</li><br />
<li>Open the project file created by CMake, which should be in the build directory you specified.</li><br />
<li>Change the active target to "ALL_BUILD" and click Product&rarr;Build.</li><br />
</ol><br />
<br />
====With Unix Makefiles====<br />
<br />
<ul><br />
<li>Start Terminal (Applications &rarr; Utilities &rarr; Terminal).</li><br />
<li>Input the following commands:<br />
<pre><br />
$ cd /path/to/Unvanquished-build<br />
$ make<br />
</pre><br />
If you are on a multi-core or multi-processor machine, you may speed up the process by passing the <code>-j</code> argument followed by the number of available cores to <code>make</code>; e.g., <code>make -j4</code>. Note that doing so makes reading error messages more difficult, as multiple instances of the compiler will print to the screen at once, causing information to appear out of order.<br />
</li><br />
</ul><br />
<br />
===Testing the build===<br />
<br />
====With Xcode 4====<br />
<br />
To test the game, select the "client" scheme from the combo box on the toolbar, and click the run button or press {{Hotkey|MacCommand}}{{Hotkey|R}}.<br />
<br />
====With Unix Makefiles====<br />
<br />
After compiling, you'll have to place the data files in the <code>main</code> directory in your build directory. [[#Acquiring the Game Files|For download instructions, see below.]]<br />
<br />
Your file structure should look as follows:<br />
<br />
[[File:Build_dir_Mac_OS_X.png]]<br />
<br />
You may now start the application as such:<br />
<br />
$ ./daemon.i386<br />
<br />
Note that older machines will not support the new OpenGL 3 renderer, and must be started specifying the "vanilla" (aka "GL") renderer:<br />
<br />
$ ./daemon.i386 +set cl_renderer GL<br />
<br />
===Bundling the Application===<br />
<br />
====With CPack====<br />
<br />
CPack is able to create standalone bundles (as well as many other types of installers). However you must generate the files using Unix Makefiles instead of Xcode.<br />
<br />
$ cd /path/to/Unvanquished-build<br />
$ cpack -G Bundle<br />
<br />
Some warnings will be printed however these can be safely ignored. There should be a file called Unvanquished.dmg in the Unvanquished-build folder.<br />
<br />
====Manually====<br />
<br />
You'll find the Mac [http://macdylibbundler.sourceforge.net/ dynamic library bundler] to be quite useful (you must generate the files using Unix Makefiles instead of Xcode):<br />
<br />
$ curl -L http://sourceforge.net/projects/macdylibbundler/files/macdylibbundler/0.4.1/dylibbundler0.4.1.zip/download > \<br />
dylibbundler0.4.1.zip<br />
$ unzip dylibbundler0.4.1.zip<br />
$ cd dylibbundler<br />
$ make<br />
$ sudo make install<br />
<br />
Once you've done that, you can proceed to create the application bundle. Note that these steps assume that you have downloaded the data files to <code>main/</code> as shown above:<br />
<br />
<pre><br />
$ git=/path/to/Unvanquished-git-repo<br />
$ build=/path/to/Unvanquished-build-dir<br />
$ mkdir -pv Unvanquished.app/Contents/{libs,MacOS,Resources,Frameworks}<br />
$ cp -r $build/main Unvanquished.app/Contents/MacOS<br />
$ sips -s format tiff $git/debian/unvanquished.png --out temp.tiff<br />
$ tiff2icns temp.tiff Unvanquished.app/Contents/Resources/Unvanquished.icns<br />
$ rm temp.tiff<br />
$ cp $build/daemon{,ded}.i386 $build/*.dylib Unvanquished.app/Contents/MacOS<br />
$ cp -r /Library/Frameworks/SDL.framework Unvanquished.app/Contents/Frameworks<br />
$ install_name_tool -id \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/Frameworks/SDL.framework/Versions/A/SDL<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGLi386.dylib<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGL3i386.dylib<br />
$ for binary in Unvanquished.app/Contents/MacOS/*.{i386,dylib}; do<br />
dylibbundler -b -x $binary -d $dest/Unvanquished.app/Contents/libs/; done<br />
$ cp /usr/lib/libGLEW.1.7.0.dylib ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ chmod +w ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -id @executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -change /usr/lib/libGLEW.1.7.0.dylib \<br />
@executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ cat > Unvanquished.app/Contents/Info.plist<br />
<?xml version="1.0" encoding="UTF-8"?><br />
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"<br />
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"><br />
<plist version="1.0"><br />
<dict><br />
<key>CFBundleName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleDisplayName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleExecutable</key><br />
<string>daemon.i386</string><br />
<key>CFBundleIconFile</key><br />
<string>Unvanquished.icns</string><br />
<key>CFBundleIdentifier</key><br />
<string>net.Unvanquished</string><br />
<key>CFBundleInfoDictionaryVersion</key><br />
<string>6.0</string><br />
<key>CFBundlePackageType</key><br />
<string>APPL</string><br />
<key>CFBundleShortVersionString</key><br />
<string>0.4.0</string><br />
<key>CFBundleVersion</key><br />
<string>0.4.0</string><br />
</dict><br />
</plist><br />
^d<br />
</pre><br />
<br />
Note: <code>^d</code> indicates pressing {{Hotkey|Ctrl}}{{Hotkey|D}} on the keyboard.<br />
<br />
The contents of the completed application bundle should look like this:<br />
<br />
[[File:Bundle_dir_Mac_OS_X.png]]<br />
<br />
'''Note''': If you compiled SDL from source, you will not see a directory titled <code>SDL.framework</code>.<br />
<br />
==Windows==<br />
<br />
===Visual Studio===<br />
<br />
CMake can generate Visual Studio projects for unvanquished however this feature is relatively new and may have some bugs.<br />
<br />
Steps:<br />
<br />
# Double click on Visual_Studio32.bat<br />
# Open build-32/Daemon.sln in Visual Studio 2010.<br />
# In the two text boxes in the toolbar, select "Release" or "Debug" in the first one and Win32 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 />
====Important Notes====<br />
<br />
* LLVM is disabled and does not work correctly with CMake generated Visual Studio projects.<br />
* ncurses is not supported under Visual Studio.<br />
* The path to the build folder must not have any spaces otherwise generation of QVMs will fail. See [https://github.com/Unvanquished/Unvanquished/issues/102 issue 102]<br />
* Due to limitations with cmake neither the startup project nor the working directory can be specified. These must be manually set to the following values for debugging the client under Visual Studio<br />
** Right click on client and select "Set as StartUp project".<br />
** Right click on client, select properties, select Debugging and set "Working Directory" to $(TargetPath)\..<br />
<br />
===MinGW===<br />
<br />
Unvanquished is supported under MinGW. The build process should be fairly similar to the Linux instructions.<br />
<br />
The easiest way to acquire and install MinGW is with the graphical [http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/ mingw-get-inst installer]. <!-- TODO: maybe walk the user through the installer? --><br />
<br />
When configuring the build with CMake, you will find that you will have to set a number of libraries manually. You can find precompiled DLLs for most of the dependencies; those that are not pre-compiled can be built with the corresponding <code>USE_INTERNAL_</code> setting.<br />
<br />
On Windows, SDL requires that the Direct X SDK can be installed. You may download the June 2010 release from [http://www.microsoft.com/en-us/download/details.aspx?id=6812 Microsoft's site].<br />
<br />
The easiest way to get a build up (at the time of writing) is as follows: <!-- FIXME: incomplete --><br />
<br />
{{Note|content=Be aware that some of these paths are for the 64 bit versions of libraries; if you are on a 32-bit system, you will need to change some of these paths. The easiest way to locate libraries is to navigate in Windows Explorer to the <code>src/libs</code> directory and search for files matching <code>dll</code>.}}<br />
<br />
<ol><br />
<li>Although there are binaries of gmp distributed with the source, they have are dependent on Visual Studio's implementations of <code>_ftol2_sse</code> and <code>_alloca_probe_16</code>. A fix may be found on [http://stackoverflow.com/questions/6753111/static-linking-with-openssl Stack Exchange], but requires that Visual Studio be installed, which defeats the purpose of attempting to use MinGW to compile the source. You can build gmp yourself:<br />
<ol><br />
<li>Download and extract the latest version of the [http://gmplib.org/ GNU MP Bignum Library (GMP)]. (You will need either cygwin with tar and bz2 installed or 7-zip to extract the archive.)</li><br />
<li>Install the following Cygwin packages if you have not already:<br />
* binutils<br />
* gcc<br />
* gcc-g++<br />
* m4<br />
* make<br />
</li><br />
<li>As part of the GMP compilation process, a file called <code>gen-fib.c</code> generates a table of numbers in the Fibonacci sequence. The generated file does not play nicely with Cygwin or MinGW, so you must fix it. Edit <code>gen-fib.c</code>, and at around line 100, change these lines<br />
<pre><br />
for (i = 0; i < fnum; i++)<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
printf ("), /* %d */\n", i-1);<br />
}<br />
printf ("};\n");<br />
</pre><br />
to look like this:<br />
<pre><br />
for (i = 0; i < fnum; i++)<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
printf (")%c /* %d */\n", (i == (fnum-1)) ? ' ' : ',', i-1);<br />
}<br />
printf ("};\n");<br />
</pre><br />
The patch file looks like this:<br />
<pre><br />
@@ -100,7 +100,7 @@<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
- printf ("), /* %d */\n", i-1);<br />
+ printf (")%c /* %d */\n", (i == (fnum-1)) ? ' ' : ',', i-1);<br />
}<br />
printf ("};\n");<br />
}<br />
</pre><br />
</li><br />
<li>Compiling with MinGW does not work, so you will need to compile with Cygwin. At the prompt:<br />
<pre><br />
$ ./configure --disable-static --enable-shared<br />
$ make<br />
</pre><br />
The <code>--disable-static</code> and <code>--enable-shared</code> flags configure GMP to build a DLL instead of a static library. You may optionally perform <code>make install</code>. Additional compilation instructions [http://www.cs.nyu.edu/exact/core/gmp/ are available].<br />
<p>If you experience difficulties with compilation and it appears that MinGW gcc is being detected by <code>configure</code> and not Cygwin gcc, you can try editing your <code>PATH</code> variable:</p><br />
<pre><br />
$ export PATH=`echo $PATH | sed "s|/cygdrive/c/MinGW/bin:||"`<br />
</pre><br />
Re-run <code>configure</code> and <code>make</code> afterwards.<br />
</ol><br />
</li><br />
<li>Set the following CMake flags:<br />
{| class="wikitable"<br />
! Setting<br />
! Description<br />
! Type<br />
! Value<br />
|-<br />
| <code>USE_INTERNAL_CRYPTO</code><br />
| Use the provided copies of crypto libraries. <!-- FIXME: I think these are nettle and something else --><br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_GLEW</code><br />
| Use the provided copy of GLEW.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_JPEG</code><br />
| Use the provided copy of JPEG.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SDL</code><br />
| Use the provided copy of SDL.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SPEEX</code><br />
| Use the provided copy of Speex.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_WEBP</code><br />
| Use the provided copy of WebP.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_CURSES</code><br />
| Enables/disables curses.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>PNG_LIBRARY</code><br />
| Path to the PNG library DLL.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng/libs/win32/libpng.lib</code><br />
|-<br />
| <code>PNG_PNG_INCLUDE_DIR</code><br />
| Path to the PNG library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng</code><br />
|-<br />
| <code>FREETYPE_LIBRARY</code><br />
| Path to the compiled FreeType library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/lib/freetype.lib</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_freetype2</code><br />
| Path to the FreeType library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/freetype2</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_ft2build</code><br />
| Path to the FreeType library file "ftbuild.h".<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/</code><br />
|-<br />
| <code>GMP_INCLUDE_DIR</code><br />
| Path to the GMP library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/gmp/include</code><br />
|-<br />
| <code>GMP_LIBRARY</code><br />
| Path to the GMP library.<br />
| <code>FILEPATH</code><br />
| <code><var>path/to/compiled/gmp/</var>.libs/cyggmp-10.dll</code><br />
|-<br />
| <code>ZLIB_INCLUDE_DIR</code><br />
| Path to the zlib library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/include</code><br />
|-<br />
| <code>ZLIB_LIBRARY</code><br />
| Path to the zlib library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/lib/x32/zlib1.dll</code><br />
|-<br />
| <code>CURL_LIBRARY</code><br />
| Path to the CURL library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/lib/win32/release/libcurl.dll</code><br />
|-<br />
| <code>CURL_INCLUDE_DIR</code><br />
| Path to the zlib library.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/include/curl</code><br />
|-<br />
| <code>USE_OPENAL</code><br />
| Enables/disables OpenAL support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_THEORA</code><br />
| Enables/disables Theora support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_XVID</code><br />
| Enables/disables Xvid support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CODEC_THEORA</code><br />
| Enables/disables Ogg support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>SDLMAIN_LIBRARY</code><br />
| Enables/disables Ogg support.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code><br />
|-<br />
|}<br />
Do note that CMake is slash-direction&ndash;agnostic; it can handle both forward- and backslashes on Windows.<br />
</li><br />
<li>Open <code><var>SourcePath</var>/CMakeLists.txt</code> and edit the line<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi z )<br />
</pre><br />
(around line 1040) to look like this:<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi )<br />
</pre><br />
Also edit around line 1700:<br />
<pre><br />
###########################<br />
#Configure Download Script#<br />
###########################<br />
<br />
if( NOT MSVC )<br />
</pre><br />
to look like this:<br />
<pre><br />
###########################<br />
#Configure Download Script#<br />
###########################<br />
<br />
if( NOT WIN32 )<br />
<pre><br />
</li><br />
<li>Open <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code> and edit the lines:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "SDL.h"<br />
#include "SDL_main.h"<br />
</pre><br />
to look like:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "../../../include/SDL.h"<br />
#include "../../../include/SDL_main.h"<br />
</pre><br />
<li>Open a terminal and <code>cd</code> to your source directory.</li><br />
<li>Run <code>make</code>:<br />
<pre><br />
> mingw32-make<br />
</pre><br />
If you would like verbose output, set the <code>VERBOSE</code> environment variable before running <code>make</code>.<br />
<pre><br />
> set VERBOSE=1<br />
</pre><br />
</li><br />
</ol><br />
<br />
====Notes====<br />
<br />
* If you would like to use curses, try using [http://sourceforge.net/projects/pdcurses/files/pdcurses PDCurses].<br />
<br />
===QtCreator===<br />
<br />
# Install MinGW and follow the above instructions, except select Code::Blocks as the generator.<br />
# Start QtCreator, and select "Open File or Project&hellip;" from the File menu.<br />
# Navigate to your source directory and open CMakeLists.txt.<br />
# At the CMake Wizard, select the same build directory you already configured using CMake. (If you did not chose Code::Blocks as the generator, you will have to start over again, as QtCreator requires a Code::Blocks project file in order to compile the source.)<br />
# Ensure that a generator is selected in the combo box, and click "Run CMake". If there is no generator listed, see the [[#Troubleshooting|troubleshooting]] section below.<br />
# Click "Finish" to close the wizard.<br />
<br />
You should now be able to compile, run, and debug the code using QtCreator.<br />
<br />
====Troubleshooting====<br />
<br />
If at the "Run CMake" prompt of the the CMake Wizard, select "Run CMake" and are warned that no generator was selected, and notice that there are no generators in the combo box, you will likely have to [http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html manually configure your toolchain]. Select "Options&hellip;" from the "Tools" menu, then navigate to "Build &amp; Run".<br />
<br />
At the options window,<br />
* Go to the "Kits" tab, and mouse over the "Desktop (default)" kit under "Manual". If there were any errors in configuring this kit, they will be displayed in the tool tip. If there are problems, select the kit. You may need to manually specify the location of the MinGW debugger, for example, which is typically <code>C:\MinGW\bin\gdb.exe</code>.<br />
* Go to the "Compilers" tab, and ensure that MinGW is present. If not, you will need to add it manually.<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 />
libgmp3-dev libjpeg8-dev libncurses5-dev libogg-dev libopenal-dev \<br />
libpng12-dev libsdl1.2-dev libvorbis-dev zlib1g-dev nettle-dev \<br />
libwebp-dev libspeexdsp-dev libtheora-dev<br />
<br />
If the version of WebP supplied by your version of Debian or Ubuntu is older than v0.2.0, you will need to [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0.tar.gz download] and [https://developers.google.com/speed/webp/docs/compiling#unix compile it from source]. After compiling and installing with <code>sudo make install</code>, in CMake, you'll need to set <code>WEBP_INCLUDE_DIR</code> to <code>/usr/local/include/webp</code> and <code>WEBP_LIBRARY</code> to <code>/usr/local/lib/libwebp.so</code>.<br />
<br />
'''We currently provide a ready-to-use libwebp-dev in our [http://{{SERVERNAME}}/index.php/Download#ubuntu Debian and Ubuntu repositories], alongside .debs of the game and server.'''<br />
<br />
Actual dev package names may vary, e.g. libgmp-dev instead of libgmp3-dev and libglew-dev or libglew1.7-dev instead of libglew1.5-dev.<br />
<br />
Since we have a debian directory in the source, you can also to check what's needed then install the listed packages (choosing from alternatives as needed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ dpkg-checkbuilddeps<br />
…<br />
$ sudo apt-get install <var>package(s)</var><br />
<br />
If dpkg-checkbuilddeps produces no output, you have all necessary build dependencies. Also, debhelper's only needed if you're building .debs.<br />
<br />
====Gentoo====<br />
<br />
$ emerge curl freetype glew gmp jpeg ncurses libogg openal libpng libsdl libvorbis zlib<br />
<br />
====openSUSE====<br />
<br />
$ sudo install zypper gcc gcc-c++ Mesa-libGL-devel SDL-devel libjpeg8-devel \<br />
libpng12-devel glew-devel webp-devel ncurses-devel gmp-devel libcurl-devel \<br />
libnettle-devel openal-soft-devel speex-devel libvorbis-devel \<br />
libtheora-devel<br />
<br />
The latest version of WebP must be installed manually:<br />
<br />
$ wget https://webp.googlecode.com/files/libwebp-0.2.1.tar.gz<br />
$ tar xvzf libwebp-0.2.1.tar.gz<br />
$ cd libwebp-0.2.1<br />
$ ./configure && make<br />
$ sudo make install<br />
<br />
You must disable curses (set <code>USE_CURSES</code> appropriately in CMake) as failing to do so will cause Unvanquished to crash on startup.<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 />
On Debian or 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 />
Or, in Debian or Ubuntu, you can build a package (but you'll need to have devscripts and fakeroot installed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ fakeroot dpkg-buildpackage -b -uc<br />
$ sudo dpkg -i <var>../unvanquished_*.deb</var><br />
<br />
Once in <code>ccmake</code>, use the following keys:<br />
<br />
* Press {{Hotkey|c}} to configure. If an error occurs during this phase, make note of it and press {{Hotkey|e}} to dismiss it.<br />
* Use the up and down arrow keys to navigate the compilation options.<br />
* Press {{Hotkey|Enter}} to enable or disable boolean options (i.e., on/off) or to edit textual options.<br />
** Press {{Hotkey|Esc}} when editing a textual option to cancel the change.<br />
<br />
Once you have finished the configuration process, press {{Hotkey|C}} again, then {{Hotkey|G}} 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=====<br />
<br />
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_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 />
* <code>USE_CIN_THEORA</code> &mdash; Disabling this prevents videos from being recorded in Theora.<br />
* <code>USE_CIN_XVID</code> &mdash; Disabling this prevents videos from being recorded in Xvid.<br />
* <code>USE_VOIP</code> &mdash; Disabling this removes VOIP support. Alternatively enabling <code>USE_INTERNAL_SPEEX</code> will use the libraries distributed with Unvanquished for VoIP<br />
* <code>USE_INTERNAL_CRYPTO</code> &mdash; Enable this to use the crypto libraries provided by Unvanquished.<br />
<br />
===Compiling===<br />
<br />
$ cd <var>path/to/unvanquished/build</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 />
===Acquiring mandatory game files===<br />
<br />
The game files are not in the Git repository, and must be downloaded separately. This may be done on the command line or from your web browser. The downloads may be found on [http://sourceforge.net/projects/unvanquished/files/Assets SourceForge.net]. If you download the files from your browser, just download the files named "pak*.pk3", and save them to the [[Running_the_game#Data_locations|data location]] for your system.<br />
<br />
On Linux, this may be done as follows:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
wget -O $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On FreeBSD, using the <code>sh</code> shell:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
fetch -r -o $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On Mac OS X:<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
curl -L "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download" > $file<br />
fi<br />
done<br />
<br />
Linux users may also use the <code>download-pk3.sh</code> script that is distributed with the source code, which requires that curl be installed:<br />
<br />
$ cd <var>[path to Unvanquished source code]</var><br />
$ mkdir -p ~/.Unvanquished/main<br />
$ ./download-pk3.sh ~/.Unvanquished/main<br />
<br />
===Downloading the map pack===<br />
<br />
The map pack exists only for convenience; if you do not download the map pack, Unvanquished will automatically download maps as needed when you attempt to play online.<br />
<br />
To download the map pack on Linux:<br />
<br />
$ wget -O maps.7z "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z"; done<br />
<br />
To download the map pack on Mac OS X:<br />
<br />
$ curl -L "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z" > maps.7z; done<br />
<br />
Note that you will need to unzip the map pack on either system as it is compressed with LZMA. Mac users can use the [http://wakaba.c3.cx/s/apps/unarchiver.html Unarchiver]. Uncompressing the archive on Linux is highly dependent on your distribution.<br />
<br />
===Verifying the Files===<br />
<br />
Download the latest [http://sourceforge.net/projects/unvanquished/files/Assets/{{CurrentVersion|MD5HashFile}} MD5 hash file] and save it to your system's [[Running_the_game#Data_directory|data location]].<br />
<br />
On systems with the <code>md5</code> command (Mac OS X):<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ cat {{CurrentVersion|MD5HashFile}} | while read line; do<br />
file="`echo "$line" | sed -E "s/^[a-fA-F0-9]+ +\*?//"`"<br />
if [ -e "$file" ]; then<br />
if [ `md5 -r "$file" | cut -d\ -f1` = "`echo "$line" | cut -d\ -f1`" ]<br />
then echo "File \"$file\" appears okay."<br />
else echo "File \"$file\" is corrupt"'!' >&2<br />
fi; fi; done<br />
<br />
On systems with the <code>md5sum</code> command (most Linux distributions):<br />
<br />
$ cd <var>[[Running_the_game#Data_directory|/path/to/data/files]]</var><br />
$ md5sum -c {{CurrentVersion|MD5HashFile}} 2>&1 | grep -v "open or read\|file or directory"<br />
<br />
The <code>grep</code> invocation is used to strip output complaining about missing files.<br />
<br />
Any files that are found to be corrupt should be replaced; just download a [http://sourceforge.net/projects/unvanquished/files/Assets new copy] of the affected file(s).<br />
<br />
==Errors==<br />
<br />
===CMake cannot locate Newton===<br />
<br />
If CMake cannot find Newton, you'll need to set it up yourself.<br />
<br />
It should be in <code><var>/path/to/Unvanquished</var>/src/libs/libnewton/libs/<var>your_os</var>/libNewton.so</code>.<br />
Be sure to replace <var>your_os</var> with the proper directory name.<br />
<br />
Use CMake as before to change the <code>NEWTON_LIBRARY</code> build setting to the said path:<br />
<br />
# Start the CMake configurator:<pre>$ ccmake ..</pre><br />
# Scroll down and highlight <code>NEWTON_LIBRARY</code>.<br />
# Press {{Hotkey|Enter}} to begin editing and input in the path.<br />
# Press {{Hotkey|C}} to configure and {{Hotkey|G}} to generate the new makefiles.<br />
# Press {{Hotkey|Q}} to quit.<br />
# Recompile the source:<pre>$ make</pre><br />
<br />
===The C Compiler is not able to compile a simple test program===<br />
<br />
When attempting to generate a solution for Xcode CMake fails with the following error<br />
-- Check for working C compiler using: Xcode -- broken<br />
CMake Error at /Applications/CMake 2.8-8.app/Contents/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):<br />
The C compiler "/usr/bin/gcc" is not able to compile a simple test program.<br />
<br />
It fails with the following output:<br />
<br />
Change Dir: /Users/danielmaloney/Documents/Unvanquished/build-xcode/CMakeFiles/CMakeTmp<br />
<br />
<br />
<br />
Run Build Command:/Applications/CMake\ 2.8-8.app/Contents/bin/cmakexbuild<br />
-project CMAKE_TRY_COMPILE.xcodeproj build -target<br />
cmTryCompileExec1400153232 -configuration Debug<br />
<br />
Error: No developer directory found at /Developer. Run<br />
/usr/bin/xcode-select to update the developer directory path.<br />
<br />
<br />
<br />
<br />
<br />
CMake will not be able to correctly generate this project.<br />
Call Stack (most recent call first):<br />
CMakeLists.txt:19 (project)<br />
<br />
This is due to Xcode 4.3 having a different directory structure to previous versions. Simply running the following command will correct this error:<br />
sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer/</div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Compiling_the_source&diff=1953Compiling the source2013-04-14T17:07:56Z<p>Velociostrich: /* MinGW */ Fix zlib library</p>
<hr />
<div>==Mac OS X==<br />
<br />
First, you need to [[Getting_the_source|acquire the source code]].<br />
<br />
Regardless of what interface you may use to compile the source, you will need [http://www.cmake.org/cmake/resources/software.html CMake] to generate makefiles. You will also need to install [https://developer.apple.com/xcode/ Xcode] (making sure to choose to install the command-line utilities when prompted by the installer).<br />
<br />
Then, you will need to acquire (and in some cases, manually compile) at a minimum the [[#Dependencies|necessary libraries]].<br />
<br />
Once you have the source code and the libraries installed, you may actually proceed to compile the source. You have several options:<br />
* '''Compile the source at the command line'''. This is the easiest if you would just like to compile the game to use yourself and you do not intend to work on the code.<br />
* '''Compile the source using an IDE'''. This is preferred if you intend on developing the source.<br />
** Xcode is Apple's flagship IDE and you should have installed to compile the source regardless of which method you use.<br />
** [http://qt-project.org/downloads QtCreator] is cross-platform and provides real-time feedback of syntax errors, a Vim mode, as well as other features.<br />
** [http://www.codeblocks.org/ Code::Blcoks] is also cross-platform but lacks some of the features of Xcode and QtCreator.<br />
<br />
===Dependencies===<br />
<br />
You only need to use one of the following methods (HomeBrew or compiling by hand). Please try and avoid mixing methods as this may produce unexpected results.<br />
<br />
Unvanquished requires the following libraries:<br />
* [[#JPEG|JPEG]], version 8 or higher. (Version 6 was known to have problems)<br />
* [[#Simple_DirectMedia_Layer_.28SDL.29|Simple DirectMedia Layer]] (The binary provided by libsdl.org causes graphical corruptions. Compile from source or use homebrew/macports)<br />
* [[#The_OpenGL_Extension_Wrangler_Library_.28GLEW.29|The OpenGL Extension Wrangler Library]]<br />
* CuRL<br />
* [[#The_GNU_MP_Bignum_Library_.28libgmp.29|GMP]]<br />
* [[#WebP|WebP]] (v0.2.0 or newer)<br />
<br />
The following libraries are optional:<br />
* Theora<br />
* Speex<br />
* [[#Ogg|Ogg]]<br />
* [[#Vorbis|Vorbis]]<br />
<br />
====HomeBrew====<br />
Install [http://mxcl.github.com/homebrew/ HomeBrew] and then run the following command<br />
<br />
$ brew install nettle libjpeg curl sdl webp xvid gmp glew speex libvorbis theora<br />
<br />
All the necessary libraries should now have been installed.<br />
<br />
====Compiling by hand====<br />
The following are shell scripts that download, compile, and install various libraries. This is more time consuming then other methods but might be useful if you need more control over your libraries<br />
<br />
=====JPEG=====<br />
<br />
$ curl http://www.ijg.org/files/jpegsrc.v8d.tar.gz > jpegsrc.v8d.tar.gz<br />
$ tar xvzf jpegsrc.v8d.tar.gz<br />
$ cd jpeg-8d<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The OpenGL Extension Wrangler Library (GLEW)=====<br />
<br />
$ curl -L https://sourceforge.net/projects/glew/files/glew/1.7.0/glew-1.7.0.tgz/download > glew-1.7.0.tgz<br />
$ tar xvzf glew-1.7.0.tgz<br />
$ cd glew-1.7.0<br />
$ make<br />
$ sudo make install<br />
<br />
=====Simple DirectMedia Layer (SDL)=====<br />
<br />
Do not use the binaries provided by libsdl.org, as these are known to cause issues with gamma and color display. Instead, compile your own:<br />
<br />
$ curl http://www.libsdl.org/release/SDL-1.2.15.tar.gz > SDL-1.2.15.tar.gz<br />
$ tar xvzf SDL-1.2.15.tar.gz<br />
$ cd SDL-1.2.15<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The GNU MP Bignum Library (libgmp)=====<br />
<br />
$ curl ftp://ftp.gmplib.org/pub/gmp-5.0.5/gmp-5.0.5.tar.bz2 > gmp-5.0.5.tar.bz2<br />
$ tar xvjf gmp-5.0.5.tar.bz2<br />
$ cd gmp-5.0.5<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Ogg=====<br />
<br />
$ curl http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz > libogg-1.3.0.tar.gz<br />
$ tar xvzf libogg-1.3.0.tar.gz<br />
$ cd libogg-1.3.0<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Vorbis=====<br />
<br />
$ curl http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz > libvorbis-1.3.3.tar.gz<br />
$ tar xvzf libvorbis-1.3.3.tar.gz<br />
$ cd libvorbis-1.3.3<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====WebP=====<br />
<br />
You do not need to compile WebP by hand; Google provides binaries for Mac OS X available from their [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0-mac-10.5.tar.gz project page]. You will need version 0.2.0 or newer.<br />
<br />
Once downloaded, you must still install the header files and the binary:<br />
<br />
$ curl https://webp.googlecode.com/files/libwebp-0.2.0-mac-10.5.tar.gz > libwebp-0.2.0-mac-10.5.tar.gz<br />
$ tar xvzf libwebp-0.2.0-mac-10.5.tar.gz<br />
$ cd libwebp-0.2.0-mac-10.5<br />
$ sudo cp include/webp /usr/local/include<br />
$ sudo cp lib/libwebp.a /usr/local/lib<br />
<br />
===Configuring with CMake===<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 should be a different directory.<br />
# Hit "Configure". You will be prompted as to which generator you would like to use. If you have Xcode installed, choose that. Wait while the configuration process runs. You may have to set the following:<br />
## If CMake did not find your jpeg headers for some reason, set <code>JPEG_INCLUDE_DIR</code> to <code>/path/to/Unvanquished/src/libs/jpeg</code>.<br />
## Check <code>USE_INTERNAL_CRYPTO</code> to avoid having to compile nettle and hogweed.<br />
## Check <code>USE_INTERNAL_SPEEX</code> to avoid having to compile Speex.<br />
## Uncheck <code>USE_CIN_THEORA</code> and <code>USE_CIN_XVID</code> to avoid having to compile Theora or Xvid. (At present, there are not cutscenes or any such that require it.)<br />
## '''You will probably not be able to compile with the GLSL optimizer enabled; uncheck <code>USE_GLSL_OPTIMIZER</code>'''<br />
## If you have selected to generate Xcode project files, make the <code>SDLMAIN_LIBRARY</code> field blank. This option is not available if you have the generator set to Unix makefiles.<br />
# Hit "Generate".<br />
# You may now close Xcode.<br />
<br />
===Compiling===<br />
<br />
====With Xcode====<br />
<br />
<ol><br />
<li>Compilation will fail unless you manually create certain directories needed by the build scripts:<br />
<pre><br />
$ cd /path/to/build/dir/CMakeFiles<br />
$ mkdir gpp{game,trem,ui}-qvm.dir<br />
</pre><br />
This is a workaround to {{Issue|101}}.<br />
</li><br />
<li>Either start Xcode and open the project file (in the build directory you specified) or double-click the project file in Finder.</li><br />
<li>Open the project file created by CMake, which should be in the build directory you specified.</li><br />
<li>Change the active target to "ALL_BUILD" and click Product&rarr;Build.</li><br />
</ol><br />
<br />
====With Unix Makefiles====<br />
<br />
<ul><br />
<li>Start Terminal (Applications &rarr; Utilities &rarr; Terminal).</li><br />
<li>Input the following commands:<br />
<pre><br />
$ cd /path/to/Unvanquished-build<br />
$ make<br />
</pre><br />
If you are on a multi-core or multi-processor machine, you may speed up the process by passing the <code>-j</code> argument followed by the number of available cores to <code>make</code>; e.g., <code>make -j4</code>. Note that doing so makes reading error messages more difficult, as multiple instances of the compiler will print to the screen at once, causing information to appear out of order.<br />
</li><br />
</ul><br />
<br />
===Testing the build===<br />
<br />
====With Xcode 4====<br />
<br />
To test the game, select the "client" scheme from the combo box on the toolbar, and click the run button or press {{Hotkey|MacCommand}}{{Hotkey|R}}.<br />
<br />
====With Unix Makefiles====<br />
<br />
After compiling, you'll have to place the data files in the <code>main</code> directory in your build directory. [[#Acquiring the Game Files|For download instructions, see below.]]<br />
<br />
Your file structure should look as follows:<br />
<br />
[[File:Build_dir_Mac_OS_X.png]]<br />
<br />
You may now start the application as such:<br />
<br />
$ ./daemon.i386<br />
<br />
Note that older machines will not support the new OpenGL 3 renderer, and must be started specifying the "vanilla" (aka "GL") renderer:<br />
<br />
$ ./daemon.i386 +set cl_renderer GL<br />
<br />
===Bundling the Application===<br />
<br />
====With CPack====<br />
<br />
CPack is able to create standalone bundles (as well as many other types of installers). However you must generate the files using Unix Makefiles instead of Xcode.<br />
<br />
$ cd /path/to/Unvanquished-build<br />
$ cpack -G Bundle<br />
<br />
Some warnings will be printed however these can be safely ignored. There should be a file called Unvanquished.dmg in the Unvanquished-build folder.<br />
<br />
====Manually====<br />
<br />
You'll find the Mac [http://macdylibbundler.sourceforge.net/ dynamic library bundler] to be quite useful (you must generate the files using Unix Makefiles instead of Xcode):<br />
<br />
$ curl -L http://sourceforge.net/projects/macdylibbundler/files/macdylibbundler/0.4.1/dylibbundler0.4.1.zip/download > \<br />
dylibbundler0.4.1.zip<br />
$ unzip dylibbundler0.4.1.zip<br />
$ cd dylibbundler<br />
$ make<br />
$ sudo make install<br />
<br />
Once you've done that, you can proceed to create the application bundle. Note that these steps assume that you have downloaded the data files to <code>main/</code> as shown above:<br />
<br />
<pre><br />
$ git=/path/to/Unvanquished-git-repo<br />
$ build=/path/to/Unvanquished-build-dir<br />
$ mkdir -pv Unvanquished.app/Contents/{libs,MacOS,Resources,Frameworks}<br />
$ cp -r $build/main Unvanquished.app/Contents/MacOS<br />
$ sips -s format tiff $git/debian/unvanquished.png --out temp.tiff<br />
$ tiff2icns temp.tiff Unvanquished.app/Contents/Resources/Unvanquished.icns<br />
$ rm temp.tiff<br />
$ cp $build/daemon{,ded}.i386 $build/*.dylib Unvanquished.app/Contents/MacOS<br />
$ cp -r /Library/Frameworks/SDL.framework Unvanquished.app/Contents/Frameworks<br />
$ install_name_tool -id \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/Frameworks/SDL.framework/Versions/A/SDL<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGLi386.dylib<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGL3i386.dylib<br />
$ for binary in Unvanquished.app/Contents/MacOS/*.{i386,dylib}; do<br />
dylibbundler -b -x $binary -d $dest/Unvanquished.app/Contents/libs/; done<br />
$ cp /usr/lib/libGLEW.1.7.0.dylib ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ chmod +w ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -id @executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -change /usr/lib/libGLEW.1.7.0.dylib \<br />
@executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ cat > Unvanquished.app/Contents/Info.plist<br />
<?xml version="1.0" encoding="UTF-8"?><br />
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"<br />
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"><br />
<plist version="1.0"><br />
<dict><br />
<key>CFBundleName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleDisplayName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleExecutable</key><br />
<string>daemon.i386</string><br />
<key>CFBundleIconFile</key><br />
<string>Unvanquished.icns</string><br />
<key>CFBundleIdentifier</key><br />
<string>net.Unvanquished</string><br />
<key>CFBundleInfoDictionaryVersion</key><br />
<string>6.0</string><br />
<key>CFBundlePackageType</key><br />
<string>APPL</string><br />
<key>CFBundleShortVersionString</key><br />
<string>0.4.0</string><br />
<key>CFBundleVersion</key><br />
<string>0.4.0</string><br />
</dict><br />
</plist><br />
^d<br />
</pre><br />
<br />
Note: <code>^d</code> indicates pressing {{Hotkey|Ctrl}}{{Hotkey|D}} on the keyboard.<br />
<br />
The contents of the completed application bundle should look like this:<br />
<br />
[[File:Bundle_dir_Mac_OS_X.png]]<br />
<br />
'''Note''': If you compiled SDL from source, you will not see a directory titled <code>SDL.framework</code>.<br />
<br />
==Windows==<br />
<br />
===Visual Studio===<br />
<br />
CMake can generate Visual Studio projects for unvanquished however this feature is relatively new and may have some bugs.<br />
<br />
Steps:<br />
<br />
# Double click on Visual_Studio32.bat<br />
# Open build-32/Daemon.sln in Visual Studio 2010.<br />
# In the two text boxes in the toolbar, select "Release" or "Debug" in the first one and Win32 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 />
====Important Notes====<br />
<br />
* LLVM is disabled and does not work correctly with CMake generated Visual Studio projects.<br />
* ncurses is not supported under Visual Studio.<br />
* The path to the build folder must not have any spaces otherwise generation of QVMs will fail. See [https://github.com/Unvanquished/Unvanquished/issues/102 issue 102]<br />
* Due to limitations with cmake neither the startup project nor the working directory can be specified. These must be manually set to the following values for debugging the client under Visual Studio<br />
** Right click on client and select "Set as StartUp project".<br />
** Right click on client, select properties, select Debugging and set "Working Directory" to $(TargetPath)\..<br />
<br />
===MinGW===<br />
<br />
Unvanquished is supported under MinGW. The build process should be fairly similar to the Linux instructions.<br />
<br />
The easiest way to acquire and install MinGW is with the graphical [http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/ mingw-get-inst installer]. <!-- TODO: maybe walk the user through the installer? --><br />
<br />
When configuring the build with CMake, you will find that you will have to set a number of libraries manually. You can find precompiled DLLs for most of the dependencies; those that are not pre-compiled can be built with the corresponding <code>USE_INTERNAL_</code> setting.<br />
<br />
On Windows, SDL requires that the Direct X SDK can be installed. You may download the June 2010 release from [http://www.microsoft.com/en-us/download/details.aspx?id=6812 Microsoft's site].<br />
<br />
The easiest way to get a build up (at the time of writing) is as follows: <!-- FIXME: incomplete --><br />
<br />
{{Note|content=Be aware that some of these paths are for the 64 bit versions of libraries; if you are on a 32-bit system, you will need to change some of these paths. The easiest way to locate libraries is to navigate in Windows Explorer to the <code>src/libs</code> directory and search for files matching <code>dll</code>.}}<br />
<br />
<ol><br />
<li>Although there are binaries of gmp distributed with the source, they have are dependent on Visual Studio's implementations of <code>_ftol2_sse</code> and <code>_alloca_probe_16</code>. A fix may be found on [http://stackoverflow.com/questions/6753111/static-linking-with-openssl Stack Exchange], but requires that Visual Studio be installed, which defeats the purpose of attempting to use MinGW to compile the source. You can build gmp yourself:<br />
<ol><br />
<li>Download and extract the latest version of the [http://gmplib.org/ GNU MP Bignum Library (GMP)]. (You will need either cygwin with tar and bz2 installed or 7-zip to extract the archive.)</li><br />
<li>Install the following Cygwin packages if you have not already:<br />
* binutils<br />
* gcc<br />
* gcc-g++<br />
* m4<br />
* make<br />
</li><br />
<li>As part of the GMP compilation process, a file called <code>gen-fib.c</code> generates a table of numbers in the Fibonacci sequence. The generated file does not play nicely with Cygwin or MinGW, so you must fix it. Edit <code>gen-fib.c</code>, and at around line 100, change these lines<br />
<pre><br />
for (i = 0; i < fnum; i++)<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
printf ("), /* %d */\n", i-1);<br />
}<br />
printf ("};\n");<br />
</pre><br />
to look like this:<br />
<pre><br />
for (i = 0; i < fnum; i++)<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
printf (")%c /* %d */\n", (i == (fnum-1)) ? ' ' : ',', i-1);<br />
}<br />
printf ("};\n");<br />
</pre><br />
The patch file looks like this:<br />
<pre><br />
@@ -100,7 +100,7 @@<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
- printf ("), /* %d */\n", i-1);<br />
+ printf (")%c /* %d */\n", (i == (fnum-1)) ? ' ' : ',', i-1);<br />
}<br />
printf ("};\n");<br />
}<br />
</pre><br />
</li><br />
<li>Compiling with MinGW does not work, so you will need to compile with Cygwin. At the prompt:<br />
<pre><br />
$ ./configure --disable-static --enable-shared<br />
$ make<br />
</pre><br />
The <code>--disable-static</code> and <code>--enable-shared</code> flags configure GMP to build a DLL instead of a static library. You may optionally perform <code>make install</code>. Additional compilation instructions [http://www.cs.nyu.edu/exact/core/gmp/ are available].<br />
<p>If you experience difficulties with compilation and it appears that MinGW gcc is being detected by <code>configure</code> and not Cygwin gcc, you can try editing your <code>PATH</code> variable:</p><br />
<pre><br />
$ export PATH=`echo $PATH | sed "s|/cygdrive/c/MinGW/bin:||"`<br />
</pre><br />
Re-run <code>configure</code> and <code>make</code> afterwards.<br />
</ol><br />
</li><br />
<li>Set the following CMake flags:<br />
{| class="wikitable"<br />
! Setting<br />
! Description<br />
! Type<br />
! Value<br />
|-<br />
| <code>USE_INTERNAL_CRYPTO</code><br />
| Use the provided copies of crypto libraries. <!-- FIXME: I think these are nettle and something else --><br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_GLEW</code><br />
| Use the provided copy of GLEW.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_JPEG</code><br />
| Use the provided copy of JPEG.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SDL</code><br />
| Use the provided copy of SDL.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SPEEX</code><br />
| Use the provided copy of Speex.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_WEBP</code><br />
| Use the provided copy of WebP.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_CURSES</code><br />
| Enables/disables curses.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>PNG_LIBRARY</code><br />
| Path to the PNG library DLL.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng/libs/win32/libpng.lib</code><br />
|-<br />
| <code>PNG_PNG_INCLUDE_DIR</code><br />
| Path to the PNG library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng</code><br />
|-<br />
| <code>FREETYPE_LIBRARY</code><br />
| Path to the compiled FreeType library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/lib/freetype.lib</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_freetype2</code><br />
| Path to the FreeType library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/freetype2</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_ft2build</code><br />
| Path to the FreeType library file "ftbuild.h".<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/</code><br />
|-<br />
| <code>GMP_INCLUDE_DIR</code><br />
| Path to the GMP library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/gmp/include</code><br />
|-<br />
| <code>GMP_LIBRARY</code><br />
| Path to the GMP library.<br />
| <code>FILEPATH</code><br />
| <code><var>path/to/compiled/gmp/</var>.libs/cyggmp-10.dll</code><br />
|-<br />
| <code>ZLIB_INCLUDE_DIR</code><br />
| Path to the zlib library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/include</code><br />
|-<br />
| <code>ZLIB_LIBRARY</code><br />
| Path to the zlib library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/lib/x32/zlib1.dll</code><br />
|-<br />
| <code>CURL_LIBRARY</code><br />
| Path to the CURL library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/lib/win32/release/libcurl.dll</code><br />
|-<br />
| <code>CURL_INCLUDE_DIR</code><br />
| Path to the zlib library.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/include/curl</code><br />
|-<br />
| <code>USE_OPENAL</code><br />
| Enables/disables OpenAL support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_THEORA</code><br />
| Enables/disables Theora support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_XVID</code><br />
| Enables/disables Xvid support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CODEC_THEORA</code><br />
| Enables/disables Ogg support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>SDLMAIN_LIBRARY</code><br />
| Enables/disables Ogg support.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code><br />
|-<br />
|}<br />
Do note that CMake is slash-direction&ndash;agnostic; it can handle both forward- and backslashes on Windows.<br />
</li><br />
<li>Open <code><var>SourcePath</var>/CMakeLists.txt</code> and edit the line<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi z )<br />
</pre><br />
(around line 1040) to look like this:<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi )<br />
</pre><br />
</li><br />
<li>Open <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code> and edit the lines:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "SDL.h"<br />
#include "SDL_main.h"<br />
</pre><br />
to look like:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "../../../include/SDL.h"<br />
#include "../../../include/SDL_main.h"<br />
</pre><br />
<li>Open a terminal and <code>cd</code> to your source directory.</li><br />
<li>Run <code>make</code>:<br />
<pre><br />
> mingw32-make<br />
</pre><br />
If you would like verbose output, set the <code>VERBOSE</code> environment variable before running <code>make</code>.<br />
<pre><br />
> set VERBOSE=1<br />
</pre><br />
</li><br />
</ol><br />
<br />
====Notes====<br />
<br />
* If you would like to use curses, try using [http://sourceforge.net/projects/pdcurses/files/pdcurses PDCurses].<br />
<br />
===QtCreator===<br />
<br />
# Install MinGW and follow the above instructions, except select Code::Blocks as the generator.<br />
# Start QtCreator, and select "Open File or Project&hellip;" from the File menu.<br />
# Navigate to your source directory and open CMakeLists.txt.<br />
# At the CMake Wizard, select the same build directory you already configured using CMake. (If you did not chose Code::Blocks as the generator, you will have to start over again, as QtCreator requires a Code::Blocks project file in order to compile the source.)<br />
# Ensure that a generator is selected in the combo box, and click "Run CMake". If there is no generator listed, see the [[#Troubleshooting|troubleshooting]] section below.<br />
# Click "Finish" to close the wizard.<br />
<br />
You should now be able to compile, run, and debug the code using QtCreator.<br />
<br />
====Troubleshooting====<br />
<br />
If at the "Run CMake" prompt of the the CMake Wizard, select "Run CMake" and are warned that no generator was selected, and notice that there are no generators in the combo box, you will likely have to [http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html manually configure your toolchain]. Select "Options&hellip;" from the "Tools" menu, then navigate to "Build &amp; Run".<br />
<br />
At the options window,<br />
* Go to the "Kits" tab, and mouse over the "Desktop (default)" kit under "Manual". If there were any errors in configuring this kit, they will be displayed in the tool tip. If there are problems, select the kit. You may need to manually specify the location of the MinGW debugger, for example, which is typically <code>C:\MinGW\bin\gdb.exe</code>.<br />
* Go to the "Compilers" tab, and ensure that MinGW is present. If not, you will need to add it manually.<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 />
libgmp3-dev libjpeg8-dev libncurses5-dev libogg-dev libopenal-dev \<br />
libpng12-dev libsdl1.2-dev libvorbis-dev zlib1g-dev nettle-dev \<br />
libwebp-dev libspeexdsp-dev libtheora-dev<br />
<br />
If the version of WebP supplied by your version of Debian or Ubuntu is older than v0.2.0, you will need to [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0.tar.gz download] and [https://developers.google.com/speed/webp/docs/compiling#unix compile it from source]. After compiling and installing with <code>sudo make install</code>, in CMake, you'll need to set <code>WEBP_INCLUDE_DIR</code> to <code>/usr/local/include/webp</code> and <code>WEBP_LIBRARY</code> to <code>/usr/local/lib/libwebp.so</code>.<br />
<br />
'''We currently provide a ready-to-use libwebp-dev in our [http://{{SERVERNAME}}/index.php/Download#ubuntu Debian and Ubuntu repositories], alongside .debs of the game and server.'''<br />
<br />
Actual dev package names may vary, e.g. libgmp-dev instead of libgmp3-dev and libglew-dev or libglew1.7-dev instead of libglew1.5-dev.<br />
<br />
Since we have a debian directory in the source, you can also to check what's needed then install the listed packages (choosing from alternatives as needed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ dpkg-checkbuilddeps<br />
…<br />
$ sudo apt-get install <var>package(s)</var><br />
<br />
If dpkg-checkbuilddeps produces no output, you have all necessary build dependencies. Also, debhelper's only needed if you're building .debs.<br />
<br />
====Gentoo====<br />
<br />
$ emerge curl freetype glew gmp jpeg ncurses libogg openal libpng libsdl libvorbis zlib<br />
<br />
====openSUSE====<br />
<br />
$ sudo install zypper gcc gcc-c++ Mesa-libGL-devel SDL-devel libjpeg8-devel \<br />
libpng12-devel glew-devel webp-devel ncurses-devel gmp-devel libcurl-devel \<br />
libnettle-devel openal-soft-devel speex-devel libvorbis-devel \<br />
libtheora-devel<br />
<br />
The latest version of WebP must be installed manually:<br />
<br />
$ wget https://webp.googlecode.com/files/libwebp-0.2.1.tar.gz<br />
$ tar xvzf libwebp-0.2.1.tar.gz<br />
$ cd libwebp-0.2.1<br />
$ ./configure && make<br />
$ sudo make install<br />
<br />
You must disable curses (set <code>USE_CURSES</code> appropriately in CMake) as failing to do so will cause Unvanquished to crash on startup.<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 />
On Debian or 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 />
Or, in Debian or Ubuntu, you can build a package (but you'll need to have devscripts and fakeroot installed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ fakeroot dpkg-buildpackage -b -uc<br />
$ sudo dpkg -i <var>../unvanquished_*.deb</var><br />
<br />
Once in <code>ccmake</code>, use the following keys:<br />
<br />
* Press {{Hotkey|c}} to configure. If an error occurs during this phase, make note of it and press {{Hotkey|e}} to dismiss it.<br />
* Use the up and down arrow keys to navigate the compilation options.<br />
* Press {{Hotkey|Enter}} to enable or disable boolean options (i.e., on/off) or to edit textual options.<br />
** Press {{Hotkey|Esc}} when editing a textual option to cancel the change.<br />
<br />
Once you have finished the configuration process, press {{Hotkey|C}} again, then {{Hotkey|G}} 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=====<br />
<br />
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_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 />
* <code>USE_CIN_THEORA</code> &mdash; Disabling this prevents videos from being recorded in Theora.<br />
* <code>USE_CIN_XVID</code> &mdash; Disabling this prevents videos from being recorded in Xvid.<br />
* <code>USE_VOIP</code> &mdash; Disabling this removes VOIP support. Alternatively enabling <code>USE_INTERNAL_SPEEX</code> will use the libraries distributed with Unvanquished for VoIP<br />
* <code>USE_INTERNAL_CRYPTO</code> &mdash; Enable this to use the crypto libraries provided by Unvanquished.<br />
<br />
===Compiling===<br />
<br />
$ cd <var>path/to/unvanquished/build</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 />
===Acquiring mandatory game files===<br />
<br />
The game files are not in the Git repository, and must be downloaded separately. This may be done on the command line or from your web browser. The downloads may be found on [http://sourceforge.net/projects/unvanquished/files/Assets SourceForge.net]. If you download the files from your browser, just download the files named "pak*.pk3", and save them to the [[Running_the_game#Data_locations|data location]] for your system.<br />
<br />
On Linux, this may be done as follows:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
wget -O $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On FreeBSD, using the <code>sh</code> shell:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
fetch -r -o $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On Mac OS X:<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
curl -L "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download" > $file<br />
fi<br />
done<br />
<br />
Linux users may also use the <code>download-pk3.sh</code> script that is distributed with the source code, which requires that curl be installed:<br />
<br />
$ cd <var>[path to Unvanquished source code]</var><br />
$ mkdir -p ~/.Unvanquished/main<br />
$ ./download-pk3.sh ~/.Unvanquished/main<br />
<br />
===Downloading the map pack===<br />
<br />
The map pack exists only for convenience; if you do not download the map pack, Unvanquished will automatically download maps as needed when you attempt to play online.<br />
<br />
To download the map pack on Linux:<br />
<br />
$ wget -O maps.7z "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z"; done<br />
<br />
To download the map pack on Mac OS X:<br />
<br />
$ curl -L "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z" > maps.7z; done<br />
<br />
Note that you will need to unzip the map pack on either system as it is compressed with LZMA. Mac users can use the [http://wakaba.c3.cx/s/apps/unarchiver.html Unarchiver]. Uncompressing the archive on Linux is highly dependent on your distribution.<br />
<br />
===Verifying the Files===<br />
<br />
Download the latest [http://sourceforge.net/projects/unvanquished/files/Assets/{{CurrentVersion|MD5HashFile}} MD5 hash file] and save it to your system's [[Running_the_game#Data_directory|data location]].<br />
<br />
On systems with the <code>md5</code> command (Mac OS X):<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ cat {{CurrentVersion|MD5HashFile}} | while read line; do<br />
file="`echo "$line" | sed -E "s/^[a-fA-F0-9]+ +\*?//"`"<br />
if [ -e "$file" ]; then<br />
if [ `md5 -r "$file" | cut -d\ -f1` = "`echo "$line" | cut -d\ -f1`" ]<br />
then echo "File \"$file\" appears okay."<br />
else echo "File \"$file\" is corrupt"'!' >&2<br />
fi; fi; done<br />
<br />
On systems with the <code>md5sum</code> command (most Linux distributions):<br />
<br />
$ cd <var>[[Running_the_game#Data_directory|/path/to/data/files]]</var><br />
$ md5sum -c {{CurrentVersion|MD5HashFile}} 2>&1 | grep -v "open or read\|file or directory"<br />
<br />
The <code>grep</code> invocation is used to strip output complaining about missing files.<br />
<br />
Any files that are found to be corrupt should be replaced; just download a [http://sourceforge.net/projects/unvanquished/files/Assets new copy] of the affected file(s).<br />
<br />
==Errors==<br />
<br />
===CMake cannot locate Newton===<br />
<br />
If CMake cannot find Newton, you'll need to set it up yourself.<br />
<br />
It should be in <code><var>/path/to/Unvanquished</var>/src/libs/libnewton/libs/<var>your_os</var>/libNewton.so</code>.<br />
Be sure to replace <var>your_os</var> with the proper directory name.<br />
<br />
Use CMake as before to change the <code>NEWTON_LIBRARY</code> build setting to the said path:<br />
<br />
# Start the CMake configurator:<pre>$ ccmake ..</pre><br />
# Scroll down and highlight <code>NEWTON_LIBRARY</code>.<br />
# Press {{Hotkey|Enter}} to begin editing and input in the path.<br />
# Press {{Hotkey|C}} to configure and {{Hotkey|G}} to generate the new makefiles.<br />
# Press {{Hotkey|Q}} to quit.<br />
# Recompile the source:<pre>$ make</pre><br />
<br />
===The C Compiler is not able to compile a simple test program===<br />
<br />
When attempting to generate a solution for Xcode CMake fails with the following error<br />
-- Check for working C compiler using: Xcode -- broken<br />
CMake Error at /Applications/CMake 2.8-8.app/Contents/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):<br />
The C compiler "/usr/bin/gcc" is not able to compile a simple test program.<br />
<br />
It fails with the following output:<br />
<br />
Change Dir: /Users/danielmaloney/Documents/Unvanquished/build-xcode/CMakeFiles/CMakeTmp<br />
<br />
<br />
<br />
Run Build Command:/Applications/CMake\ 2.8-8.app/Contents/bin/cmakexbuild<br />
-project CMAKE_TRY_COMPILE.xcodeproj build -target<br />
cmTryCompileExec1400153232 -configuration Debug<br />
<br />
Error: No developer directory found at /Developer. Run<br />
/usr/bin/xcode-select to update the developer directory path.<br />
<br />
<br />
<br />
<br />
<br />
CMake will not be able to correctly generate this project.<br />
Call Stack (most recent call first):<br />
CMakeLists.txt:19 (project)<br />
<br />
This is due to Xcode 4.3 having a different directory structure to previous versions. Simply running the following command will correct this error:<br />
sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer/</div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Compiling_the_source&diff=1952Compiling the source2013-04-14T17:04:59Z<p>Velociostrich: /* MinGW */ Update GMP_LIBRARY value</p>
<hr />
<div>==Mac OS X==<br />
<br />
First, you need to [[Getting_the_source|acquire the source code]].<br />
<br />
Regardless of what interface you may use to compile the source, you will need [http://www.cmake.org/cmake/resources/software.html CMake] to generate makefiles. You will also need to install [https://developer.apple.com/xcode/ Xcode] (making sure to choose to install the command-line utilities when prompted by the installer).<br />
<br />
Then, you will need to acquire (and in some cases, manually compile) at a minimum the [[#Dependencies|necessary libraries]].<br />
<br />
Once you have the source code and the libraries installed, you may actually proceed to compile the source. You have several options:<br />
* '''Compile the source at the command line'''. This is the easiest if you would just like to compile the game to use yourself and you do not intend to work on the code.<br />
* '''Compile the source using an IDE'''. This is preferred if you intend on developing the source.<br />
** Xcode is Apple's flagship IDE and you should have installed to compile the source regardless of which method you use.<br />
** [http://qt-project.org/downloads QtCreator] is cross-platform and provides real-time feedback of syntax errors, a Vim mode, as well as other features.<br />
** [http://www.codeblocks.org/ Code::Blcoks] is also cross-platform but lacks some of the features of Xcode and QtCreator.<br />
<br />
===Dependencies===<br />
<br />
You only need to use one of the following methods (HomeBrew or compiling by hand). Please try and avoid mixing methods as this may produce unexpected results.<br />
<br />
Unvanquished requires the following libraries:<br />
* [[#JPEG|JPEG]], version 8 or higher. (Version 6 was known to have problems)<br />
* [[#Simple_DirectMedia_Layer_.28SDL.29|Simple DirectMedia Layer]] (The binary provided by libsdl.org causes graphical corruptions. Compile from source or use homebrew/macports)<br />
* [[#The_OpenGL_Extension_Wrangler_Library_.28GLEW.29|The OpenGL Extension Wrangler Library]]<br />
* CuRL<br />
* [[#The_GNU_MP_Bignum_Library_.28libgmp.29|GMP]]<br />
* [[#WebP|WebP]] (v0.2.0 or newer)<br />
<br />
The following libraries are optional:<br />
* Theora<br />
* Speex<br />
* [[#Ogg|Ogg]]<br />
* [[#Vorbis|Vorbis]]<br />
<br />
====HomeBrew====<br />
Install [http://mxcl.github.com/homebrew/ HomeBrew] and then run the following command<br />
<br />
$ brew install nettle libjpeg curl sdl webp xvid gmp glew speex libvorbis theora<br />
<br />
All the necessary libraries should now have been installed.<br />
<br />
====Compiling by hand====<br />
The following are shell scripts that download, compile, and install various libraries. This is more time consuming then other methods but might be useful if you need more control over your libraries<br />
<br />
=====JPEG=====<br />
<br />
$ curl http://www.ijg.org/files/jpegsrc.v8d.tar.gz > jpegsrc.v8d.tar.gz<br />
$ tar xvzf jpegsrc.v8d.tar.gz<br />
$ cd jpeg-8d<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The OpenGL Extension Wrangler Library (GLEW)=====<br />
<br />
$ curl -L https://sourceforge.net/projects/glew/files/glew/1.7.0/glew-1.7.0.tgz/download > glew-1.7.0.tgz<br />
$ tar xvzf glew-1.7.0.tgz<br />
$ cd glew-1.7.0<br />
$ make<br />
$ sudo make install<br />
<br />
=====Simple DirectMedia Layer (SDL)=====<br />
<br />
Do not use the binaries provided by libsdl.org, as these are known to cause issues with gamma and color display. Instead, compile your own:<br />
<br />
$ curl http://www.libsdl.org/release/SDL-1.2.15.tar.gz > SDL-1.2.15.tar.gz<br />
$ tar xvzf SDL-1.2.15.tar.gz<br />
$ cd SDL-1.2.15<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The GNU MP Bignum Library (libgmp)=====<br />
<br />
$ curl ftp://ftp.gmplib.org/pub/gmp-5.0.5/gmp-5.0.5.tar.bz2 > gmp-5.0.5.tar.bz2<br />
$ tar xvjf gmp-5.0.5.tar.bz2<br />
$ cd gmp-5.0.5<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Ogg=====<br />
<br />
$ curl http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz > libogg-1.3.0.tar.gz<br />
$ tar xvzf libogg-1.3.0.tar.gz<br />
$ cd libogg-1.3.0<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Vorbis=====<br />
<br />
$ curl http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz > libvorbis-1.3.3.tar.gz<br />
$ tar xvzf libvorbis-1.3.3.tar.gz<br />
$ cd libvorbis-1.3.3<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====WebP=====<br />
<br />
You do not need to compile WebP by hand; Google provides binaries for Mac OS X available from their [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0-mac-10.5.tar.gz project page]. You will need version 0.2.0 or newer.<br />
<br />
Once downloaded, you must still install the header files and the binary:<br />
<br />
$ curl https://webp.googlecode.com/files/libwebp-0.2.0-mac-10.5.tar.gz > libwebp-0.2.0-mac-10.5.tar.gz<br />
$ tar xvzf libwebp-0.2.0-mac-10.5.tar.gz<br />
$ cd libwebp-0.2.0-mac-10.5<br />
$ sudo cp include/webp /usr/local/include<br />
$ sudo cp lib/libwebp.a /usr/local/lib<br />
<br />
===Configuring with CMake===<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 should be a different directory.<br />
# Hit "Configure". You will be prompted as to which generator you would like to use. If you have Xcode installed, choose that. Wait while the configuration process runs. You may have to set the following:<br />
## If CMake did not find your jpeg headers for some reason, set <code>JPEG_INCLUDE_DIR</code> to <code>/path/to/Unvanquished/src/libs/jpeg</code>.<br />
## Check <code>USE_INTERNAL_CRYPTO</code> to avoid having to compile nettle and hogweed.<br />
## Check <code>USE_INTERNAL_SPEEX</code> to avoid having to compile Speex.<br />
## Uncheck <code>USE_CIN_THEORA</code> and <code>USE_CIN_XVID</code> to avoid having to compile Theora or Xvid. (At present, there are not cutscenes or any such that require it.)<br />
## '''You will probably not be able to compile with the GLSL optimizer enabled; uncheck <code>USE_GLSL_OPTIMIZER</code>'''<br />
## If you have selected to generate Xcode project files, make the <code>SDLMAIN_LIBRARY</code> field blank. This option is not available if you have the generator set to Unix makefiles.<br />
# Hit "Generate".<br />
# You may now close Xcode.<br />
<br />
===Compiling===<br />
<br />
====With Xcode====<br />
<br />
<ol><br />
<li>Compilation will fail unless you manually create certain directories needed by the build scripts:<br />
<pre><br />
$ cd /path/to/build/dir/CMakeFiles<br />
$ mkdir gpp{game,trem,ui}-qvm.dir<br />
</pre><br />
This is a workaround to {{Issue|101}}.<br />
</li><br />
<li>Either start Xcode and open the project file (in the build directory you specified) or double-click the project file in Finder.</li><br />
<li>Open the project file created by CMake, which should be in the build directory you specified.</li><br />
<li>Change the active target to "ALL_BUILD" and click Product&rarr;Build.</li><br />
</ol><br />
<br />
====With Unix Makefiles====<br />
<br />
<ul><br />
<li>Start Terminal (Applications &rarr; Utilities &rarr; Terminal).</li><br />
<li>Input the following commands:<br />
<pre><br />
$ cd /path/to/Unvanquished-build<br />
$ make<br />
</pre><br />
If you are on a multi-core or multi-processor machine, you may speed up the process by passing the <code>-j</code> argument followed by the number of available cores to <code>make</code>; e.g., <code>make -j4</code>. Note that doing so makes reading error messages more difficult, as multiple instances of the compiler will print to the screen at once, causing information to appear out of order.<br />
</li><br />
</ul><br />
<br />
===Testing the build===<br />
<br />
====With Xcode 4====<br />
<br />
To test the game, select the "client" scheme from the combo box on the toolbar, and click the run button or press {{Hotkey|MacCommand}}{{Hotkey|R}}.<br />
<br />
====With Unix Makefiles====<br />
<br />
After compiling, you'll have to place the data files in the <code>main</code> directory in your build directory. [[#Acquiring the Game Files|For download instructions, see below.]]<br />
<br />
Your file structure should look as follows:<br />
<br />
[[File:Build_dir_Mac_OS_X.png]]<br />
<br />
You may now start the application as such:<br />
<br />
$ ./daemon.i386<br />
<br />
Note that older machines will not support the new OpenGL 3 renderer, and must be started specifying the "vanilla" (aka "GL") renderer:<br />
<br />
$ ./daemon.i386 +set cl_renderer GL<br />
<br />
===Bundling the Application===<br />
<br />
====With CPack====<br />
<br />
CPack is able to create standalone bundles (as well as many other types of installers). However you must generate the files using Unix Makefiles instead of Xcode.<br />
<br />
$ cd /path/to/Unvanquished-build<br />
$ cpack -G Bundle<br />
<br />
Some warnings will be printed however these can be safely ignored. There should be a file called Unvanquished.dmg in the Unvanquished-build folder.<br />
<br />
====Manually====<br />
<br />
You'll find the Mac [http://macdylibbundler.sourceforge.net/ dynamic library bundler] to be quite useful (you must generate the files using Unix Makefiles instead of Xcode):<br />
<br />
$ curl -L http://sourceforge.net/projects/macdylibbundler/files/macdylibbundler/0.4.1/dylibbundler0.4.1.zip/download > \<br />
dylibbundler0.4.1.zip<br />
$ unzip dylibbundler0.4.1.zip<br />
$ cd dylibbundler<br />
$ make<br />
$ sudo make install<br />
<br />
Once you've done that, you can proceed to create the application bundle. Note that these steps assume that you have downloaded the data files to <code>main/</code> as shown above:<br />
<br />
<pre><br />
$ git=/path/to/Unvanquished-git-repo<br />
$ build=/path/to/Unvanquished-build-dir<br />
$ mkdir -pv Unvanquished.app/Contents/{libs,MacOS,Resources,Frameworks}<br />
$ cp -r $build/main Unvanquished.app/Contents/MacOS<br />
$ sips -s format tiff $git/debian/unvanquished.png --out temp.tiff<br />
$ tiff2icns temp.tiff Unvanquished.app/Contents/Resources/Unvanquished.icns<br />
$ rm temp.tiff<br />
$ cp $build/daemon{,ded}.i386 $build/*.dylib Unvanquished.app/Contents/MacOS<br />
$ cp -r /Library/Frameworks/SDL.framework Unvanquished.app/Contents/Frameworks<br />
$ install_name_tool -id \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/Frameworks/SDL.framework/Versions/A/SDL<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGLi386.dylib<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGL3i386.dylib<br />
$ for binary in Unvanquished.app/Contents/MacOS/*.{i386,dylib}; do<br />
dylibbundler -b -x $binary -d $dest/Unvanquished.app/Contents/libs/; done<br />
$ cp /usr/lib/libGLEW.1.7.0.dylib ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ chmod +w ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -id @executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -change /usr/lib/libGLEW.1.7.0.dylib \<br />
@executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ cat > Unvanquished.app/Contents/Info.plist<br />
<?xml version="1.0" encoding="UTF-8"?><br />
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"<br />
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"><br />
<plist version="1.0"><br />
<dict><br />
<key>CFBundleName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleDisplayName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleExecutable</key><br />
<string>daemon.i386</string><br />
<key>CFBundleIconFile</key><br />
<string>Unvanquished.icns</string><br />
<key>CFBundleIdentifier</key><br />
<string>net.Unvanquished</string><br />
<key>CFBundleInfoDictionaryVersion</key><br />
<string>6.0</string><br />
<key>CFBundlePackageType</key><br />
<string>APPL</string><br />
<key>CFBundleShortVersionString</key><br />
<string>0.4.0</string><br />
<key>CFBundleVersion</key><br />
<string>0.4.0</string><br />
</dict><br />
</plist><br />
^d<br />
</pre><br />
<br />
Note: <code>^d</code> indicates pressing {{Hotkey|Ctrl}}{{Hotkey|D}} on the keyboard.<br />
<br />
The contents of the completed application bundle should look like this:<br />
<br />
[[File:Bundle_dir_Mac_OS_X.png]]<br />
<br />
'''Note''': If you compiled SDL from source, you will not see a directory titled <code>SDL.framework</code>.<br />
<br />
==Windows==<br />
<br />
===Visual Studio===<br />
<br />
CMake can generate Visual Studio projects for unvanquished however this feature is relatively new and may have some bugs.<br />
<br />
Steps:<br />
<br />
# Double click on Visual_Studio32.bat<br />
# Open build-32/Daemon.sln in Visual Studio 2010.<br />
# In the two text boxes in the toolbar, select "Release" or "Debug" in the first one and Win32 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 />
====Important Notes====<br />
<br />
* LLVM is disabled and does not work correctly with CMake generated Visual Studio projects.<br />
* ncurses is not supported under Visual Studio.<br />
* The path to the build folder must not have any spaces otherwise generation of QVMs will fail. See [https://github.com/Unvanquished/Unvanquished/issues/102 issue 102]<br />
* Due to limitations with cmake neither the startup project nor the working directory can be specified. These must be manually set to the following values for debugging the client under Visual Studio<br />
** Right click on client and select "Set as StartUp project".<br />
** Right click on client, select properties, select Debugging and set "Working Directory" to $(TargetPath)\..<br />
<br />
===MinGW===<br />
<br />
Unvanquished is supported under MinGW. The build process should be fairly similar to the Linux instructions.<br />
<br />
The easiest way to acquire and install MinGW is with the graphical [http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/ mingw-get-inst installer]. <!-- TODO: maybe walk the user through the installer? --><br />
<br />
When configuring the build with CMake, you will find that you will have to set a number of libraries manually. You can find precompiled DLLs for most of the dependencies; those that are not pre-compiled can be built with the corresponding <code>USE_INTERNAL_</code> setting.<br />
<br />
On Windows, SDL requires that the Direct X SDK can be installed. You may download the June 2010 release from [http://www.microsoft.com/en-us/download/details.aspx?id=6812 Microsoft's site].<br />
<br />
The easiest way to get a build up (at the time of writing) is as follows: <!-- FIXME: incomplete --><br />
<br />
{{Note|content=Be aware that some of these paths are for the 64 bit versions of libraries; if you are on a 32-bit system, you will need to change some of these paths. The easiest way to locate libraries is to navigate in Windows Explorer to the <code>src/libs</code> directory and search for files matching <code>dll</code>.}}<br />
<br />
<ol><br />
<li>Although there are binaries of gmp distributed with the source, they have are dependent on Visual Studio's implementations of <code>_ftol2_sse</code> and <code>_alloca_probe_16</code>. A fix may be found on [http://stackoverflow.com/questions/6753111/static-linking-with-openssl Stack Exchange], but requires that Visual Studio be installed, which defeats the purpose of attempting to use MinGW to compile the source. You can build gmp yourself:<br />
<ol><br />
<li>Download and extract the latest version of the [http://gmplib.org/ GNU MP Bignum Library (GMP)]. (You will need either cygwin with tar and bz2 installed or 7-zip to extract the archive.)</li><br />
<li>Install the following Cygwin packages if you have not already:<br />
* binutils<br />
* gcc<br />
* gcc-g++<br />
* m4<br />
* make<br />
</li><br />
<li>As part of the GMP compilation process, a file called <code>gen-fib.c</code> generates a table of numbers in the Fibonacci sequence. The generated file does not play nicely with Cygwin or MinGW, so you must fix it. Edit <code>gen-fib.c</code>, and at around line 100, change these lines<br />
<pre><br />
for (i = 0; i < fnum; i++)<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
printf ("), /* %d */\n", i-1);<br />
}<br />
printf ("};\n");<br />
</pre><br />
to look like this:<br />
<pre><br />
for (i = 0; i < fnum; i++)<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
printf (")%c /* %d */\n", (i == (fnum-1)) ? ' ' : ',', i-1);<br />
}<br />
printf ("};\n");<br />
</pre><br />
The patch file looks like this:<br />
<pre><br />
@@ -100,7 +100,7 @@<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
- printf ("), /* %d */\n", i-1);<br />
+ printf (")%c /* %d */\n", (i == (fnum-1)) ? ' ' : ',', i-1);<br />
}<br />
printf ("};\n");<br />
}<br />
</pre><br />
</li><br />
<li>Compiling with MinGW does not work, so you will need to compile with Cygwin. At the prompt:<br />
<pre><br />
$ ./configure --disable-static --enable-shared<br />
$ make<br />
</pre><br />
The <code>--disable-static</code> and <code>--enable-shared</code> flags configure GMP to build a DLL instead of a static library. You may optionally perform <code>make install</code>. Additional compilation instructions [http://www.cs.nyu.edu/exact/core/gmp/ are available].<br />
<p>If you experience difficulties with compilation and it appears that MinGW gcc is being detected by <code>configure</code> and not Cygwin gcc, you can try editing your <code>PATH</code> variable:</p><br />
<pre><br />
$ export PATH=`echo $PATH | sed "s|/cygdrive/c/MinGW/bin:||"`<br />
</pre><br />
Re-run <code>configure</code> and <code>make</code> afterwards.<br />
</ol><br />
</li><br />
<li>Set the following CMake flags:<br />
{| class="wikitable"<br />
! Setting<br />
! Description<br />
! Type<br />
! Value<br />
|-<br />
| <code>USE_INTERNAL_CRYPTO</code><br />
| Use the provided copies of crypto libraries. <!-- FIXME: I think these are nettle and something else --><br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_GLEW</code><br />
| Use the provided copy of GLEW.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_JPEG</code><br />
| Use the provided copy of JPEG.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SDL</code><br />
| Use the provided copy of SDL.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SPEEX</code><br />
| Use the provided copy of Speex.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_WEBP</code><br />
| Use the provided copy of WebP.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_CURSES</code><br />
| Enables/disables curses.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>PNG_LIBRARY</code><br />
| Path to the PNG library DLL.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng/libs/win32/libpng.lib</code><br />
|-<br />
| <code>PNG_PNG_INCLUDE_DIR</code><br />
| Path to the PNG library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng</code><br />
|-<br />
| <code>FREETYPE_LIBRARY</code><br />
| Path to the compiled FreeType library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/lib/freetype.lib</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_freetype2</code><br />
| Path to the FreeType library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/freetype2</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_ft2build</code><br />
| Path to the FreeType library file "ftbuild.h".<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/</code><br />
|-<br />
| <code>GMP_INCLUDE_DIR</code><br />
| Path to the GMP library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/gmp/include</code><br />
|-<br />
| <code>GMP_LIBRARY</code><br />
| Path to the GMP library.<br />
| <code>FILEPATH</code><br />
| <code><var>path/to/compiled/gmp/</var>.libs/cyggmp-10.dll</code><br />
|-<br />
| <code>ZLIB_INCLUDE_DIR</code><br />
| Path to the zlib library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/include</code><br />
|-<br />
| <code>ZLIB_LIBRARY</code><br />
| Path to the zlib library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/lib/x32/zlibstat.lib</code><br />
|-<br />
| <code>CURL_LIBRARY</code><br />
| Path to the CURL library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/lib/win32/release/libcurl.dll</code><br />
|-<br />
| <code>CURL_INCLUDE_DIR</code><br />
| Path to the zlib library.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/include/curl</code><br />
|-<br />
| <code>USE_OPENAL</code><br />
| Enables/disables OpenAL support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_THEORA</code><br />
| Enables/disables Theora support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_XVID</code><br />
| Enables/disables Xvid support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CODEC_THEORA</code><br />
| Enables/disables Ogg support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>SDLMAIN_LIBRARY</code><br />
| Enables/disables Ogg support.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code><br />
|-<br />
|}<br />
Do note that CMake is slash-direction&ndash;agnostic; it can handle both forward- and backslashes on Windows.<br />
</li><br />
<li>Open <code><var>SourcePath</var>/CMakeLists.txt</code> and edit the line<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi z )<br />
</pre><br />
(around line 1040) to look like this:<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi )<br />
</pre><br />
</li><br />
<li>Open <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code> and edit the lines:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "SDL.h"<br />
#include "SDL_main.h"<br />
</pre><br />
to look like:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "../../../include/SDL.h"<br />
#include "../../../include/SDL_main.h"<br />
</pre><br />
<li>Open a terminal and <code>cd</code> to your source directory.</li><br />
<li>Run <code>make</code>:<br />
<pre><br />
> mingw32-make<br />
</pre><br />
If you would like verbose output, set the <code>VERBOSE</code> environment variable before running <code>make</code>.<br />
<pre><br />
> set VERBOSE=1<br />
</pre><br />
</li><br />
</ol><br />
<br />
====Notes====<br />
<br />
* If you would like to use curses, try using [http://sourceforge.net/projects/pdcurses/files/pdcurses PDCurses].<br />
<br />
===QtCreator===<br />
<br />
# Install MinGW and follow the above instructions, except select Code::Blocks as the generator.<br />
# Start QtCreator, and select "Open File or Project&hellip;" from the File menu.<br />
# Navigate to your source directory and open CMakeLists.txt.<br />
# At the CMake Wizard, select the same build directory you already configured using CMake. (If you did not chose Code::Blocks as the generator, you will have to start over again, as QtCreator requires a Code::Blocks project file in order to compile the source.)<br />
# Ensure that a generator is selected in the combo box, and click "Run CMake". If there is no generator listed, see the [[#Troubleshooting|troubleshooting]] section below.<br />
# Click "Finish" to close the wizard.<br />
<br />
You should now be able to compile, run, and debug the code using QtCreator.<br />
<br />
====Troubleshooting====<br />
<br />
If at the "Run CMake" prompt of the the CMake Wizard, select "Run CMake" and are warned that no generator was selected, and notice that there are no generators in the combo box, you will likely have to [http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html manually configure your toolchain]. Select "Options&hellip;" from the "Tools" menu, then navigate to "Build &amp; Run".<br />
<br />
At the options window,<br />
* Go to the "Kits" tab, and mouse over the "Desktop (default)" kit under "Manual". If there were any errors in configuring this kit, they will be displayed in the tool tip. If there are problems, select the kit. You may need to manually specify the location of the MinGW debugger, for example, which is typically <code>C:\MinGW\bin\gdb.exe</code>.<br />
* Go to the "Compilers" tab, and ensure that MinGW is present. If not, you will need to add it manually.<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 />
libgmp3-dev libjpeg8-dev libncurses5-dev libogg-dev libopenal-dev \<br />
libpng12-dev libsdl1.2-dev libvorbis-dev zlib1g-dev nettle-dev \<br />
libwebp-dev libspeexdsp-dev libtheora-dev<br />
<br />
If the version of WebP supplied by your version of Debian or Ubuntu is older than v0.2.0, you will need to [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0.tar.gz download] and [https://developers.google.com/speed/webp/docs/compiling#unix compile it from source]. After compiling and installing with <code>sudo make install</code>, in CMake, you'll need to set <code>WEBP_INCLUDE_DIR</code> to <code>/usr/local/include/webp</code> and <code>WEBP_LIBRARY</code> to <code>/usr/local/lib/libwebp.so</code>.<br />
<br />
'''We currently provide a ready-to-use libwebp-dev in our [http://{{SERVERNAME}}/index.php/Download#ubuntu Debian and Ubuntu repositories], alongside .debs of the game and server.'''<br />
<br />
Actual dev package names may vary, e.g. libgmp-dev instead of libgmp3-dev and libglew-dev or libglew1.7-dev instead of libglew1.5-dev.<br />
<br />
Since we have a debian directory in the source, you can also to check what's needed then install the listed packages (choosing from alternatives as needed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ dpkg-checkbuilddeps<br />
…<br />
$ sudo apt-get install <var>package(s)</var><br />
<br />
If dpkg-checkbuilddeps produces no output, you have all necessary build dependencies. Also, debhelper's only needed if you're building .debs.<br />
<br />
====Gentoo====<br />
<br />
$ emerge curl freetype glew gmp jpeg ncurses libogg openal libpng libsdl libvorbis zlib<br />
<br />
====openSUSE====<br />
<br />
$ sudo install zypper gcc gcc-c++ Mesa-libGL-devel SDL-devel libjpeg8-devel \<br />
libpng12-devel glew-devel webp-devel ncurses-devel gmp-devel libcurl-devel \<br />
libnettle-devel openal-soft-devel speex-devel libvorbis-devel \<br />
libtheora-devel<br />
<br />
The latest version of WebP must be installed manually:<br />
<br />
$ wget https://webp.googlecode.com/files/libwebp-0.2.1.tar.gz<br />
$ tar xvzf libwebp-0.2.1.tar.gz<br />
$ cd libwebp-0.2.1<br />
$ ./configure && make<br />
$ sudo make install<br />
<br />
You must disable curses (set <code>USE_CURSES</code> appropriately in CMake) as failing to do so will cause Unvanquished to crash on startup.<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 />
On Debian or 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 />
Or, in Debian or Ubuntu, you can build a package (but you'll need to have devscripts and fakeroot installed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ fakeroot dpkg-buildpackage -b -uc<br />
$ sudo dpkg -i <var>../unvanquished_*.deb</var><br />
<br />
Once in <code>ccmake</code>, use the following keys:<br />
<br />
* Press {{Hotkey|c}} to configure. If an error occurs during this phase, make note of it and press {{Hotkey|e}} to dismiss it.<br />
* Use the up and down arrow keys to navigate the compilation options.<br />
* Press {{Hotkey|Enter}} to enable or disable boolean options (i.e., on/off) or to edit textual options.<br />
** Press {{Hotkey|Esc}} when editing a textual option to cancel the change.<br />
<br />
Once you have finished the configuration process, press {{Hotkey|C}} again, then {{Hotkey|G}} 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=====<br />
<br />
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_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 />
* <code>USE_CIN_THEORA</code> &mdash; Disabling this prevents videos from being recorded in Theora.<br />
* <code>USE_CIN_XVID</code> &mdash; Disabling this prevents videos from being recorded in Xvid.<br />
* <code>USE_VOIP</code> &mdash; Disabling this removes VOIP support. Alternatively enabling <code>USE_INTERNAL_SPEEX</code> will use the libraries distributed with Unvanquished for VoIP<br />
* <code>USE_INTERNAL_CRYPTO</code> &mdash; Enable this to use the crypto libraries provided by Unvanquished.<br />
<br />
===Compiling===<br />
<br />
$ cd <var>path/to/unvanquished/build</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 />
===Acquiring mandatory game files===<br />
<br />
The game files are not in the Git repository, and must be downloaded separately. This may be done on the command line or from your web browser. The downloads may be found on [http://sourceforge.net/projects/unvanquished/files/Assets SourceForge.net]. If you download the files from your browser, just download the files named "pak*.pk3", and save them to the [[Running_the_game#Data_locations|data location]] for your system.<br />
<br />
On Linux, this may be done as follows:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
wget -O $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On FreeBSD, using the <code>sh</code> shell:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
fetch -r -o $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On Mac OS X:<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
curl -L "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download" > $file<br />
fi<br />
done<br />
<br />
Linux users may also use the <code>download-pk3.sh</code> script that is distributed with the source code, which requires that curl be installed:<br />
<br />
$ cd <var>[path to Unvanquished source code]</var><br />
$ mkdir -p ~/.Unvanquished/main<br />
$ ./download-pk3.sh ~/.Unvanquished/main<br />
<br />
===Downloading the map pack===<br />
<br />
The map pack exists only for convenience; if you do not download the map pack, Unvanquished will automatically download maps as needed when you attempt to play online.<br />
<br />
To download the map pack on Linux:<br />
<br />
$ wget -O maps.7z "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z"; done<br />
<br />
To download the map pack on Mac OS X:<br />
<br />
$ curl -L "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z" > maps.7z; done<br />
<br />
Note that you will need to unzip the map pack on either system as it is compressed with LZMA. Mac users can use the [http://wakaba.c3.cx/s/apps/unarchiver.html Unarchiver]. Uncompressing the archive on Linux is highly dependent on your distribution.<br />
<br />
===Verifying the Files===<br />
<br />
Download the latest [http://sourceforge.net/projects/unvanquished/files/Assets/{{CurrentVersion|MD5HashFile}} MD5 hash file] and save it to your system's [[Running_the_game#Data_directory|data location]].<br />
<br />
On systems with the <code>md5</code> command (Mac OS X):<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ cat {{CurrentVersion|MD5HashFile}} | while read line; do<br />
file="`echo "$line" | sed -E "s/^[a-fA-F0-9]+ +\*?//"`"<br />
if [ -e "$file" ]; then<br />
if [ `md5 -r "$file" | cut -d\ -f1` = "`echo "$line" | cut -d\ -f1`" ]<br />
then echo "File \"$file\" appears okay."<br />
else echo "File \"$file\" is corrupt"'!' >&2<br />
fi; fi; done<br />
<br />
On systems with the <code>md5sum</code> command (most Linux distributions):<br />
<br />
$ cd <var>[[Running_the_game#Data_directory|/path/to/data/files]]</var><br />
$ md5sum -c {{CurrentVersion|MD5HashFile}} 2>&1 | grep -v "open or read\|file or directory"<br />
<br />
The <code>grep</code> invocation is used to strip output complaining about missing files.<br />
<br />
Any files that are found to be corrupt should be replaced; just download a [http://sourceforge.net/projects/unvanquished/files/Assets new copy] of the affected file(s).<br />
<br />
==Errors==<br />
<br />
===CMake cannot locate Newton===<br />
<br />
If CMake cannot find Newton, you'll need to set it up yourself.<br />
<br />
It should be in <code><var>/path/to/Unvanquished</var>/src/libs/libnewton/libs/<var>your_os</var>/libNewton.so</code>.<br />
Be sure to replace <var>your_os</var> with the proper directory name.<br />
<br />
Use CMake as before to change the <code>NEWTON_LIBRARY</code> build setting to the said path:<br />
<br />
# Start the CMake configurator:<pre>$ ccmake ..</pre><br />
# Scroll down and highlight <code>NEWTON_LIBRARY</code>.<br />
# Press {{Hotkey|Enter}} to begin editing and input in the path.<br />
# Press {{Hotkey|C}} to configure and {{Hotkey|G}} to generate the new makefiles.<br />
# Press {{Hotkey|Q}} to quit.<br />
# Recompile the source:<pre>$ make</pre><br />
<br />
===The C Compiler is not able to compile a simple test program===<br />
<br />
When attempting to generate a solution for Xcode CMake fails with the following error<br />
-- Check for working C compiler using: Xcode -- broken<br />
CMake Error at /Applications/CMake 2.8-8.app/Contents/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):<br />
The C compiler "/usr/bin/gcc" is not able to compile a simple test program.<br />
<br />
It fails with the following output:<br />
<br />
Change Dir: /Users/danielmaloney/Documents/Unvanquished/build-xcode/CMakeFiles/CMakeTmp<br />
<br />
<br />
<br />
Run Build Command:/Applications/CMake\ 2.8-8.app/Contents/bin/cmakexbuild<br />
-project CMAKE_TRY_COMPILE.xcodeproj build -target<br />
cmTryCompileExec1400153232 -configuration Debug<br />
<br />
Error: No developer directory found at /Developer. Run<br />
/usr/bin/xcode-select to update the developer directory path.<br />
<br />
<br />
<br />
<br />
<br />
CMake will not be able to correctly generate this project.<br />
Call Stack (most recent call first):<br />
CMakeLists.txt:19 (project)<br />
<br />
This is due to Xcode 4.3 having a different directory structure to previous versions. Simply running the following command will correct this error:<br />
sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer/</div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Compiling_the_source&diff=1951Compiling the source2013-04-14T17:04:05Z<p>Velociostrich: /* MinGW */ GMP must be compiled from source because we can't use the provided binary.</p>
<hr />
<div>==Mac OS X==<br />
<br />
First, you need to [[Getting_the_source|acquire the source code]].<br />
<br />
Regardless of what interface you may use to compile the source, you will need [http://www.cmake.org/cmake/resources/software.html CMake] to generate makefiles. You will also need to install [https://developer.apple.com/xcode/ Xcode] (making sure to choose to install the command-line utilities when prompted by the installer).<br />
<br />
Then, you will need to acquire (and in some cases, manually compile) at a minimum the [[#Dependencies|necessary libraries]].<br />
<br />
Once you have the source code and the libraries installed, you may actually proceed to compile the source. You have several options:<br />
* '''Compile the source at the command line'''. This is the easiest if you would just like to compile the game to use yourself and you do not intend to work on the code.<br />
* '''Compile the source using an IDE'''. This is preferred if you intend on developing the source.<br />
** Xcode is Apple's flagship IDE and you should have installed to compile the source regardless of which method you use.<br />
** [http://qt-project.org/downloads QtCreator] is cross-platform and provides real-time feedback of syntax errors, a Vim mode, as well as other features.<br />
** [http://www.codeblocks.org/ Code::Blcoks] is also cross-platform but lacks some of the features of Xcode and QtCreator.<br />
<br />
===Dependencies===<br />
<br />
You only need to use one of the following methods (HomeBrew or compiling by hand). Please try and avoid mixing methods as this may produce unexpected results.<br />
<br />
Unvanquished requires the following libraries:<br />
* [[#JPEG|JPEG]], version 8 or higher. (Version 6 was known to have problems)<br />
* [[#Simple_DirectMedia_Layer_.28SDL.29|Simple DirectMedia Layer]] (The binary provided by libsdl.org causes graphical corruptions. Compile from source or use homebrew/macports)<br />
* [[#The_OpenGL_Extension_Wrangler_Library_.28GLEW.29|The OpenGL Extension Wrangler Library]]<br />
* CuRL<br />
* [[#The_GNU_MP_Bignum_Library_.28libgmp.29|GMP]]<br />
* [[#WebP|WebP]] (v0.2.0 or newer)<br />
<br />
The following libraries are optional:<br />
* Theora<br />
* Speex<br />
* [[#Ogg|Ogg]]<br />
* [[#Vorbis|Vorbis]]<br />
<br />
====HomeBrew====<br />
Install [http://mxcl.github.com/homebrew/ HomeBrew] and then run the following command<br />
<br />
$ brew install nettle libjpeg curl sdl webp xvid gmp glew speex libvorbis theora<br />
<br />
All the necessary libraries should now have been installed.<br />
<br />
====Compiling by hand====<br />
The following are shell scripts that download, compile, and install various libraries. This is more time consuming then other methods but might be useful if you need more control over your libraries<br />
<br />
=====JPEG=====<br />
<br />
$ curl http://www.ijg.org/files/jpegsrc.v8d.tar.gz > jpegsrc.v8d.tar.gz<br />
$ tar xvzf jpegsrc.v8d.tar.gz<br />
$ cd jpeg-8d<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The OpenGL Extension Wrangler Library (GLEW)=====<br />
<br />
$ curl -L https://sourceforge.net/projects/glew/files/glew/1.7.0/glew-1.7.0.tgz/download > glew-1.7.0.tgz<br />
$ tar xvzf glew-1.7.0.tgz<br />
$ cd glew-1.7.0<br />
$ make<br />
$ sudo make install<br />
<br />
=====Simple DirectMedia Layer (SDL)=====<br />
<br />
Do not use the binaries provided by libsdl.org, as these are known to cause issues with gamma and color display. Instead, compile your own:<br />
<br />
$ curl http://www.libsdl.org/release/SDL-1.2.15.tar.gz > SDL-1.2.15.tar.gz<br />
$ tar xvzf SDL-1.2.15.tar.gz<br />
$ cd SDL-1.2.15<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The GNU MP Bignum Library (libgmp)=====<br />
<br />
$ curl ftp://ftp.gmplib.org/pub/gmp-5.0.5/gmp-5.0.5.tar.bz2 > gmp-5.0.5.tar.bz2<br />
$ tar xvjf gmp-5.0.5.tar.bz2<br />
$ cd gmp-5.0.5<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Ogg=====<br />
<br />
$ curl http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz > libogg-1.3.0.tar.gz<br />
$ tar xvzf libogg-1.3.0.tar.gz<br />
$ cd libogg-1.3.0<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Vorbis=====<br />
<br />
$ curl http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz > libvorbis-1.3.3.tar.gz<br />
$ tar xvzf libvorbis-1.3.3.tar.gz<br />
$ cd libvorbis-1.3.3<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====WebP=====<br />
<br />
You do not need to compile WebP by hand; Google provides binaries for Mac OS X available from their [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0-mac-10.5.tar.gz project page]. You will need version 0.2.0 or newer.<br />
<br />
Once downloaded, you must still install the header files and the binary:<br />
<br />
$ curl https://webp.googlecode.com/files/libwebp-0.2.0-mac-10.5.tar.gz > libwebp-0.2.0-mac-10.5.tar.gz<br />
$ tar xvzf libwebp-0.2.0-mac-10.5.tar.gz<br />
$ cd libwebp-0.2.0-mac-10.5<br />
$ sudo cp include/webp /usr/local/include<br />
$ sudo cp lib/libwebp.a /usr/local/lib<br />
<br />
===Configuring with CMake===<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 should be a different directory.<br />
# Hit "Configure". You will be prompted as to which generator you would like to use. If you have Xcode installed, choose that. Wait while the configuration process runs. You may have to set the following:<br />
## If CMake did not find your jpeg headers for some reason, set <code>JPEG_INCLUDE_DIR</code> to <code>/path/to/Unvanquished/src/libs/jpeg</code>.<br />
## Check <code>USE_INTERNAL_CRYPTO</code> to avoid having to compile nettle and hogweed.<br />
## Check <code>USE_INTERNAL_SPEEX</code> to avoid having to compile Speex.<br />
## Uncheck <code>USE_CIN_THEORA</code> and <code>USE_CIN_XVID</code> to avoid having to compile Theora or Xvid. (At present, there are not cutscenes or any such that require it.)<br />
## '''You will probably not be able to compile with the GLSL optimizer enabled; uncheck <code>USE_GLSL_OPTIMIZER</code>'''<br />
## If you have selected to generate Xcode project files, make the <code>SDLMAIN_LIBRARY</code> field blank. This option is not available if you have the generator set to Unix makefiles.<br />
# Hit "Generate".<br />
# You may now close Xcode.<br />
<br />
===Compiling===<br />
<br />
====With Xcode====<br />
<br />
<ol><br />
<li>Compilation will fail unless you manually create certain directories needed by the build scripts:<br />
<pre><br />
$ cd /path/to/build/dir/CMakeFiles<br />
$ mkdir gpp{game,trem,ui}-qvm.dir<br />
</pre><br />
This is a workaround to {{Issue|101}}.<br />
</li><br />
<li>Either start Xcode and open the project file (in the build directory you specified) or double-click the project file in Finder.</li><br />
<li>Open the project file created by CMake, which should be in the build directory you specified.</li><br />
<li>Change the active target to "ALL_BUILD" and click Product&rarr;Build.</li><br />
</ol><br />
<br />
====With Unix Makefiles====<br />
<br />
<ul><br />
<li>Start Terminal (Applications &rarr; Utilities &rarr; Terminal).</li><br />
<li>Input the following commands:<br />
<pre><br />
$ cd /path/to/Unvanquished-build<br />
$ make<br />
</pre><br />
If you are on a multi-core or multi-processor machine, you may speed up the process by passing the <code>-j</code> argument followed by the number of available cores to <code>make</code>; e.g., <code>make -j4</code>. Note that doing so makes reading error messages more difficult, as multiple instances of the compiler will print to the screen at once, causing information to appear out of order.<br />
</li><br />
</ul><br />
<br />
===Testing the build===<br />
<br />
====With Xcode 4====<br />
<br />
To test the game, select the "client" scheme from the combo box on the toolbar, and click the run button or press {{Hotkey|MacCommand}}{{Hotkey|R}}.<br />
<br />
====With Unix Makefiles====<br />
<br />
After compiling, you'll have to place the data files in the <code>main</code> directory in your build directory. [[#Acquiring the Game Files|For download instructions, see below.]]<br />
<br />
Your file structure should look as follows:<br />
<br />
[[File:Build_dir_Mac_OS_X.png]]<br />
<br />
You may now start the application as such:<br />
<br />
$ ./daemon.i386<br />
<br />
Note that older machines will not support the new OpenGL 3 renderer, and must be started specifying the "vanilla" (aka "GL") renderer:<br />
<br />
$ ./daemon.i386 +set cl_renderer GL<br />
<br />
===Bundling the Application===<br />
<br />
====With CPack====<br />
<br />
CPack is able to create standalone bundles (as well as many other types of installers). However you must generate the files using Unix Makefiles instead of Xcode.<br />
<br />
$ cd /path/to/Unvanquished-build<br />
$ cpack -G Bundle<br />
<br />
Some warnings will be printed however these can be safely ignored. There should be a file called Unvanquished.dmg in the Unvanquished-build folder.<br />
<br />
====Manually====<br />
<br />
You'll find the Mac [http://macdylibbundler.sourceforge.net/ dynamic library bundler] to be quite useful (you must generate the files using Unix Makefiles instead of Xcode):<br />
<br />
$ curl -L http://sourceforge.net/projects/macdylibbundler/files/macdylibbundler/0.4.1/dylibbundler0.4.1.zip/download > \<br />
dylibbundler0.4.1.zip<br />
$ unzip dylibbundler0.4.1.zip<br />
$ cd dylibbundler<br />
$ make<br />
$ sudo make install<br />
<br />
Once you've done that, you can proceed to create the application bundle. Note that these steps assume that you have downloaded the data files to <code>main/</code> as shown above:<br />
<br />
<pre><br />
$ git=/path/to/Unvanquished-git-repo<br />
$ build=/path/to/Unvanquished-build-dir<br />
$ mkdir -pv Unvanquished.app/Contents/{libs,MacOS,Resources,Frameworks}<br />
$ cp -r $build/main Unvanquished.app/Contents/MacOS<br />
$ sips -s format tiff $git/debian/unvanquished.png --out temp.tiff<br />
$ tiff2icns temp.tiff Unvanquished.app/Contents/Resources/Unvanquished.icns<br />
$ rm temp.tiff<br />
$ cp $build/daemon{,ded}.i386 $build/*.dylib Unvanquished.app/Contents/MacOS<br />
$ cp -r /Library/Frameworks/SDL.framework Unvanquished.app/Contents/Frameworks<br />
$ install_name_tool -id \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/Frameworks/SDL.framework/Versions/A/SDL<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGLi386.dylib<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGL3i386.dylib<br />
$ for binary in Unvanquished.app/Contents/MacOS/*.{i386,dylib}; do<br />
dylibbundler -b -x $binary -d $dest/Unvanquished.app/Contents/libs/; done<br />
$ cp /usr/lib/libGLEW.1.7.0.dylib ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ chmod +w ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -id @executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -change /usr/lib/libGLEW.1.7.0.dylib \<br />
@executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ cat > Unvanquished.app/Contents/Info.plist<br />
<?xml version="1.0" encoding="UTF-8"?><br />
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"<br />
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"><br />
<plist version="1.0"><br />
<dict><br />
<key>CFBundleName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleDisplayName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleExecutable</key><br />
<string>daemon.i386</string><br />
<key>CFBundleIconFile</key><br />
<string>Unvanquished.icns</string><br />
<key>CFBundleIdentifier</key><br />
<string>net.Unvanquished</string><br />
<key>CFBundleInfoDictionaryVersion</key><br />
<string>6.0</string><br />
<key>CFBundlePackageType</key><br />
<string>APPL</string><br />
<key>CFBundleShortVersionString</key><br />
<string>0.4.0</string><br />
<key>CFBundleVersion</key><br />
<string>0.4.0</string><br />
</dict><br />
</plist><br />
^d<br />
</pre><br />
<br />
Note: <code>^d</code> indicates pressing {{Hotkey|Ctrl}}{{Hotkey|D}} on the keyboard.<br />
<br />
The contents of the completed application bundle should look like this:<br />
<br />
[[File:Bundle_dir_Mac_OS_X.png]]<br />
<br />
'''Note''': If you compiled SDL from source, you will not see a directory titled <code>SDL.framework</code>.<br />
<br />
==Windows==<br />
<br />
===Visual Studio===<br />
<br />
CMake can generate Visual Studio projects for unvanquished however this feature is relatively new and may have some bugs.<br />
<br />
Steps:<br />
<br />
# Double click on Visual_Studio32.bat<br />
# Open build-32/Daemon.sln in Visual Studio 2010.<br />
# In the two text boxes in the toolbar, select "Release" or "Debug" in the first one and Win32 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 />
====Important Notes====<br />
<br />
* LLVM is disabled and does not work correctly with CMake generated Visual Studio projects.<br />
* ncurses is not supported under Visual Studio.<br />
* The path to the build folder must not have any spaces otherwise generation of QVMs will fail. See [https://github.com/Unvanquished/Unvanquished/issues/102 issue 102]<br />
* Due to limitations with cmake neither the startup project nor the working directory can be specified. These must be manually set to the following values for debugging the client under Visual Studio<br />
** Right click on client and select "Set as StartUp project".<br />
** Right click on client, select properties, select Debugging and set "Working Directory" to $(TargetPath)\..<br />
<br />
===MinGW===<br />
<br />
Unvanquished is supported under MinGW. The build process should be fairly similar to the Linux instructions.<br />
<br />
The easiest way to acquire and install MinGW is with the graphical [http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/ mingw-get-inst installer]. <!-- TODO: maybe walk the user through the installer? --><br />
<br />
When configuring the build with CMake, you will find that you will have to set a number of libraries manually. You can find precompiled DLLs for most of the dependencies; those that are not pre-compiled can be built with the corresponding <code>USE_INTERNAL_</code> setting.<br />
<br />
On Windows, SDL requires that the Direct X SDK can be installed. You may download the June 2010 release from [http://www.microsoft.com/en-us/download/details.aspx?id=6812 Microsoft's site].<br />
<br />
The easiest way to get a build up (at the time of writing) is as follows: <!-- FIXME: incomplete --><br />
<br />
{{Note|content=Be aware that some of these paths are for the 64 bit versions of libraries; if you are on a 32-bit system, you will need to change some of these paths. The easiest way to locate libraries is to navigate in Windows Explorer to the <code>src/libs</code> directory and search for files matching <code>dll</code>.}}<br />
<br />
<ol><br />
<li>Although there are binaries of gmp distributed with the source, they have are dependent on Visual Studio's implementations of <code>_ftol2_sse</code> and <code>_alloca_probe_16</code>. A fix may be found on [http://stackoverflow.com/questions/6753111/static-linking-with-openssl Stack Exchange], but requires that Visual Studio be installed, which defeats the purpose of attempting to use MinGW to compile the source. You can build gmp yourself:<br />
<ol><br />
<li>Download and extract the latest version of the [http://gmplib.org/ GNU MP Bignum Library (GMP)]. (You will need either cygwin with tar and bz2 installed or 7-zip to extract the archive.)</li><br />
<li>Install the following Cygwin packages if you have not already:<br />
* binutils<br />
* gcc<br />
* gcc-g++<br />
* m4<br />
* make<br />
</li><br />
<li>As part of the GMP compilation process, a file called <code>gen-fib.c</code> generates a table of numbers in the Fibonacci sequence. The generated file does not play nicely with Cygwin or MinGW, so you must fix it. Edit <code>gen-fib.c</code>, and at around line 100, change these lines<br />
<pre><br />
for (i = 0; i < fnum; i++)<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
printf ("), /* %d */\n", i-1);<br />
}<br />
printf ("};\n");<br />
</pre><br />
to look like this:<br />
<pre><br />
for (i = 0; i < fnum; i++)<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
printf (")%c /* %d */\n", (i == (fnum-1)) ? ' ' : ',', i-1);<br />
}<br />
printf ("};\n");<br />
</pre><br />
The patch file looks like this:<br />
<pre><br />
@@ -100,7 +100,7 @@<br />
{<br />
printf (" CNST_LIMB (0x");<br />
mpz_out_str (stdout, 16, f[i]);<br />
- printf ("), /* %d */\n", i-1);<br />
+ printf (")%c /* %d */\n", (i == (fnum-1)) ? ' ' : ',', i-1);<br />
}<br />
printf ("};\n");<br />
}<br />
</pre><br />
</li><br />
<li>Compiling with MinGW does not work, so you will need to compile with Cygwin. At the prompt:<br />
<pre><br />
$ ./configure --disable-static --enable-shared<br />
$ make<br />
</pre><br />
The <code>--disable-static</code> and <code>--enable-shared</code> flags configure GMP to build a DLL instead of a static library. You may optionally perform <code>make install</code>. Additional compilation instructions [http://www.cs.nyu.edu/exact/core/gmp/ are available].<br />
<p>If you experience difficulties with compilation and it appears that MinGW gcc is being detected by <code>configure</code> and not Cygwin gcc, you can try editing your <code>PATH</code> variable:</p><br />
<pre><br />
$ export PATH=`echo $PATH | sed "s|/cygdrive/c/MinGW/bin:||"`<br />
</pre><br />
Re-run <code>configure</code> and <code>make</code> afterwards.<br />
</ol><br />
</li><br />
<li>Set the following CMake flags:<br />
{| class="wikitable"<br />
! Setting<br />
! Description<br />
! Type<br />
! Value<br />
|-<br />
| <code>USE_INTERNAL_CRYPTO</code><br />
| Use the provided copies of crypto libraries. <!-- FIXME: I think these are nettle and something else --><br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_GLEW</code><br />
| Use the provided copy of GLEW.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_JPEG</code><br />
| Use the provided copy of JPEG.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SDL</code><br />
| Use the provided copy of SDL.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SPEEX</code><br />
| Use the provided copy of Speex.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_WEBP</code><br />
| Use the provided copy of WebP.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_CURSES</code><br />
| Enables/disables curses.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>PNG_LIBRARY</code><br />
| Path to the PNG library DLL.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng/libs/win32/libpng.lib</code><br />
|-<br />
| <code>PNG_PNG_INCLUDE_DIR</code><br />
| Path to the PNG library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng</code><br />
|-<br />
| <code>FREETYPE_LIBRARY</code><br />
| Path to the compiled FreeType library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/lib/freetype.lib</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_freetype2</code><br />
| Path to the FreeType library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/freetype2</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_ft2build</code><br />
| Path to the FreeType library file "ftbuild.h".<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/</code><br />
|-<br />
| <code>GMP_INCLUDE_DIR</code><br />
| Path to the GMP library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/gmp/include</code><br />
|-<br />
| <code>GMP_LIBRARY</code><br />
| Path to the GMP library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/gmp/libs/win32/mpir.lib</code><br />
|-<br />
| <code>ZLIB_INCLUDE_DIR</code><br />
| Path to the zlib library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/include</code><br />
|-<br />
| <code>ZLIB_LIBRARY</code><br />
| Path to the zlib library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/lib/x32/zlibstat.lib</code><br />
|-<br />
| <code>CURL_LIBRARY</code><br />
| Path to the CURL library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/lib/win32/release/libcurl.dll</code><br />
|-<br />
| <code>CURL_INCLUDE_DIR</code><br />
| Path to the zlib library.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/include/curl</code><br />
|-<br />
| <code>USE_OPENAL</code><br />
| Enables/disables OpenAL support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_THEORA</code><br />
| Enables/disables Theora support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_XVID</code><br />
| Enables/disables Xvid support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CODEC_THEORA</code><br />
| Enables/disables Ogg support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>SDLMAIN_LIBRARY</code><br />
| Enables/disables Ogg support.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code><br />
|-<br />
|}<br />
Do note that CMake is slash-direction&ndash;agnostic; it can handle both forward- and backslashes on Windows.<br />
</li><br />
<li>Open <code><var>SourcePath</var>/CMakeLists.txt</code> and edit the line<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi z )<br />
</pre><br />
(around line 1040) to look like this:<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi )<br />
</pre><br />
</li><br />
<li>Open <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code> and edit the lines:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "SDL.h"<br />
#include "SDL_main.h"<br />
</pre><br />
to look like:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "../../../include/SDL.h"<br />
#include "../../../include/SDL_main.h"<br />
</pre><br />
<li>Open a terminal and <code>cd</code> to your source directory.</li><br />
<li>Run <code>make</code>:<br />
<pre><br />
> mingw32-make<br />
</pre><br />
If you would like verbose output, set the <code>VERBOSE</code> environment variable before running <code>make</code>.<br />
<pre><br />
> set VERBOSE=1<br />
</pre><br />
</li><br />
</ol><br />
<br />
====Notes====<br />
<br />
* If you would like to use curses, try using [http://sourceforge.net/projects/pdcurses/files/pdcurses PDCurses].<br />
<br />
===QtCreator===<br />
<br />
# Install MinGW and follow the above instructions, except select Code::Blocks as the generator.<br />
# Start QtCreator, and select "Open File or Project&hellip;" from the File menu.<br />
# Navigate to your source directory and open CMakeLists.txt.<br />
# At the CMake Wizard, select the same build directory you already configured using CMake. (If you did not chose Code::Blocks as the generator, you will have to start over again, as QtCreator requires a Code::Blocks project file in order to compile the source.)<br />
# Ensure that a generator is selected in the combo box, and click "Run CMake". If there is no generator listed, see the [[#Troubleshooting|troubleshooting]] section below.<br />
# Click "Finish" to close the wizard.<br />
<br />
You should now be able to compile, run, and debug the code using QtCreator.<br />
<br />
====Troubleshooting====<br />
<br />
If at the "Run CMake" prompt of the the CMake Wizard, select "Run CMake" and are warned that no generator was selected, and notice that there are no generators in the combo box, you will likely have to [http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html manually configure your toolchain]. Select "Options&hellip;" from the "Tools" menu, then navigate to "Build &amp; Run".<br />
<br />
At the options window,<br />
* Go to the "Kits" tab, and mouse over the "Desktop (default)" kit under "Manual". If there were any errors in configuring this kit, they will be displayed in the tool tip. If there are problems, select the kit. You may need to manually specify the location of the MinGW debugger, for example, which is typically <code>C:\MinGW\bin\gdb.exe</code>.<br />
* Go to the "Compilers" tab, and ensure that MinGW is present. If not, you will need to add it manually.<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 />
libgmp3-dev libjpeg8-dev libncurses5-dev libogg-dev libopenal-dev \<br />
libpng12-dev libsdl1.2-dev libvorbis-dev zlib1g-dev nettle-dev \<br />
libwebp-dev libspeexdsp-dev libtheora-dev<br />
<br />
If the version of WebP supplied by your version of Debian or Ubuntu is older than v0.2.0, you will need to [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0.tar.gz download] and [https://developers.google.com/speed/webp/docs/compiling#unix compile it from source]. After compiling and installing with <code>sudo make install</code>, in CMake, you'll need to set <code>WEBP_INCLUDE_DIR</code> to <code>/usr/local/include/webp</code> and <code>WEBP_LIBRARY</code> to <code>/usr/local/lib/libwebp.so</code>.<br />
<br />
'''We currently provide a ready-to-use libwebp-dev in our [http://{{SERVERNAME}}/index.php/Download#ubuntu Debian and Ubuntu repositories], alongside .debs of the game and server.'''<br />
<br />
Actual dev package names may vary, e.g. libgmp-dev instead of libgmp3-dev and libglew-dev or libglew1.7-dev instead of libglew1.5-dev.<br />
<br />
Since we have a debian directory in the source, you can also to check what's needed then install the listed packages (choosing from alternatives as needed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ dpkg-checkbuilddeps<br />
…<br />
$ sudo apt-get install <var>package(s)</var><br />
<br />
If dpkg-checkbuilddeps produces no output, you have all necessary build dependencies. Also, debhelper's only needed if you're building .debs.<br />
<br />
====Gentoo====<br />
<br />
$ emerge curl freetype glew gmp jpeg ncurses libogg openal libpng libsdl libvorbis zlib<br />
<br />
====openSUSE====<br />
<br />
$ sudo install zypper gcc gcc-c++ Mesa-libGL-devel SDL-devel libjpeg8-devel \<br />
libpng12-devel glew-devel webp-devel ncurses-devel gmp-devel libcurl-devel \<br />
libnettle-devel openal-soft-devel speex-devel libvorbis-devel \<br />
libtheora-devel<br />
<br />
The latest version of WebP must be installed manually:<br />
<br />
$ wget https://webp.googlecode.com/files/libwebp-0.2.1.tar.gz<br />
$ tar xvzf libwebp-0.2.1.tar.gz<br />
$ cd libwebp-0.2.1<br />
$ ./configure && make<br />
$ sudo make install<br />
<br />
You must disable curses (set <code>USE_CURSES</code> appropriately in CMake) as failing to do so will cause Unvanquished to crash on startup.<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 />
On Debian or 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 />
Or, in Debian or Ubuntu, you can build a package (but you'll need to have devscripts and fakeroot installed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ fakeroot dpkg-buildpackage -b -uc<br />
$ sudo dpkg -i <var>../unvanquished_*.deb</var><br />
<br />
Once in <code>ccmake</code>, use the following keys:<br />
<br />
* Press {{Hotkey|c}} to configure. If an error occurs during this phase, make note of it and press {{Hotkey|e}} to dismiss it.<br />
* Use the up and down arrow keys to navigate the compilation options.<br />
* Press {{Hotkey|Enter}} to enable or disable boolean options (i.e., on/off) or to edit textual options.<br />
** Press {{Hotkey|Esc}} when editing a textual option to cancel the change.<br />
<br />
Once you have finished the configuration process, press {{Hotkey|C}} again, then {{Hotkey|G}} 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=====<br />
<br />
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_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 />
* <code>USE_CIN_THEORA</code> &mdash; Disabling this prevents videos from being recorded in Theora.<br />
* <code>USE_CIN_XVID</code> &mdash; Disabling this prevents videos from being recorded in Xvid.<br />
* <code>USE_VOIP</code> &mdash; Disabling this removes VOIP support. Alternatively enabling <code>USE_INTERNAL_SPEEX</code> will use the libraries distributed with Unvanquished for VoIP<br />
* <code>USE_INTERNAL_CRYPTO</code> &mdash; Enable this to use the crypto libraries provided by Unvanquished.<br />
<br />
===Compiling===<br />
<br />
$ cd <var>path/to/unvanquished/build</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 />
===Acquiring mandatory game files===<br />
<br />
The game files are not in the Git repository, and must be downloaded separately. This may be done on the command line or from your web browser. The downloads may be found on [http://sourceforge.net/projects/unvanquished/files/Assets SourceForge.net]. If you download the files from your browser, just download the files named "pak*.pk3", and save them to the [[Running_the_game#Data_locations|data location]] for your system.<br />
<br />
On Linux, this may be done as follows:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
wget -O $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On FreeBSD, using the <code>sh</code> shell:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
fetch -r -o $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On Mac OS X:<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
curl -L "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download" > $file<br />
fi<br />
done<br />
<br />
Linux users may also use the <code>download-pk3.sh</code> script that is distributed with the source code, which requires that curl be installed:<br />
<br />
$ cd <var>[path to Unvanquished source code]</var><br />
$ mkdir -p ~/.Unvanquished/main<br />
$ ./download-pk3.sh ~/.Unvanquished/main<br />
<br />
===Downloading the map pack===<br />
<br />
The map pack exists only for convenience; if you do not download the map pack, Unvanquished will automatically download maps as needed when you attempt to play online.<br />
<br />
To download the map pack on Linux:<br />
<br />
$ wget -O maps.7z "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z"; done<br />
<br />
To download the map pack on Mac OS X:<br />
<br />
$ curl -L "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z" > maps.7z; done<br />
<br />
Note that you will need to unzip the map pack on either system as it is compressed with LZMA. Mac users can use the [http://wakaba.c3.cx/s/apps/unarchiver.html Unarchiver]. Uncompressing the archive on Linux is highly dependent on your distribution.<br />
<br />
===Verifying the Files===<br />
<br />
Download the latest [http://sourceforge.net/projects/unvanquished/files/Assets/{{CurrentVersion|MD5HashFile}} MD5 hash file] and save it to your system's [[Running_the_game#Data_directory|data location]].<br />
<br />
On systems with the <code>md5</code> command (Mac OS X):<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ cat {{CurrentVersion|MD5HashFile}} | while read line; do<br />
file="`echo "$line" | sed -E "s/^[a-fA-F0-9]+ +\*?//"`"<br />
if [ -e "$file" ]; then<br />
if [ `md5 -r "$file" | cut -d\ -f1` = "`echo "$line" | cut -d\ -f1`" ]<br />
then echo "File \"$file\" appears okay."<br />
else echo "File \"$file\" is corrupt"'!' >&2<br />
fi; fi; done<br />
<br />
On systems with the <code>md5sum</code> command (most Linux distributions):<br />
<br />
$ cd <var>[[Running_the_game#Data_directory|/path/to/data/files]]</var><br />
$ md5sum -c {{CurrentVersion|MD5HashFile}} 2>&1 | grep -v "open or read\|file or directory"<br />
<br />
The <code>grep</code> invocation is used to strip output complaining about missing files.<br />
<br />
Any files that are found to be corrupt should be replaced; just download a [http://sourceforge.net/projects/unvanquished/files/Assets new copy] of the affected file(s).<br />
<br />
==Errors==<br />
<br />
===CMake cannot locate Newton===<br />
<br />
If CMake cannot find Newton, you'll need to set it up yourself.<br />
<br />
It should be in <code><var>/path/to/Unvanquished</var>/src/libs/libnewton/libs/<var>your_os</var>/libNewton.so</code>.<br />
Be sure to replace <var>your_os</var> with the proper directory name.<br />
<br />
Use CMake as before to change the <code>NEWTON_LIBRARY</code> build setting to the said path:<br />
<br />
# Start the CMake configurator:<pre>$ ccmake ..</pre><br />
# Scroll down and highlight <code>NEWTON_LIBRARY</code>.<br />
# Press {{Hotkey|Enter}} to begin editing and input in the path.<br />
# Press {{Hotkey|C}} to configure and {{Hotkey|G}} to generate the new makefiles.<br />
# Press {{Hotkey|Q}} to quit.<br />
# Recompile the source:<pre>$ make</pre><br />
<br />
===The C Compiler is not able to compile a simple test program===<br />
<br />
When attempting to generate a solution for Xcode CMake fails with the following error<br />
-- Check for working C compiler using: Xcode -- broken<br />
CMake Error at /Applications/CMake 2.8-8.app/Contents/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):<br />
The C compiler "/usr/bin/gcc" is not able to compile a simple test program.<br />
<br />
It fails with the following output:<br />
<br />
Change Dir: /Users/danielmaloney/Documents/Unvanquished/build-xcode/CMakeFiles/CMakeTmp<br />
<br />
<br />
<br />
Run Build Command:/Applications/CMake\ 2.8-8.app/Contents/bin/cmakexbuild<br />
-project CMAKE_TRY_COMPILE.xcodeproj build -target<br />
cmTryCompileExec1400153232 -configuration Debug<br />
<br />
Error: No developer directory found at /Developer. Run<br />
/usr/bin/xcode-select to update the developer directory path.<br />
<br />
<br />
<br />
<br />
<br />
CMake will not be able to correctly generate this project.<br />
Call Stack (most recent call first):<br />
CMakeLists.txt:19 (project)<br />
<br />
This is due to Xcode 4.3 having a different directory structure to previous versions. Simply running the following command will correct this error:<br />
sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer/</div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Compiling_the_source&diff=1950Compiling the source2013-04-13T04:00:02Z<p>Velociostrich: /* MinGW */ Once again, we need the 64-bit, not 32-bit versions of libraries (this time for zlib).</p>
<hr />
<div>==Mac OS X==<br />
<br />
First, you need to [[Getting_the_source|acquire the source code]].<br />
<br />
Regardless of what interface you may use to compile the source, you will need [http://www.cmake.org/cmake/resources/software.html CMake] to generate makefiles. You will also need to install [https://developer.apple.com/xcode/ Xcode] (making sure to choose to install the command-line utilities when prompted by the installer).<br />
<br />
Then, you will need to acquire (and in some cases, manually compile) at a minimum the [[#Dependencies|necessary libraries]].<br />
<br />
Once you have the source code and the libraries installed, you may actually proceed to compile the source. You have several options:<br />
* '''Compile the source at the command line'''. This is the easiest if you would just like to compile the game to use yourself and you do not intend to work on the code.<br />
* '''Compile the source using an IDE'''. This is preferred if you intend on developing the source.<br />
** Xcode is Apple's flagship IDE and you should have installed to compile the source regardless of which method you use.<br />
** [http://qt-project.org/downloads QtCreator] is cross-platform and provides real-time feedback of syntax errors, a Vim mode, as well as other features.<br />
** [http://www.codeblocks.org/ Code::Blcoks] is also cross-platform but lacks some of the features of Xcode and QtCreator.<br />
<br />
===Dependencies===<br />
<br />
You only need to use one of the following methods (HomeBrew or compiling by hand). Please try and avoid mixing methods as this may produce unexpected results.<br />
<br />
Unvanquished requires the following libraries:<br />
* [[#JPEG|JPEG]], version 8 or higher. (Version 6 was known to have problems)<br />
* [[#Simple_DirectMedia_Layer_.28SDL.29|Simple DirectMedia Layer]] (The binary provided by libsdl.org causes graphical corruptions. Compile from source or use homebrew/macports)<br />
* [[#The_OpenGL_Extension_Wrangler_Library_.28GLEW.29|The OpenGL Extension Wrangler Library]]<br />
* CuRL<br />
* [[#The_GNU_MP_Bignum_Library_.28libgmp.29|GMP]]<br />
* [[#WebP|WebP]] (v0.2.0 or newer)<br />
<br />
The following libraries are optional:<br />
* Theora<br />
* Speex<br />
* [[#Ogg|Ogg]]<br />
* [[#Vorbis|Vorbis]]<br />
<br />
====HomeBrew====<br />
Install [http://mxcl.github.com/homebrew/ HomeBrew] and then run the following command<br />
<br />
$ brew install nettle libjpeg curl sdl webp xvid gmp glew speex libvorbis theora<br />
<br />
All the necessary libraries should now have been installed.<br />
<br />
====Compiling by hand====<br />
The following are shell scripts that download, compile, and install various libraries. This is more time consuming then other methods but might be useful if you need more control over your libraries<br />
<br />
=====JPEG=====<br />
<br />
$ curl http://www.ijg.org/files/jpegsrc.v8d.tar.gz > jpegsrc.v8d.tar.gz<br />
$ tar xvzf jpegsrc.v8d.tar.gz<br />
$ cd jpeg-8d<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The OpenGL Extension Wrangler Library (GLEW)=====<br />
<br />
$ curl -L https://sourceforge.net/projects/glew/files/glew/1.7.0/glew-1.7.0.tgz/download > glew-1.7.0.tgz<br />
$ tar xvzf glew-1.7.0.tgz<br />
$ cd glew-1.7.0<br />
$ make<br />
$ sudo make install<br />
<br />
=====Simple DirectMedia Layer (SDL)=====<br />
<br />
Do not use the binaries provided by libsdl.org, as these are known to cause issues with gamma and color display. Instead, compile your own:<br />
<br />
$ curl http://www.libsdl.org/release/SDL-1.2.15.tar.gz > SDL-1.2.15.tar.gz<br />
$ tar xvzf SDL-1.2.15.tar.gz<br />
$ cd SDL-1.2.15<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The GNU MP Bignum Library (libgmp)=====<br />
<br />
$ curl ftp://ftp.gmplib.org/pub/gmp-5.0.5/gmp-5.0.5.tar.bz2 > gmp-5.0.5.tar.bz2<br />
$ tar xvjf gmp-5.0.5.tar.bz2<br />
$ cd gmp-5.0.5<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Ogg=====<br />
<br />
$ curl http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz > libogg-1.3.0.tar.gz<br />
$ tar xvzf libogg-1.3.0.tar.gz<br />
$ cd libogg-1.3.0<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Vorbis=====<br />
<br />
$ curl http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz > libvorbis-1.3.3.tar.gz<br />
$ tar xvzf libvorbis-1.3.3.tar.gz<br />
$ cd libvorbis-1.3.3<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====WebP=====<br />
<br />
You do not need to compile WebP by hand; Google provides binaries for Mac OS X available from their [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0-mac-10.5.tar.gz project page]. You will need version 0.2.0 or newer.<br />
<br />
Once downloaded, you must still install the header files and the binary:<br />
<br />
$ curl https://webp.googlecode.com/files/libwebp-0.2.0-mac-10.5.tar.gz > libwebp-0.2.0-mac-10.5.tar.gz<br />
$ tar xvzf libwebp-0.2.0-mac-10.5.tar.gz<br />
$ cd libwebp-0.2.0-mac-10.5<br />
$ sudo cp include/webp /usr/local/include<br />
$ sudo cp lib/libwebp.a /usr/local/lib<br />
<br />
===Configuring with CMake===<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 should be a different directory.<br />
# Hit "Configure". You will be prompted as to which generator you would like to use. If you have Xcode installed, choose that. Wait while the configuration process runs. You may have to set the following:<br />
## If CMake did not find your jpeg headers for some reason, set <code>JPEG_INCLUDE_DIR</code> to <code>/path/to/Unvanquished/src/libs/jpeg</code>.<br />
## Check <code>USE_INTERNAL_CRYPTO</code> to avoid having to compile nettle and hogweed.<br />
## Check <code>USE_INTERNAL_SPEEX</code> to avoid having to compile Speex.<br />
## Uncheck <code>USE_CIN_THEORA</code> and <code>USE_CIN_XVID</code> to avoid having to compile Theora or Xvid. (At present, there are not cutscenes or any such that require it.)<br />
## '''You will probably not be able to compile with the GLSL optimizer enabled; uncheck <code>USE_GLSL_OPTIMIZER</code>'''<br />
## If you have selected to generate Xcode project files, make the <code>SDLMAIN_LIBRARY</code> field blank. This option is not available if you have the generator set to Unix makefiles.<br />
# Hit "Generate".<br />
# You may now close Xcode.<br />
<br />
===Compiling===<br />
<br />
====With Xcode====<br />
<br />
<ol><br />
<li>Compilation will fail unless you manually create certain directories needed by the build scripts:<br />
<pre><br />
$ cd /path/to/build/dir/CMakeFiles<br />
$ mkdir gpp{game,trem,ui}-qvm.dir<br />
</pre><br />
This is a workaround to {{Issue|101}}.<br />
</li><br />
<li>Either start Xcode and open the project file (in the build directory you specified) or double-click the project file in Finder.</li><br />
<li>Open the project file created by CMake, which should be in the build directory you specified.</li><br />
<li>Change the active target to "ALL_BUILD" and click Product&rarr;Build.</li><br />
</ol><br />
<br />
====With Unix Makefiles====<br />
<br />
<ul><br />
<li>Start Terminal (Applications &rarr; Utilities &rarr; Terminal).</li><br />
<li>Input the following commands:<br />
<pre><br />
$ cd /path/to/Unvanquished-build<br />
$ make<br />
</pre><br />
If you are on a multi-core or multi-processor machine, you may speed up the process by passing the <code>-j</code> argument followed by the number of available cores to <code>make</code>; e.g., <code>make -j4</code>. Note that doing so makes reading error messages more difficult, as multiple instances of the compiler will print to the screen at once, causing information to appear out of order.<br />
</li><br />
</ul><br />
<br />
===Testing the build===<br />
<br />
====With Xcode 4====<br />
<br />
To test the game, select the "client" scheme from the combo box on the toolbar, and click the run button or press {{Hotkey|MacCommand}}{{Hotkey|R}}.<br />
<br />
====With Unix Makefiles====<br />
<br />
After compiling, you'll have to place the data files in the <code>main</code> directory in your build directory. [[#Acquiring the Game Files|For download instructions, see below.]]<br />
<br />
Your file structure should look as follows:<br />
<br />
[[File:Build_dir_Mac_OS_X.png]]<br />
<br />
You may now start the application as such:<br />
<br />
$ ./daemon.i386<br />
<br />
Note that older machines will not support the new OpenGL 3 renderer, and must be started specifying the "vanilla" (aka "GL") renderer:<br />
<br />
$ ./daemon.i386 +set cl_renderer GL<br />
<br />
===Bundling the Application===<br />
<br />
====With CPack====<br />
<br />
CPack is able to create standalone bundles (as well as many other types of installers). However you must generate the files using Unix Makefiles instead of Xcode.<br />
<br />
$ cd /path/to/Unvanquished-build<br />
$ cpack -G Bundle<br />
<br />
Some warnings will be printed however these can be safely ignored. There should be a file called Unvanquished.dmg in the Unvanquished-build folder.<br />
<br />
====Manually====<br />
<br />
You'll find the Mac [http://macdylibbundler.sourceforge.net/ dynamic library bundler] to be quite useful (you must generate the files using Unix Makefiles instead of Xcode):<br />
<br />
$ curl -L http://sourceforge.net/projects/macdylibbundler/files/macdylibbundler/0.4.1/dylibbundler0.4.1.zip/download > \<br />
dylibbundler0.4.1.zip<br />
$ unzip dylibbundler0.4.1.zip<br />
$ cd dylibbundler<br />
$ make<br />
$ sudo make install<br />
<br />
Once you've done that, you can proceed to create the application bundle. Note that these steps assume that you have downloaded the data files to <code>main/</code> as shown above:<br />
<br />
<pre><br />
$ git=/path/to/Unvanquished-git-repo<br />
$ build=/path/to/Unvanquished-build-dir<br />
$ mkdir -pv Unvanquished.app/Contents/{libs,MacOS,Resources,Frameworks}<br />
$ cp -r $build/main Unvanquished.app/Contents/MacOS<br />
$ sips -s format tiff $git/debian/unvanquished.png --out temp.tiff<br />
$ tiff2icns temp.tiff Unvanquished.app/Contents/Resources/Unvanquished.icns<br />
$ rm temp.tiff<br />
$ cp $build/daemon{,ded}.i386 $build/*.dylib Unvanquished.app/Contents/MacOS<br />
$ cp -r /Library/Frameworks/SDL.framework Unvanquished.app/Contents/Frameworks<br />
$ install_name_tool -id \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/Frameworks/SDL.framework/Versions/A/SDL<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGLi386.dylib<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGL3i386.dylib<br />
$ for binary in Unvanquished.app/Contents/MacOS/*.{i386,dylib}; do<br />
dylibbundler -b -x $binary -d $dest/Unvanquished.app/Contents/libs/; done<br />
$ cp /usr/lib/libGLEW.1.7.0.dylib ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ chmod +w ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -id @executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -change /usr/lib/libGLEW.1.7.0.dylib \<br />
@executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ cat > Unvanquished.app/Contents/Info.plist<br />
<?xml version="1.0" encoding="UTF-8"?><br />
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"<br />
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"><br />
<plist version="1.0"><br />
<dict><br />
<key>CFBundleName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleDisplayName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleExecutable</key><br />
<string>daemon.i386</string><br />
<key>CFBundleIconFile</key><br />
<string>Unvanquished.icns</string><br />
<key>CFBundleIdentifier</key><br />
<string>net.Unvanquished</string><br />
<key>CFBundleInfoDictionaryVersion</key><br />
<string>6.0</string><br />
<key>CFBundlePackageType</key><br />
<string>APPL</string><br />
<key>CFBundleShortVersionString</key><br />
<string>0.4.0</string><br />
<key>CFBundleVersion</key><br />
<string>0.4.0</string><br />
</dict><br />
</plist><br />
^d<br />
</pre><br />
<br />
Note: <code>^d</code> indicates pressing {{Hotkey|Ctrl}}{{Hotkey|D}} on the keyboard.<br />
<br />
The contents of the completed application bundle should look like this:<br />
<br />
[[File:Bundle_dir_Mac_OS_X.png]]<br />
<br />
'''Note''': If you compiled SDL from source, you will not see a directory titled <code>SDL.framework</code>.<br />
<br />
==Windows==<br />
<br />
===Visual Studio===<br />
<br />
CMake can generate Visual Studio projects for unvanquished however this feature is relatively new and may have some bugs.<br />
<br />
Steps:<br />
<br />
# Double click on Visual_Studio32.bat<br />
# Open build-32/Daemon.sln in Visual Studio 2010.<br />
# In the two text boxes in the toolbar, select "Release" or "Debug" in the first one and Win32 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 />
====Important Notes====<br />
<br />
* LLVM is disabled and does not work correctly with CMake generated Visual Studio projects.<br />
* ncurses is not supported under Visual Studio.<br />
* The path to the build folder must not have any spaces otherwise generation of QVMs will fail. See [https://github.com/Unvanquished/Unvanquished/issues/102 issue 102]<br />
* Due to limitations with cmake neither the startup project nor the working directory can be specified. These must be manually set to the following values for debugging the client under Visual Studio<br />
** Right click on client and select "Set as StartUp project".<br />
** Right click on client, select properties, select Debugging and set "Working Directory" to $(TargetPath)\..<br />
<br />
===MinGW===<br />
<br />
Unvanquished is supported under MinGW. The build process should be fairly similar to the Linux instructions.<br />
<br />
The easiest way to acquire and install MinGW is with the graphical [http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/ mingw-get-inst installer]. <!-- TODO: maybe walk the user through the installer? --><br />
<br />
When configuring the build with CMake, you will find that you will have to set a number of libraries manually. You can find precompiled DLLs for most of the dependencies; those that are not pre-compiled can be built with the corresponding <code>USE_INTERNAL_</code> setting.<br />
<br />
On Windows, SDL requires that the Direct X SDK can be installed. You may download the June 2010 release from [http://www.microsoft.com/en-us/download/details.aspx?id=6812 Microsoft's site].<br />
<br />
The easiest way to get a build up (at the time of writing) is as follows: <!-- FIXME: incomplete --><br />
<br />
{{Note|content=Be aware that some of these paths are for the 64 bit versions of libraries; if you are on a 32-bit system, you will need to change some of these paths. The easiest way to locate libraries is to navigate in Windows Explorer to the <code>src/libs</code> directory and search for files matching <code>dll</code>.}}<br />
<br />
<ol><br />
<!-- might not be necessary<br />
<li>Download and extract the latest version of the [http://gmplib.org/ GNU MP Bignum Library (GMP)]. (You will need either cygwin with tar and bz2 installed or 7-zip to extract the archive.)</li><br />
<li>Theoretically, you can compile GMP with either the MSYS shell (from MinGW) or Cygwin, but you may experience issues with the former. Regardless of which you use, the steps to compile are the same:<br />
<pre><br />
$ ./configure --disable-static --enable-shared<br />
$ make<br />
</pre><br />
The <code>--disable-static</code> and <code>--enable-shared</code> flags configure GMP to build a DLL instead of a static library. You may optionally perform <code>make install</code>. Additional compilation instructions [http://www.cs.nyu.edu/exact/core/gmp/ are available].<br />
</li><br />
--><br />
<li>Set the following CMake flags:<br />
{| class="wikitable"<br />
! Setting<br />
! Description<br />
! Type<br />
! Value<br />
|-<br />
| <code>USE_INTERNAL_CRYPTO</code><br />
| Use the provided copies of crypto libraries. <!-- FIXME: I think these are nettle and something else --><br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_GLEW</code><br />
| Use the provided copy of GLEW.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_JPEG</code><br />
| Use the provided copy of JPEG.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SDL</code><br />
| Use the provided copy of SDL.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SPEEX</code><br />
| Use the provided copy of Speex.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_WEBP</code><br />
| Use the provided copy of WebP.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_CURSES</code><br />
| Enables/disables curses.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>PNG_LIBRARY</code><br />
| Path to the PNG library DLL.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng/libs/win32/libpng.lib</code><br />
|-<br />
| <code>PNG_PNG_INCLUDE_DIR</code><br />
| Path to the PNG library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng</code><br />
|-<br />
| <code>FREETYPE_LIBRARY</code><br />
| Path to the compiled FreeType library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/lib/freetype.lib</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_freetype2</code><br />
| Path to the FreeType library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/freetype2</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_ft2build</code><br />
| Path to the FreeType library file "ftbuild.h".<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/</code><br />
|-<br />
| <code>GMP_INCLUDE_DIR</code><br />
| Path to the GMP library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/gmp/include</code><br />
|-<br />
| <code>GMP_LIBRARY</code><br />
| Path to the GMP library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/gmp/libs/win32/mpir.lib</code><br />
|-<br />
| <code>ZLIB_INCLUDE_DIR</code><br />
| Path to the zlib library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/include</code><br />
|-<br />
| <code>ZLIB_LIBRARY</code><br />
| Path to the zlib library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/lib/x32/zlibstat.lib</code><br />
|-<br />
| <code>CURL_LIBRARY</code><br />
| Path to the CURL library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/lib/win32/release/libcurl.dll</code><br />
|-<br />
| <code>CURL_INCLUDE_DIR</code><br />
| Path to the zlib library.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/include/curl</code><br />
|-<br />
| <code>USE_OPENAL</code><br />
| Enables/disables OpenAL support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_THEORA</code><br />
| Enables/disables Theora support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_XVID</code><br />
| Enables/disables Xvid support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CODEC_THEORA</code><br />
| Enables/disables Ogg support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>SDLMAIN_LIBRARY</code><br />
| Enables/disables Ogg support.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code><br />
|-<br />
|}<br />
Do note that CMake is slash-direction&ndash;agnostic; it can handle both forward- and backslashes on Windows.<br />
</li><br />
<li>Open <code><var>SourcePath</var>/CMakeLists.txt</code> and edit the line<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi z )<br />
</pre><br />
(around line 1040) to look like this:<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi )<br />
</pre><br />
</li><br />
<li>Open <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code> and edit the lines:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "SDL.h"<br />
#include "SDL_main.h"<br />
</pre><br />
to look like:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "../../../include/SDL.h"<br />
#include "../../../include/SDL_main.h"<br />
</pre><br />
<li>Open a terminal and <code>cd</code> to your source directory.</li><br />
<li>Run <code>make</code>:<br />
<pre><br />
> mingw32-make<br />
</pre><br />
If you would like verbose output, set the <code>VERBOSE</code> environment variable before running <code>make</code>.<br />
<pre><br />
> set VERBOSE=1<br />
</pre><br />
</li><br />
</ol><br />
<br />
====Notes====<br />
<br />
* If you would like to use curses, try using [http://sourceforge.net/projects/pdcurses/files/pdcurses PDCurses].<br />
<br />
===QtCreator===<br />
<br />
# Install MinGW and follow the above instructions, except select Code::Blocks as the generator.<br />
# Start QtCreator, and select "Open File or Project&hellip;" from the File menu.<br />
# Navigate to your source directory and open CMakeLists.txt.<br />
# At the CMake Wizard, select the same build directory you already configured using CMake. (If you did not chose Code::Blocks as the generator, you will have to start over again, as QtCreator requires a Code::Blocks project file in order to compile the source.)<br />
# Ensure that a generator is selected in the combo box, and click "Run CMake". If there is no generator listed, see the [[#Troubleshooting|troubleshooting]] section below.<br />
# Click "Finish" to close the wizard.<br />
<br />
You should now be able to compile, run, and debug the code using QtCreator.<br />
<br />
====Troubleshooting====<br />
<br />
If at the "Run CMake" prompt of the the CMake Wizard, select "Run CMake" and are warned that no generator was selected, and notice that there are no generators in the combo box, you will likely have to [http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html manually configure your toolchain]. Select "Options&hellip;" from the "Tools" menu, then navigate to "Build &amp; Run".<br />
<br />
At the options window,<br />
* Go to the "Kits" tab, and mouse over the "Desktop (default)" kit under "Manual". If there were any errors in configuring this kit, they will be displayed in the tool tip. If there are problems, select the kit. You may need to manually specify the location of the MinGW debugger, for example, which is typically <code>C:\MinGW\bin\gdb.exe</code>.<br />
* Go to the "Compilers" tab, and ensure that MinGW is present. If not, you will need to add it manually.<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 />
libgmp3-dev libjpeg8-dev libncurses5-dev libogg-dev libopenal-dev \<br />
libpng12-dev libsdl1.2-dev libvorbis-dev zlib1g-dev nettle-dev \<br />
libwebp-dev libspeexdsp-dev libtheora-dev<br />
<br />
If the version of WebP supplied by your version of Debian or Ubuntu is older than v0.2.0, you will need to [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0.tar.gz download] and [https://developers.google.com/speed/webp/docs/compiling#unix compile it from source]. After compiling and installing with <code>sudo make install</code>, in CMake, you'll need to set <code>WEBP_INCLUDE_DIR</code> to <code>/usr/local/include/webp</code> and <code>WEBP_LIBRARY</code> to <code>/usr/local/lib/libwebp.so</code>.<br />
<br />
'''We currently provide a ready-to-use libwebp-dev in our [http://{{SERVERNAME}}/index.php/Download#ubuntu Debian and Ubuntu repositories], alongside .debs of the game and server.'''<br />
<br />
Actual dev package names may vary, e.g. libgmp-dev instead of libgmp3-dev and libglew-dev or libglew1.7-dev instead of libglew1.5-dev.<br />
<br />
Since we have a debian directory in the source, you can also to check what's needed then install the listed packages (choosing from alternatives as needed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ dpkg-checkbuilddeps<br />
…<br />
$ sudo apt-get install <var>package(s)</var><br />
<br />
If dpkg-checkbuilddeps produces no output, you have all necessary build dependencies. Also, debhelper's only needed if you're building .debs.<br />
<br />
====Gentoo====<br />
<br />
$ emerge curl freetype glew gmp jpeg ncurses libogg openal libpng libsdl libvorbis zlib<br />
<br />
====openSUSE====<br />
<br />
$ sudo install zypper gcc gcc-c++ Mesa-libGL-devel SDL-devel libjpeg8-devel \<br />
libpng12-devel glew-devel webp-devel ncurses-devel gmp-devel libcurl-devel \<br />
libnettle-devel openal-soft-devel speex-devel libvorbis-devel \<br />
libtheora-devel<br />
<br />
The latest version of WebP must be installed manually:<br />
<br />
$ wget https://webp.googlecode.com/files/libwebp-0.2.1.tar.gz<br />
$ tar xvzf libwebp-0.2.1.tar.gz<br />
$ cd libwebp-0.2.1<br />
$ ./configure && make<br />
$ sudo make install<br />
<br />
You must disable curses (set <code>USE_CURSES</code> appropriately in CMake) as failing to do so will cause Unvanquished to crash on startup.<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 />
On Debian or 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 />
Or, in Debian or Ubuntu, you can build a package (but you'll need to have devscripts and fakeroot installed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ fakeroot dpkg-buildpackage -b -uc<br />
$ sudo dpkg -i <var>../unvanquished_*.deb</var><br />
<br />
Once in <code>ccmake</code>, use the following keys:<br />
<br />
* Press {{Hotkey|c}} to configure. If an error occurs during this phase, make note of it and press {{Hotkey|e}} to dismiss it.<br />
* Use the up and down arrow keys to navigate the compilation options.<br />
* Press {{Hotkey|Enter}} to enable or disable boolean options (i.e., on/off) or to edit textual options.<br />
** Press {{Hotkey|Esc}} when editing a textual option to cancel the change.<br />
<br />
Once you have finished the configuration process, press {{Hotkey|C}} again, then {{Hotkey|G}} 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=====<br />
<br />
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_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 />
* <code>USE_CIN_THEORA</code> &mdash; Disabling this prevents videos from being recorded in Theora.<br />
* <code>USE_CIN_XVID</code> &mdash; Disabling this prevents videos from being recorded in Xvid.<br />
* <code>USE_VOIP</code> &mdash; Disabling this removes VOIP support. Alternatively enabling <code>USE_INTERNAL_SPEEX</code> will use the libraries distributed with Unvanquished for VoIP<br />
* <code>USE_INTERNAL_CRYPTO</code> &mdash; Enable this to use the crypto libraries provided by Unvanquished.<br />
<br />
===Compiling===<br />
<br />
$ cd <var>path/to/unvanquished/build</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 />
===Acquiring mandatory game files===<br />
<br />
The game files are not in the Git repository, and must be downloaded separately. This may be done on the command line or from your web browser. The downloads may be found on [http://sourceforge.net/projects/unvanquished/files/Assets SourceForge.net]. If you download the files from your browser, just download the files named "pak*.pk3", and save them to the [[Running_the_game#Data_locations|data location]] for your system.<br />
<br />
On Linux, this may be done as follows:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
wget -O $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On FreeBSD, using the <code>sh</code> shell:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
fetch -r -o $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On Mac OS X:<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
curl -L "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download" > $file<br />
fi<br />
done<br />
<br />
Linux users may also use the <code>download-pk3.sh</code> script that is distributed with the source code, which requires that curl be installed:<br />
<br />
$ cd <var>[path to Unvanquished source code]</var><br />
$ mkdir -p ~/.Unvanquished/main<br />
$ ./download-pk3.sh ~/.Unvanquished/main<br />
<br />
===Downloading the map pack===<br />
<br />
The map pack exists only for convenience; if you do not download the map pack, Unvanquished will automatically download maps as needed when you attempt to play online.<br />
<br />
To download the map pack on Linux:<br />
<br />
$ wget -O maps.7z "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z"; done<br />
<br />
To download the map pack on Mac OS X:<br />
<br />
$ curl -L "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z" > maps.7z; done<br />
<br />
Note that you will need to unzip the map pack on either system as it is compressed with LZMA. Mac users can use the [http://wakaba.c3.cx/s/apps/unarchiver.html Unarchiver]. Uncompressing the archive on Linux is highly dependent on your distribution.<br />
<br />
===Verifying the Files===<br />
<br />
Download the latest [http://sourceforge.net/projects/unvanquished/files/Assets/{{CurrentVersion|MD5HashFile}} MD5 hash file] and save it to your system's [[Running_the_game#Data_directory|data location]].<br />
<br />
On systems with the <code>md5</code> command (Mac OS X):<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ cat {{CurrentVersion|MD5HashFile}} | while read line; do<br />
file="`echo "$line" | sed -E "s/^[a-fA-F0-9]+ +\*?//"`"<br />
if [ -e "$file" ]; then<br />
if [ `md5 -r "$file" | cut -d\ -f1` = "`echo "$line" | cut -d\ -f1`" ]<br />
then echo "File \"$file\" appears okay."<br />
else echo "File \"$file\" is corrupt"'!' >&2<br />
fi; fi; done<br />
<br />
On systems with the <code>md5sum</code> command (most Linux distributions):<br />
<br />
$ cd <var>[[Running_the_game#Data_directory|/path/to/data/files]]</var><br />
$ md5sum -c {{CurrentVersion|MD5HashFile}} 2>&1 | grep -v "open or read\|file or directory"<br />
<br />
The <code>grep</code> invocation is used to strip output complaining about missing files.<br />
<br />
Any files that are found to be corrupt should be replaced; just download a [http://sourceforge.net/projects/unvanquished/files/Assets new copy] of the affected file(s).<br />
<br />
==Errors==<br />
<br />
===CMake cannot locate Newton===<br />
<br />
If CMake cannot find Newton, you'll need to set it up yourself.<br />
<br />
It should be in <code><var>/path/to/Unvanquished</var>/src/libs/libnewton/libs/<var>your_os</var>/libNewton.so</code>.<br />
Be sure to replace <var>your_os</var> with the proper directory name.<br />
<br />
Use CMake as before to change the <code>NEWTON_LIBRARY</code> build setting to the said path:<br />
<br />
# Start the CMake configurator:<pre>$ ccmake ..</pre><br />
# Scroll down and highlight <code>NEWTON_LIBRARY</code>.<br />
# Press {{Hotkey|Enter}} to begin editing and input in the path.<br />
# Press {{Hotkey|C}} to configure and {{Hotkey|G}} to generate the new makefiles.<br />
# Press {{Hotkey|Q}} to quit.<br />
# Recompile the source:<pre>$ make</pre><br />
<br />
===The C Compiler is not able to compile a simple test program===<br />
<br />
When attempting to generate a solution for Xcode CMake fails with the following error<br />
-- Check for working C compiler using: Xcode -- broken<br />
CMake Error at /Applications/CMake 2.8-8.app/Contents/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):<br />
The C compiler "/usr/bin/gcc" is not able to compile a simple test program.<br />
<br />
It fails with the following output:<br />
<br />
Change Dir: /Users/danielmaloney/Documents/Unvanquished/build-xcode/CMakeFiles/CMakeTmp<br />
<br />
<br />
<br />
Run Build Command:/Applications/CMake\ 2.8-8.app/Contents/bin/cmakexbuild<br />
-project CMAKE_TRY_COMPILE.xcodeproj build -target<br />
cmTryCompileExec1400153232 -configuration Debug<br />
<br />
Error: No developer directory found at /Developer. Run<br />
/usr/bin/xcode-select to update the developer directory path.<br />
<br />
<br />
<br />
<br />
<br />
CMake will not be able to correctly generate this project.<br />
Call Stack (most recent call first):<br />
CMakeLists.txt:19 (project)<br />
<br />
This is due to Xcode 4.3 having a different directory structure to previous versions. Simply running the following command will correct this error:<br />
sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer/</div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Compiling_the_source&diff=1949Compiling the source2013-04-13T03:56:49Z<p>Velociostrich: /* MinGW */ Add the path for gmp, fix the path for curl (32- instead of 64-bit), and workarounds to make SDL and zlib work.</p>
<hr />
<div>==Mac OS X==<br />
<br />
First, you need to [[Getting_the_source|acquire the source code]].<br />
<br />
Regardless of what interface you may use to compile the source, you will need [http://www.cmake.org/cmake/resources/software.html CMake] to generate makefiles. You will also need to install [https://developer.apple.com/xcode/ Xcode] (making sure to choose to install the command-line utilities when prompted by the installer).<br />
<br />
Then, you will need to acquire (and in some cases, manually compile) at a minimum the [[#Dependencies|necessary libraries]].<br />
<br />
Once you have the source code and the libraries installed, you may actually proceed to compile the source. You have several options:<br />
* '''Compile the source at the command line'''. This is the easiest if you would just like to compile the game to use yourself and you do not intend to work on the code.<br />
* '''Compile the source using an IDE'''. This is preferred if you intend on developing the source.<br />
** Xcode is Apple's flagship IDE and you should have installed to compile the source regardless of which method you use.<br />
** [http://qt-project.org/downloads QtCreator] is cross-platform and provides real-time feedback of syntax errors, a Vim mode, as well as other features.<br />
** [http://www.codeblocks.org/ Code::Blcoks] is also cross-platform but lacks some of the features of Xcode and QtCreator.<br />
<br />
===Dependencies===<br />
<br />
You only need to use one of the following methods (HomeBrew or compiling by hand). Please try and avoid mixing methods as this may produce unexpected results.<br />
<br />
Unvanquished requires the following libraries:<br />
* [[#JPEG|JPEG]], version 8 or higher. (Version 6 was known to have problems)<br />
* [[#Simple_DirectMedia_Layer_.28SDL.29|Simple DirectMedia Layer]] (The binary provided by libsdl.org causes graphical corruptions. Compile from source or use homebrew/macports)<br />
* [[#The_OpenGL_Extension_Wrangler_Library_.28GLEW.29|The OpenGL Extension Wrangler Library]]<br />
* CuRL<br />
* [[#The_GNU_MP_Bignum_Library_.28libgmp.29|GMP]]<br />
* [[#WebP|WebP]] (v0.2.0 or newer)<br />
<br />
The following libraries are optional:<br />
* Theora<br />
* Speex<br />
* [[#Ogg|Ogg]]<br />
* [[#Vorbis|Vorbis]]<br />
<br />
====HomeBrew====<br />
Install [http://mxcl.github.com/homebrew/ HomeBrew] and then run the following command<br />
<br />
$ brew install nettle libjpeg curl sdl webp xvid gmp glew speex libvorbis theora<br />
<br />
All the necessary libraries should now have been installed.<br />
<br />
====Compiling by hand====<br />
The following are shell scripts that download, compile, and install various libraries. This is more time consuming then other methods but might be useful if you need more control over your libraries<br />
<br />
=====JPEG=====<br />
<br />
$ curl http://www.ijg.org/files/jpegsrc.v8d.tar.gz > jpegsrc.v8d.tar.gz<br />
$ tar xvzf jpegsrc.v8d.tar.gz<br />
$ cd jpeg-8d<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The OpenGL Extension Wrangler Library (GLEW)=====<br />
<br />
$ curl -L https://sourceforge.net/projects/glew/files/glew/1.7.0/glew-1.7.0.tgz/download > glew-1.7.0.tgz<br />
$ tar xvzf glew-1.7.0.tgz<br />
$ cd glew-1.7.0<br />
$ make<br />
$ sudo make install<br />
<br />
=====Simple DirectMedia Layer (SDL)=====<br />
<br />
Do not use the binaries provided by libsdl.org, as these are known to cause issues with gamma and color display. Instead, compile your own:<br />
<br />
$ curl http://www.libsdl.org/release/SDL-1.2.15.tar.gz > SDL-1.2.15.tar.gz<br />
$ tar xvzf SDL-1.2.15.tar.gz<br />
$ cd SDL-1.2.15<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The GNU MP Bignum Library (libgmp)=====<br />
<br />
$ curl ftp://ftp.gmplib.org/pub/gmp-5.0.5/gmp-5.0.5.tar.bz2 > gmp-5.0.5.tar.bz2<br />
$ tar xvjf gmp-5.0.5.tar.bz2<br />
$ cd gmp-5.0.5<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Ogg=====<br />
<br />
$ curl http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz > libogg-1.3.0.tar.gz<br />
$ tar xvzf libogg-1.3.0.tar.gz<br />
$ cd libogg-1.3.0<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Vorbis=====<br />
<br />
$ curl http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz > libvorbis-1.3.3.tar.gz<br />
$ tar xvzf libvorbis-1.3.3.tar.gz<br />
$ cd libvorbis-1.3.3<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====WebP=====<br />
<br />
You do not need to compile WebP by hand; Google provides binaries for Mac OS X available from their [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0-mac-10.5.tar.gz project page]. You will need version 0.2.0 or newer.<br />
<br />
Once downloaded, you must still install the header files and the binary:<br />
<br />
$ curl https://webp.googlecode.com/files/libwebp-0.2.0-mac-10.5.tar.gz > libwebp-0.2.0-mac-10.5.tar.gz<br />
$ tar xvzf libwebp-0.2.0-mac-10.5.tar.gz<br />
$ cd libwebp-0.2.0-mac-10.5<br />
$ sudo cp include/webp /usr/local/include<br />
$ sudo cp lib/libwebp.a /usr/local/lib<br />
<br />
===Configuring with CMake===<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 should be a different directory.<br />
# Hit "Configure". You will be prompted as to which generator you would like to use. If you have Xcode installed, choose that. Wait while the configuration process runs. You may have to set the following:<br />
## If CMake did not find your jpeg headers for some reason, set <code>JPEG_INCLUDE_DIR</code> to <code>/path/to/Unvanquished/src/libs/jpeg</code>.<br />
## Check <code>USE_INTERNAL_CRYPTO</code> to avoid having to compile nettle and hogweed.<br />
## Check <code>USE_INTERNAL_SPEEX</code> to avoid having to compile Speex.<br />
## Uncheck <code>USE_CIN_THEORA</code> and <code>USE_CIN_XVID</code> to avoid having to compile Theora or Xvid. (At present, there are not cutscenes or any such that require it.)<br />
## '''You will probably not be able to compile with the GLSL optimizer enabled; uncheck <code>USE_GLSL_OPTIMIZER</code>'''<br />
## If you have selected to generate Xcode project files, make the <code>SDLMAIN_LIBRARY</code> field blank. This option is not available if you have the generator set to Unix makefiles.<br />
# Hit "Generate".<br />
# You may now close Xcode.<br />
<br />
===Compiling===<br />
<br />
====With Xcode====<br />
<br />
<ol><br />
<li>Compilation will fail unless you manually create certain directories needed by the build scripts:<br />
<pre><br />
$ cd /path/to/build/dir/CMakeFiles<br />
$ mkdir gpp{game,trem,ui}-qvm.dir<br />
</pre><br />
This is a workaround to {{Issue|101}}.<br />
</li><br />
<li>Either start Xcode and open the project file (in the build directory you specified) or double-click the project file in Finder.</li><br />
<li>Open the project file created by CMake, which should be in the build directory you specified.</li><br />
<li>Change the active target to "ALL_BUILD" and click Product&rarr;Build.</li><br />
</ol><br />
<br />
====With Unix Makefiles====<br />
<br />
<ul><br />
<li>Start Terminal (Applications &rarr; Utilities &rarr; Terminal).</li><br />
<li>Input the following commands:<br />
<pre><br />
$ cd /path/to/Unvanquished-build<br />
$ make<br />
</pre><br />
If you are on a multi-core or multi-processor machine, you may speed up the process by passing the <code>-j</code> argument followed by the number of available cores to <code>make</code>; e.g., <code>make -j4</code>. Note that doing so makes reading error messages more difficult, as multiple instances of the compiler will print to the screen at once, causing information to appear out of order.<br />
</li><br />
</ul><br />
<br />
===Testing the build===<br />
<br />
====With Xcode 4====<br />
<br />
To test the game, select the "client" scheme from the combo box on the toolbar, and click the run button or press {{Hotkey|MacCommand}}{{Hotkey|R}}.<br />
<br />
====With Unix Makefiles====<br />
<br />
After compiling, you'll have to place the data files in the <code>main</code> directory in your build directory. [[#Acquiring the Game Files|For download instructions, see below.]]<br />
<br />
Your file structure should look as follows:<br />
<br />
[[File:Build_dir_Mac_OS_X.png]]<br />
<br />
You may now start the application as such:<br />
<br />
$ ./daemon.i386<br />
<br />
Note that older machines will not support the new OpenGL 3 renderer, and must be started specifying the "vanilla" (aka "GL") renderer:<br />
<br />
$ ./daemon.i386 +set cl_renderer GL<br />
<br />
===Bundling the Application===<br />
<br />
====With CPack====<br />
<br />
CPack is able to create standalone bundles (as well as many other types of installers). However you must generate the files using Unix Makefiles instead of Xcode.<br />
<br />
$ cd /path/to/Unvanquished-build<br />
$ cpack -G Bundle<br />
<br />
Some warnings will be printed however these can be safely ignored. There should be a file called Unvanquished.dmg in the Unvanquished-build folder.<br />
<br />
====Manually====<br />
<br />
You'll find the Mac [http://macdylibbundler.sourceforge.net/ dynamic library bundler] to be quite useful (you must generate the files using Unix Makefiles instead of Xcode):<br />
<br />
$ curl -L http://sourceforge.net/projects/macdylibbundler/files/macdylibbundler/0.4.1/dylibbundler0.4.1.zip/download > \<br />
dylibbundler0.4.1.zip<br />
$ unzip dylibbundler0.4.1.zip<br />
$ cd dylibbundler<br />
$ make<br />
$ sudo make install<br />
<br />
Once you've done that, you can proceed to create the application bundle. Note that these steps assume that you have downloaded the data files to <code>main/</code> as shown above:<br />
<br />
<pre><br />
$ git=/path/to/Unvanquished-git-repo<br />
$ build=/path/to/Unvanquished-build-dir<br />
$ mkdir -pv Unvanquished.app/Contents/{libs,MacOS,Resources,Frameworks}<br />
$ cp -r $build/main Unvanquished.app/Contents/MacOS<br />
$ sips -s format tiff $git/debian/unvanquished.png --out temp.tiff<br />
$ tiff2icns temp.tiff Unvanquished.app/Contents/Resources/Unvanquished.icns<br />
$ rm temp.tiff<br />
$ cp $build/daemon{,ded}.i386 $build/*.dylib Unvanquished.app/Contents/MacOS<br />
$ cp -r /Library/Frameworks/SDL.framework Unvanquished.app/Contents/Frameworks<br />
$ install_name_tool -id \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/Frameworks/SDL.framework/Versions/A/SDL<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGLi386.dylib<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGL3i386.dylib<br />
$ for binary in Unvanquished.app/Contents/MacOS/*.{i386,dylib}; do<br />
dylibbundler -b -x $binary -d $dest/Unvanquished.app/Contents/libs/; done<br />
$ cp /usr/lib/libGLEW.1.7.0.dylib ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ chmod +w ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -id @executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -change /usr/lib/libGLEW.1.7.0.dylib \<br />
@executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ cat > Unvanquished.app/Contents/Info.plist<br />
<?xml version="1.0" encoding="UTF-8"?><br />
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"<br />
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"><br />
<plist version="1.0"><br />
<dict><br />
<key>CFBundleName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleDisplayName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleExecutable</key><br />
<string>daemon.i386</string><br />
<key>CFBundleIconFile</key><br />
<string>Unvanquished.icns</string><br />
<key>CFBundleIdentifier</key><br />
<string>net.Unvanquished</string><br />
<key>CFBundleInfoDictionaryVersion</key><br />
<string>6.0</string><br />
<key>CFBundlePackageType</key><br />
<string>APPL</string><br />
<key>CFBundleShortVersionString</key><br />
<string>0.4.0</string><br />
<key>CFBundleVersion</key><br />
<string>0.4.0</string><br />
</dict><br />
</plist><br />
^d<br />
</pre><br />
<br />
Note: <code>^d</code> indicates pressing {{Hotkey|Ctrl}}{{Hotkey|D}} on the keyboard.<br />
<br />
The contents of the completed application bundle should look like this:<br />
<br />
[[File:Bundle_dir_Mac_OS_X.png]]<br />
<br />
'''Note''': If you compiled SDL from source, you will not see a directory titled <code>SDL.framework</code>.<br />
<br />
==Windows==<br />
<br />
===Visual Studio===<br />
<br />
CMake can generate Visual Studio projects for unvanquished however this feature is relatively new and may have some bugs.<br />
<br />
Steps:<br />
<br />
# Double click on Visual_Studio32.bat<br />
# Open build-32/Daemon.sln in Visual Studio 2010.<br />
# In the two text boxes in the toolbar, select "Release" or "Debug" in the first one and Win32 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 />
====Important Notes====<br />
<br />
* LLVM is disabled and does not work correctly with CMake generated Visual Studio projects.<br />
* ncurses is not supported under Visual Studio.<br />
* The path to the build folder must not have any spaces otherwise generation of QVMs will fail. See [https://github.com/Unvanquished/Unvanquished/issues/102 issue 102]<br />
* Due to limitations with cmake neither the startup project nor the working directory can be specified. These must be manually set to the following values for debugging the client under Visual Studio<br />
** Right click on client and select "Set as StartUp project".<br />
** Right click on client, select properties, select Debugging and set "Working Directory" to $(TargetPath)\..<br />
<br />
===MinGW===<br />
<br />
Unvanquished is supported under MinGW. The build process should be fairly similar to the Linux instructions.<br />
<br />
The easiest way to acquire and install MinGW is with the graphical [http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/ mingw-get-inst installer]. <!-- TODO: maybe walk the user through the installer? --><br />
<br />
When configuring the build with CMake, you will find that you will have to set a number of libraries manually. You can find precompiled DLLs for most of the dependencies; those that are not pre-compiled can be built with the corresponding <code>USE_INTERNAL_</code> setting.<br />
<br />
On Windows, SDL requires that the Direct X SDK can be installed. You may download the June 2010 release from [http://www.microsoft.com/en-us/download/details.aspx?id=6812 Microsoft's site].<br />
<br />
The easiest way to get a build up (at the time of writing) is as follows: <!-- FIXME: incomplete --><br />
<br />
{{Note|content=Be aware that some of these paths are for the 64 bit versions of libraries; if you are on a 32-bit system, you will need to change some of these paths. The easiest way to locate libraries is to navigate in Windows Explorer to the <code>src/libs</code> directory and search for files matching <code>dll</code>.}}<br />
<br />
<ol><br />
<!-- might not be necessary<br />
<li>Download and extract the latest version of the [http://gmplib.org/ GNU MP Bignum Library (GMP)]. (You will need either cygwin with tar and bz2 installed or 7-zip to extract the archive.)</li><br />
<li>Theoretically, you can compile GMP with either the MSYS shell (from MinGW) or Cygwin, but you may experience issues with the former. Regardless of which you use, the steps to compile are the same:<br />
<pre><br />
$ ./configure --disable-static --enable-shared<br />
$ make<br />
</pre><br />
The <code>--disable-static</code> and <code>--enable-shared</code> flags configure GMP to build a DLL instead of a static library. You may optionally perform <code>make install</code>. Additional compilation instructions [http://www.cs.nyu.edu/exact/core/gmp/ are available].<br />
</li><br />
--><br />
<li>Set the following CMake flags:<br />
{| class="wikitable"<br />
! Setting<br />
! Description<br />
! Type<br />
! Value<br />
|-<br />
| <code>USE_INTERNAL_CRYPTO</code><br />
| Use the provided copies of crypto libraries. <!-- FIXME: I think these are nettle and something else --><br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_GLEW</code><br />
| Use the provided copy of GLEW.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_JPEG</code><br />
| Use the provided copy of JPEG.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SDL</code><br />
| Use the provided copy of SDL.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SPEEX</code><br />
| Use the provided copy of Speex.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_WEBP</code><br />
| Use the provided copy of WebP.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_CURSES</code><br />
| Enables/disables curses.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>PNG_LIBRARY</code><br />
| Path to the PNG library DLL.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng/libs/win32/libpng.lib</code><br />
|-<br />
| <code>PNG_PNG_INCLUDE_DIR</code><br />
| Path to the PNG library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng</code><br />
|-<br />
| <code>FREETYPE_LIBRARY</code><br />
| Path to the compiled FreeType library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/lib/freetype.lib</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_freetype2</code><br />
| Path to the FreeType library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/freetype2</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_ft2build</code><br />
| Path to the FreeType library file "ftbuild.h".<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/</code><br />
|-<br />
| <code>GMP_INCLUDE_DIR</code><br />
| Path to the GMP library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/gmp/include</code><br />
|-<br />
| <code>GMP_LIBRARY</code><br />
| Path to the GMP library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/gmp/libs/win32/mpir.lib</code><br />
|-<br />
| <code>ZLIB_INCLUDE_DIR</code><br />
| Path to the zlib library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/include</code><br />
|-<br />
| <code>ZLIB_LIBRARY</code><br />
| Path to the zlib library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/lib/x64/zlibstat.lib</code><br />
|-<br />
| <code>CURL_LIBRARY</code><br />
| Path to the CURL library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/lib/win32/release/libcurl.dll</code><br />
|-<br />
| <code>CURL_INCLUDE_DIR</code><br />
| Path to the zlib library.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/include/curl</code><br />
|-<br />
| <code>USE_OPENAL</code><br />
| Enables/disables OpenAL support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_THEORA</code><br />
| Enables/disables Theora support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_XVID</code><br />
| Enables/disables Xvid support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CODEC_THEORA</code><br />
| Enables/disables Ogg support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>SDLMAIN_LIBRARY</code><br />
| Enables/disables Ogg support.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code><br />
|-<br />
|}<br />
Do note that CMake is slash-direction&ndash;agnostic; it can handle both forward- and backslashes on Windows.<br />
</li><br />
<li>Open <code><var>SourcePath</var>/CMakeLists.txt</code> and edit the line<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi z )<br />
</pre><br />
(around line 1040) to look like this:<br />
<pre><br />
set( OS_LIBRARIES m winmm ws2_32 psapi )<br />
</pre><br />
</li><br />
<li>Open <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code> and edit the lines:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "SDL.h"<br />
#include "SDL_main.h"<br />
</pre><br />
to look like:<br />
<pre><br />
/* Include the SDL main definition header */<br />
#include "../../../include/SDL.h"<br />
#include "../../../include/SDL_main.h"<br />
</pre><br />
<li>Open a terminal and <code>cd</code> to your source directory.</li><br />
<li>Run <code>make</code>:<br />
<pre><br />
> mingw32-make<br />
</pre><br />
If you would like verbose output, set the <code>VERBOSE</code> environment variable before running <code>make</code>.<br />
<pre><br />
> set VERBOSE=1<br />
</pre><br />
</li><br />
</ol><br />
<br />
====Notes====<br />
<br />
* If you would like to use curses, try using [http://sourceforge.net/projects/pdcurses/files/pdcurses PDCurses].<br />
<br />
===QtCreator===<br />
<br />
# Install MinGW and follow the above instructions, except select Code::Blocks as the generator.<br />
# Start QtCreator, and select "Open File or Project&hellip;" from the File menu.<br />
# Navigate to your source directory and open CMakeLists.txt.<br />
# At the CMake Wizard, select the same build directory you already configured using CMake. (If you did not chose Code::Blocks as the generator, you will have to start over again, as QtCreator requires a Code::Blocks project file in order to compile the source.)<br />
# Ensure that a generator is selected in the combo box, and click "Run CMake". If there is no generator listed, see the [[#Troubleshooting|troubleshooting]] section below.<br />
# Click "Finish" to close the wizard.<br />
<br />
You should now be able to compile, run, and debug the code using QtCreator.<br />
<br />
====Troubleshooting====<br />
<br />
If at the "Run CMake" prompt of the the CMake Wizard, select "Run CMake" and are warned that no generator was selected, and notice that there are no generators in the combo box, you will likely have to [http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html manually configure your toolchain]. Select "Options&hellip;" from the "Tools" menu, then navigate to "Build &amp; Run".<br />
<br />
At the options window,<br />
* Go to the "Kits" tab, and mouse over the "Desktop (default)" kit under "Manual". If there were any errors in configuring this kit, they will be displayed in the tool tip. If there are problems, select the kit. You may need to manually specify the location of the MinGW debugger, for example, which is typically <code>C:\MinGW\bin\gdb.exe</code>.<br />
* Go to the "Compilers" tab, and ensure that MinGW is present. If not, you will need to add it manually.<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 />
libgmp3-dev libjpeg8-dev libncurses5-dev libogg-dev libopenal-dev \<br />
libpng12-dev libsdl1.2-dev libvorbis-dev zlib1g-dev nettle-dev \<br />
libwebp-dev libspeexdsp-dev libtheora-dev<br />
<br />
If the version of WebP supplied by your version of Debian or Ubuntu is older than v0.2.0, you will need to [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0.tar.gz download] and [https://developers.google.com/speed/webp/docs/compiling#unix compile it from source]. After compiling and installing with <code>sudo make install</code>, in CMake, you'll need to set <code>WEBP_INCLUDE_DIR</code> to <code>/usr/local/include/webp</code> and <code>WEBP_LIBRARY</code> to <code>/usr/local/lib/libwebp.so</code>.<br />
<br />
'''We currently provide a ready-to-use libwebp-dev in our [http://{{SERVERNAME}}/index.php/Download#ubuntu Debian and Ubuntu repositories], alongside .debs of the game and server.'''<br />
<br />
Actual dev package names may vary, e.g. libgmp-dev instead of libgmp3-dev and libglew-dev or libglew1.7-dev instead of libglew1.5-dev.<br />
<br />
Since we have a debian directory in the source, you can also to check what's needed then install the listed packages (choosing from alternatives as needed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ dpkg-checkbuilddeps<br />
…<br />
$ sudo apt-get install <var>package(s)</var><br />
<br />
If dpkg-checkbuilddeps produces no output, you have all necessary build dependencies. Also, debhelper's only needed if you're building .debs.<br />
<br />
====Gentoo====<br />
<br />
$ emerge curl freetype glew gmp jpeg ncurses libogg openal libpng libsdl libvorbis zlib<br />
<br />
====openSUSE====<br />
<br />
$ sudo install zypper gcc gcc-c++ Mesa-libGL-devel SDL-devel libjpeg8-devel \<br />
libpng12-devel glew-devel webp-devel ncurses-devel gmp-devel libcurl-devel \<br />
libnettle-devel openal-soft-devel speex-devel libvorbis-devel \<br />
libtheora-devel<br />
<br />
The latest version of WebP must be installed manually:<br />
<br />
$ wget https://webp.googlecode.com/files/libwebp-0.2.1.tar.gz<br />
$ tar xvzf libwebp-0.2.1.tar.gz<br />
$ cd libwebp-0.2.1<br />
$ ./configure && make<br />
$ sudo make install<br />
<br />
You must disable curses (set <code>USE_CURSES</code> appropriately in CMake) as failing to do so will cause Unvanquished to crash on startup.<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 />
On Debian or 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 />
Or, in Debian or Ubuntu, you can build a package (but you'll need to have devscripts and fakeroot installed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ fakeroot dpkg-buildpackage -b -uc<br />
$ sudo dpkg -i <var>../unvanquished_*.deb</var><br />
<br />
Once in <code>ccmake</code>, use the following keys:<br />
<br />
* Press {{Hotkey|c}} to configure. If an error occurs during this phase, make note of it and press {{Hotkey|e}} to dismiss it.<br />
* Use the up and down arrow keys to navigate the compilation options.<br />
* Press {{Hotkey|Enter}} to enable or disable boolean options (i.e., on/off) or to edit textual options.<br />
** Press {{Hotkey|Esc}} when editing a textual option to cancel the change.<br />
<br />
Once you have finished the configuration process, press {{Hotkey|C}} again, then {{Hotkey|G}} 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=====<br />
<br />
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_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 />
* <code>USE_CIN_THEORA</code> &mdash; Disabling this prevents videos from being recorded in Theora.<br />
* <code>USE_CIN_XVID</code> &mdash; Disabling this prevents videos from being recorded in Xvid.<br />
* <code>USE_VOIP</code> &mdash; Disabling this removes VOIP support. Alternatively enabling <code>USE_INTERNAL_SPEEX</code> will use the libraries distributed with Unvanquished for VoIP<br />
* <code>USE_INTERNAL_CRYPTO</code> &mdash; Enable this to use the crypto libraries provided by Unvanquished.<br />
<br />
===Compiling===<br />
<br />
$ cd <var>path/to/unvanquished/build</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 />
===Acquiring mandatory game files===<br />
<br />
The game files are not in the Git repository, and must be downloaded separately. This may be done on the command line or from your web browser. The downloads may be found on [http://sourceforge.net/projects/unvanquished/files/Assets SourceForge.net]. If you download the files from your browser, just download the files named "pak*.pk3", and save them to the [[Running_the_game#Data_locations|data location]] for your system.<br />
<br />
On Linux, this may be done as follows:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
wget -O $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On FreeBSD, using the <code>sh</code> shell:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
fetch -r -o $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On Mac OS X:<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
curl -L "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download" > $file<br />
fi<br />
done<br />
<br />
Linux users may also use the <code>download-pk3.sh</code> script that is distributed with the source code, which requires that curl be installed:<br />
<br />
$ cd <var>[path to Unvanquished source code]</var><br />
$ mkdir -p ~/.Unvanquished/main<br />
$ ./download-pk3.sh ~/.Unvanquished/main<br />
<br />
===Downloading the map pack===<br />
<br />
The map pack exists only for convenience; if you do not download the map pack, Unvanquished will automatically download maps as needed when you attempt to play online.<br />
<br />
To download the map pack on Linux:<br />
<br />
$ wget -O maps.7z "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z"; done<br />
<br />
To download the map pack on Mac OS X:<br />
<br />
$ curl -L "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z" > maps.7z; done<br />
<br />
Note that you will need to unzip the map pack on either system as it is compressed with LZMA. Mac users can use the [http://wakaba.c3.cx/s/apps/unarchiver.html Unarchiver]. Uncompressing the archive on Linux is highly dependent on your distribution.<br />
<br />
===Verifying the Files===<br />
<br />
Download the latest [http://sourceforge.net/projects/unvanquished/files/Assets/{{CurrentVersion|MD5HashFile}} MD5 hash file] and save it to your system's [[Running_the_game#Data_directory|data location]].<br />
<br />
On systems with the <code>md5</code> command (Mac OS X):<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ cat {{CurrentVersion|MD5HashFile}} | while read line; do<br />
file="`echo "$line" | sed -E "s/^[a-fA-F0-9]+ +\*?//"`"<br />
if [ -e "$file" ]; then<br />
if [ `md5 -r "$file" | cut -d\ -f1` = "`echo "$line" | cut -d\ -f1`" ]<br />
then echo "File \"$file\" appears okay."<br />
else echo "File \"$file\" is corrupt"'!' >&2<br />
fi; fi; done<br />
<br />
On systems with the <code>md5sum</code> command (most Linux distributions):<br />
<br />
$ cd <var>[[Running_the_game#Data_directory|/path/to/data/files]]</var><br />
$ md5sum -c {{CurrentVersion|MD5HashFile}} 2>&1 | grep -v "open or read\|file or directory"<br />
<br />
The <code>grep</code> invocation is used to strip output complaining about missing files.<br />
<br />
Any files that are found to be corrupt should be replaced; just download a [http://sourceforge.net/projects/unvanquished/files/Assets new copy] of the affected file(s).<br />
<br />
==Errors==<br />
<br />
===CMake cannot locate Newton===<br />
<br />
If CMake cannot find Newton, you'll need to set it up yourself.<br />
<br />
It should be in <code><var>/path/to/Unvanquished</var>/src/libs/libnewton/libs/<var>your_os</var>/libNewton.so</code>.<br />
Be sure to replace <var>your_os</var> with the proper directory name.<br />
<br />
Use CMake as before to change the <code>NEWTON_LIBRARY</code> build setting to the said path:<br />
<br />
# Start the CMake configurator:<pre>$ ccmake ..</pre><br />
# Scroll down and highlight <code>NEWTON_LIBRARY</code>.<br />
# Press {{Hotkey|Enter}} to begin editing and input in the path.<br />
# Press {{Hotkey|C}} to configure and {{Hotkey|G}} to generate the new makefiles.<br />
# Press {{Hotkey|Q}} to quit.<br />
# Recompile the source:<pre>$ make</pre><br />
<br />
===The C Compiler is not able to compile a simple test program===<br />
<br />
When attempting to generate a solution for Xcode CMake fails with the following error<br />
-- Check for working C compiler using: Xcode -- broken<br />
CMake Error at /Applications/CMake 2.8-8.app/Contents/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):<br />
The C compiler "/usr/bin/gcc" is not able to compile a simple test program.<br />
<br />
It fails with the following output:<br />
<br />
Change Dir: /Users/danielmaloney/Documents/Unvanquished/build-xcode/CMakeFiles/CMakeTmp<br />
<br />
<br />
<br />
Run Build Command:/Applications/CMake\ 2.8-8.app/Contents/bin/cmakexbuild<br />
-project CMAKE_TRY_COMPILE.xcodeproj build -target<br />
cmTryCompileExec1400153232 -configuration Debug<br />
<br />
Error: No developer directory found at /Developer. Run<br />
/usr/bin/xcode-select to update the developer directory path.<br />
<br />
<br />
<br />
<br />
<br />
CMake will not be able to correctly generate this project.<br />
Call Stack (most recent call first):<br />
CMakeLists.txt:19 (project)<br />
<br />
This is due to Xcode 4.3 having a different directory structure to previous versions. Simply running the following command will correct this error:<br />
sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer/</div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Compiling_the_source&diff=1948Compiling the source2013-04-13T03:02:57Z<p>Velociostrich: /* MinGW */ The precompiled 64-bit versions of PNG and freetype don't work with 32-bit MinGW evidently, so use the 32-bit ones instead.</p>
<hr />
<div>==Mac OS X==<br />
<br />
First, you need to [[Getting_the_source|acquire the source code]].<br />
<br />
Regardless of what interface you may use to compile the source, you will need [http://www.cmake.org/cmake/resources/software.html CMake] to generate makefiles. You will also need to install [https://developer.apple.com/xcode/ Xcode] (making sure to choose to install the command-line utilities when prompted by the installer).<br />
<br />
Then, you will need to acquire (and in some cases, manually compile) at a minimum the [[#Dependencies|necessary libraries]].<br />
<br />
Once you have the source code and the libraries installed, you may actually proceed to compile the source. You have several options:<br />
* '''Compile the source at the command line'''. This is the easiest if you would just like to compile the game to use yourself and you do not intend to work on the code.<br />
* '''Compile the source using an IDE'''. This is preferred if you intend on developing the source.<br />
** Xcode is Apple's flagship IDE and you should have installed to compile the source regardless of which method you use.<br />
** [http://qt-project.org/downloads QtCreator] is cross-platform and provides real-time feedback of syntax errors, a Vim mode, as well as other features.<br />
** [http://www.codeblocks.org/ Code::Blcoks] is also cross-platform but lacks some of the features of Xcode and QtCreator.<br />
<br />
===Dependencies===<br />
<br />
You only need to use one of the following methods (HomeBrew or compiling by hand). Please try and avoid mixing methods as this may produce unexpected results.<br />
<br />
Unvanquished requires the following libraries:<br />
* [[#JPEG|JPEG]], version 8 or higher. (Version 6 was known to have problems)<br />
* [[#Simple_DirectMedia_Layer_.28SDL.29|Simple DirectMedia Layer]] (The binary provided by libsdl.org causes graphical corruptions. Compile from source or use homebrew/macports)<br />
* [[#The_OpenGL_Extension_Wrangler_Library_.28GLEW.29|The OpenGL Extension Wrangler Library]]<br />
* CuRL<br />
* [[#The_GNU_MP_Bignum_Library_.28libgmp.29|GMP]]<br />
* [[#WebP|WebP]] (v0.2.0 or newer)<br />
<br />
The following libraries are optional:<br />
* Theora<br />
* Speex<br />
* [[#Ogg|Ogg]]<br />
* [[#Vorbis|Vorbis]]<br />
<br />
====HomeBrew====<br />
Install [http://mxcl.github.com/homebrew/ HomeBrew] and then run the following command<br />
<br />
$ brew install nettle libjpeg curl sdl webp xvid gmp glew speex libvorbis theora<br />
<br />
All the necessary libraries should now have been installed.<br />
<br />
====Compiling by hand====<br />
The following are shell scripts that download, compile, and install various libraries. This is more time consuming then other methods but might be useful if you need more control over your libraries<br />
<br />
=====JPEG=====<br />
<br />
$ curl http://www.ijg.org/files/jpegsrc.v8d.tar.gz > jpegsrc.v8d.tar.gz<br />
$ tar xvzf jpegsrc.v8d.tar.gz<br />
$ cd jpeg-8d<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The OpenGL Extension Wrangler Library (GLEW)=====<br />
<br />
$ curl -L https://sourceforge.net/projects/glew/files/glew/1.7.0/glew-1.7.0.tgz/download > glew-1.7.0.tgz<br />
$ tar xvzf glew-1.7.0.tgz<br />
$ cd glew-1.7.0<br />
$ make<br />
$ sudo make install<br />
<br />
=====Simple DirectMedia Layer (SDL)=====<br />
<br />
Do not use the binaries provided by libsdl.org, as these are known to cause issues with gamma and color display. Instead, compile your own:<br />
<br />
$ curl http://www.libsdl.org/release/SDL-1.2.15.tar.gz > SDL-1.2.15.tar.gz<br />
$ tar xvzf SDL-1.2.15.tar.gz<br />
$ cd SDL-1.2.15<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The GNU MP Bignum Library (libgmp)=====<br />
<br />
$ curl ftp://ftp.gmplib.org/pub/gmp-5.0.5/gmp-5.0.5.tar.bz2 > gmp-5.0.5.tar.bz2<br />
$ tar xvjf gmp-5.0.5.tar.bz2<br />
$ cd gmp-5.0.5<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Ogg=====<br />
<br />
$ curl http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz > libogg-1.3.0.tar.gz<br />
$ tar xvzf libogg-1.3.0.tar.gz<br />
$ cd libogg-1.3.0<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Vorbis=====<br />
<br />
$ curl http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz > libvorbis-1.3.3.tar.gz<br />
$ tar xvzf libvorbis-1.3.3.tar.gz<br />
$ cd libvorbis-1.3.3<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====WebP=====<br />
<br />
You do not need to compile WebP by hand; Google provides binaries for Mac OS X available from their [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0-mac-10.5.tar.gz project page]. You will need version 0.2.0 or newer.<br />
<br />
Once downloaded, you must still install the header files and the binary:<br />
<br />
$ curl https://webp.googlecode.com/files/libwebp-0.2.0-mac-10.5.tar.gz > libwebp-0.2.0-mac-10.5.tar.gz<br />
$ tar xvzf libwebp-0.2.0-mac-10.5.tar.gz<br />
$ cd libwebp-0.2.0-mac-10.5<br />
$ sudo cp include/webp /usr/local/include<br />
$ sudo cp lib/libwebp.a /usr/local/lib<br />
<br />
===Configuring with CMake===<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 should be a different directory.<br />
# Hit "Configure". You will be prompted as to which generator you would like to use. If you have Xcode installed, choose that. Wait while the configuration process runs. You may have to set the following:<br />
## If CMake did not find your jpeg headers for some reason, set <code>JPEG_INCLUDE_DIR</code> to <code>/path/to/Unvanquished/src/libs/jpeg</code>.<br />
## Check <code>USE_INTERNAL_CRYPTO</code> to avoid having to compile nettle and hogweed.<br />
## Check <code>USE_INTERNAL_SPEEX</code> to avoid having to compile Speex.<br />
## Uncheck <code>USE_CIN_THEORA</code> and <code>USE_CIN_XVID</code> to avoid having to compile Theora or Xvid. (At present, there are not cutscenes or any such that require it.)<br />
## '''You will probably not be able to compile with the GLSL optimizer enabled; uncheck <code>USE_GLSL_OPTIMIZER</code>'''<br />
## If you have selected to generate Xcode project files, make the <code>SDLMAIN_LIBRARY</code> field blank. This option is not available if you have the generator set to Unix makefiles.<br />
# Hit "Generate".<br />
# You may now close Xcode.<br />
<br />
===Compiling===<br />
<br />
====With Xcode====<br />
<br />
<ol><br />
<li>Compilation will fail unless you manually create certain directories needed by the build scripts:<br />
<pre><br />
$ cd /path/to/build/dir/CMakeFiles<br />
$ mkdir gpp{game,trem,ui}-qvm.dir<br />
</pre><br />
This is a workaround to {{Issue|101}}.<br />
</li><br />
<li>Either start Xcode and open the project file (in the build directory you specified) or double-click the project file in Finder.</li><br />
<li>Open the project file created by CMake, which should be in the build directory you specified.</li><br />
<li>Change the active target to "ALL_BUILD" and click Product&rarr;Build.</li><br />
</ol><br />
<br />
====With Unix Makefiles====<br />
<br />
<ul><br />
<li>Start Terminal (Applications &rarr; Utilities &rarr; Terminal).</li><br />
<li>Input the following commands:<br />
<pre><br />
$ cd /path/to/Unvanquished-build<br />
$ make<br />
</pre><br />
If you are on a multi-core or multi-processor machine, you may speed up the process by passing the <code>-j</code> argument followed by the number of available cores to <code>make</code>; e.g., <code>make -j4</code>. Note that doing so makes reading error messages more difficult, as multiple instances of the compiler will print to the screen at once, causing information to appear out of order.<br />
</li><br />
</ul><br />
<br />
===Testing the build===<br />
<br />
====With Xcode 4====<br />
<br />
To test the game, select the "client" scheme from the combo box on the toolbar, and click the run button or press {{Hotkey|MacCommand}}{{Hotkey|R}}.<br />
<br />
====With Unix Makefiles====<br />
<br />
After compiling, you'll have to place the data files in the <code>main</code> directory in your build directory. [[#Acquiring the Game Files|For download instructions, see below.]]<br />
<br />
Your file structure should look as follows:<br />
<br />
[[File:Build_dir_Mac_OS_X.png]]<br />
<br />
You may now start the application as such:<br />
<br />
$ ./daemon.i386<br />
<br />
Note that older machines will not support the new OpenGL 3 renderer, and must be started specifying the "vanilla" (aka "GL") renderer:<br />
<br />
$ ./daemon.i386 +set cl_renderer GL<br />
<br />
===Bundling the Application===<br />
<br />
====With CPack====<br />
<br />
CPack is able to create standalone bundles (as well as many other types of installers). However you must generate the files using Unix Makefiles instead of Xcode.<br />
<br />
$ cd /path/to/Unvanquished-build<br />
$ cpack -G Bundle<br />
<br />
Some warnings will be printed however these can be safely ignored. There should be a file called Unvanquished.dmg in the Unvanquished-build folder.<br />
<br />
====Manually====<br />
<br />
You'll find the Mac [http://macdylibbundler.sourceforge.net/ dynamic library bundler] to be quite useful (you must generate the files using Unix Makefiles instead of Xcode):<br />
<br />
$ curl -L http://sourceforge.net/projects/macdylibbundler/files/macdylibbundler/0.4.1/dylibbundler0.4.1.zip/download > \<br />
dylibbundler0.4.1.zip<br />
$ unzip dylibbundler0.4.1.zip<br />
$ cd dylibbundler<br />
$ make<br />
$ sudo make install<br />
<br />
Once you've done that, you can proceed to create the application bundle. Note that these steps assume that you have downloaded the data files to <code>main/</code> as shown above:<br />
<br />
<pre><br />
$ git=/path/to/Unvanquished-git-repo<br />
$ build=/path/to/Unvanquished-build-dir<br />
$ mkdir -pv Unvanquished.app/Contents/{libs,MacOS,Resources,Frameworks}<br />
$ cp -r $build/main Unvanquished.app/Contents/MacOS<br />
$ sips -s format tiff $git/debian/unvanquished.png --out temp.tiff<br />
$ tiff2icns temp.tiff Unvanquished.app/Contents/Resources/Unvanquished.icns<br />
$ rm temp.tiff<br />
$ cp $build/daemon{,ded}.i386 $build/*.dylib Unvanquished.app/Contents/MacOS<br />
$ cp -r /Library/Frameworks/SDL.framework Unvanquished.app/Contents/Frameworks<br />
$ install_name_tool -id \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/Frameworks/SDL.framework/Versions/A/SDL<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGLi386.dylib<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGL3i386.dylib<br />
$ for binary in Unvanquished.app/Contents/MacOS/*.{i386,dylib}; do<br />
dylibbundler -b -x $binary -d $dest/Unvanquished.app/Contents/libs/; done<br />
$ cp /usr/lib/libGLEW.1.7.0.dylib ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ chmod +w ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -id @executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -change /usr/lib/libGLEW.1.7.0.dylib \<br />
@executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ cat > Unvanquished.app/Contents/Info.plist<br />
<?xml version="1.0" encoding="UTF-8"?><br />
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"<br />
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"><br />
<plist version="1.0"><br />
<dict><br />
<key>CFBundleName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleDisplayName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleExecutable</key><br />
<string>daemon.i386</string><br />
<key>CFBundleIconFile</key><br />
<string>Unvanquished.icns</string><br />
<key>CFBundleIdentifier</key><br />
<string>net.Unvanquished</string><br />
<key>CFBundleInfoDictionaryVersion</key><br />
<string>6.0</string><br />
<key>CFBundlePackageType</key><br />
<string>APPL</string><br />
<key>CFBundleShortVersionString</key><br />
<string>0.4.0</string><br />
<key>CFBundleVersion</key><br />
<string>0.4.0</string><br />
</dict><br />
</plist><br />
^d<br />
</pre><br />
<br />
Note: <code>^d</code> indicates pressing {{Hotkey|Ctrl}}{{Hotkey|D}} on the keyboard.<br />
<br />
The contents of the completed application bundle should look like this:<br />
<br />
[[File:Bundle_dir_Mac_OS_X.png]]<br />
<br />
'''Note''': If you compiled SDL from source, you will not see a directory titled <code>SDL.framework</code>.<br />
<br />
==Windows==<br />
<br />
===Visual Studio===<br />
<br />
CMake can generate Visual Studio projects for unvanquished however this feature is relatively new and may have some bugs.<br />
<br />
Steps:<br />
<br />
# Double click on Visual_Studio32.bat<br />
# Open build-32/Daemon.sln in Visual Studio 2010.<br />
# In the two text boxes in the toolbar, select "Release" or "Debug" in the first one and Win32 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 />
====Important Notes====<br />
<br />
* LLVM is disabled and does not work correctly with CMake generated Visual Studio projects.<br />
* ncurses is not supported under Visual Studio.<br />
* The path to the build folder must not have any spaces otherwise generation of QVMs will fail. See [https://github.com/Unvanquished/Unvanquished/issues/102 issue 102]<br />
* Due to limitations with cmake neither the startup project nor the working directory can be specified. These must be manually set to the following values for debugging the client under Visual Studio<br />
** Right click on client and select "Set as StartUp project".<br />
** Right click on client, select properties, select Debugging and set "Working Directory" to $(TargetPath)\..<br />
<br />
===MinGW===<br />
<br />
Unvanquished is supported under MinGW. The build process should be fairly similar to the Linux instructions.<br />
<br />
The easiest way to acquire and install MinGW is with the graphical [http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/ mingw-get-inst installer]. <!-- TODO: maybe walk the user through the installer? --><br />
<br />
When configuring the build with CMake, you will find that you will have to set a number of libraries manually. You can find precompiled DLLs for most of the dependencies; those that are not pre-compiled can be built with the corresponding <code>USE_INTERNAL_</code> setting.<br />
<br />
On Windows, SDL requires that the Direct X SDK can be installed. You may download the June 2010 release from [http://www.microsoft.com/en-us/download/details.aspx?id=6812 Microsoft's site].<br />
<br />
The easiest way to get a build up (at the time of writing) is as follows: <!-- FIXME: incomplete --><br />
<br />
{{Note|content=Be aware that some of these paths are for the 64 bit versions of libraries; if you are on a 32-bit system, you will need to change some of these paths. The easiest way to locate libraries is to navigate in Windows Explorer to the <code>src/libs</code> directory and search for files matching <code>dll</code>.}}<br />
<br />
<ol><br />
<!-- might not be necessary<br />
<li>Download and extract the latest version of the [http://gmplib.org/ GNU MP Bignum Library (GMP)]. (You will need either cygwin with tar and bz2 installed or 7-zip to extract the archive.)</li><br />
<li>Theoretically, you can compile GMP with either the MSYS shell (from MinGW) or Cygwin, but you may experience issues with the former. Regardless of which you use, the steps to compile are the same:<br />
<pre><br />
$ ./configure --disable-static --enable-shared<br />
$ make<br />
</pre><br />
The <code>--disable-static</code> and <code>--enable-shared</code> flags configure GMP to build a DLL instead of a static library. You may optionally perform <code>make install</code>. Additional compilation instructions [http://www.cs.nyu.edu/exact/core/gmp/ are available].<br />
</li><br />
--><br />
<li>Set the following CMake flags:<br />
{| class="wikitable"<br />
! Setting<br />
! Description<br />
! Type<br />
! Value<br />
|-<br />
| <code>USE_INTERNAL_CRYPTO</code><br />
| Use the provided copies of crypto libraries. <!-- FIXME: I think these are nettle and something else --><br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_GLEW</code><br />
| Use the provided copy of GLEW.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_JPEG</code><br />
| Use the provided copy of JPEG.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SDL</code><br />
| Use the provided copy of SDL.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SPEEX</code><br />
| Use the provided copy of Speex.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_WEBP</code><br />
| Use the provided copy of WebP.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_CURSES</code><br />
| Enables/disables curses.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>PNG_LIBRARY</code><br />
| Path to the PNG library DLL.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng/libs/win32/libpng.lib</code><br />
|-<br />
| <code>PNG_PNG_INCLUDE_DIR</code><br />
| Path to the PNG library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng</code><br />
|-<br />
| <code>FREETYPE_LIBRARY</code><br />
| Path to the compiled FreeType library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/lib/freetype.lib</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_freetype2</code><br />
| Path to the FreeType library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/freetype2</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_ft2build</code><br />
| Path to the FreeType library file "ftbuild.h".<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/</code><br />
|-<br />
| <code>GMP_INCLUDE_DIR</code><br />
| Path to the GMP library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/gmp/include</code><br />
|-<br />
| <code>GMP_LIBRARY</code><br />
| Path to the GMP library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var></code><br />
|-<br />
| <code>ZLIB_INCLUDE_DIR</code><br />
| Path to the zlib library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/include</code><br />
|-<br />
| <code>ZLIB_LIBRARY</code><br />
| Path to the zlib library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/lib/x64/zlibstat.lib</code><br />
|-<br />
| <code>CURL_LIBRARY</code><br />
| Path to the CURL library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/lib/win64/release/libcurl.dll</code><br />
|-<br />
| <code>CURL_INCLUDE_DIR</code><br />
| Path to the zlib library.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/include/curl</code><br />
|-<br />
| <code>USE_OPENAL</code><br />
| Enables/disables OpenAL support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_THEORA</code><br />
| Enables/disables Theora support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_XVID</code><br />
| Enables/disables Xvid support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CODEC_THEORA</code><br />
| Enables/disables Ogg support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>SDLMAIN_LIBRARY</code><br />
| Enables/disables Ogg support.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code><br />
|-<br />
|}<br />
Do note that CMake is slash-direction&ndash;agnostic; it can handle both forward- and backslashes on Windows.<br />
</li><br />
<li>Open a terminal and <code>cd</code> to your source directory.</li><br />
<li>Run <code>make</code>:<br />
<pre><br />
> mingw32-make<br />
</pre><br />
If you would like verbose output, set the <code>VERBOSE</code> environment variable before running <code>make</code>.<br />
<pre><br />
> set VERBOSE=1<br />
</pre><br />
</li><br />
</ol><br />
<br />
====Notes====<br />
<br />
* If you would like to use curses, try using [http://sourceforge.net/projects/pdcurses/files/pdcurses PDCurses].<br />
<br />
===QtCreator===<br />
<br />
# Install MinGW and follow the above instructions, except select Code::Blocks as the generator.<br />
# Start QtCreator, and select "Open File or Project&hellip;" from the File menu.<br />
# Navigate to your source directory and open CMakeLists.txt.<br />
# At the CMake Wizard, select the same build directory you already configured using CMake. (If you did not chose Code::Blocks as the generator, you will have to start over again, as QtCreator requires a Code::Blocks project file in order to compile the source.)<br />
# Ensure that a generator is selected in the combo box, and click "Run CMake". If there is no generator listed, see the [[#Troubleshooting|troubleshooting]] section below.<br />
# Click "Finish" to close the wizard.<br />
<br />
You should now be able to compile, run, and debug the code using QtCreator.<br />
<br />
====Troubleshooting====<br />
<br />
If at the "Run CMake" prompt of the the CMake Wizard, select "Run CMake" and are warned that no generator was selected, and notice that there are no generators in the combo box, you will likely have to [http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html manually configure your toolchain]. Select "Options&hellip;" from the "Tools" menu, then navigate to "Build &amp; Run".<br />
<br />
At the options window,<br />
* Go to the "Kits" tab, and mouse over the "Desktop (default)" kit under "Manual". If there were any errors in configuring this kit, they will be displayed in the tool tip. If there are problems, select the kit. You may need to manually specify the location of the MinGW debugger, for example, which is typically <code>C:\MinGW\bin\gdb.exe</code>.<br />
* Go to the "Compilers" tab, and ensure that MinGW is present. If not, you will need to add it manually.<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 />
libgmp3-dev libjpeg8-dev libncurses5-dev libogg-dev libopenal-dev \<br />
libpng12-dev libsdl1.2-dev libvorbis-dev zlib1g-dev nettle-dev \<br />
libwebp-dev libspeexdsp-dev libtheora-dev<br />
<br />
If the version of WebP supplied by your version of Debian or Ubuntu is older than v0.2.0, you will need to [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0.tar.gz download] and [https://developers.google.com/speed/webp/docs/compiling#unix compile it from source]. After compiling and installing with <code>sudo make install</code>, in CMake, you'll need to set <code>WEBP_INCLUDE_DIR</code> to <code>/usr/local/include/webp</code> and <code>WEBP_LIBRARY</code> to <code>/usr/local/lib/libwebp.so</code>.<br />
<br />
'''We currently provide a ready-to-use libwebp-dev in our [http://{{SERVERNAME}}/index.php/Download#ubuntu Debian and Ubuntu repositories], alongside .debs of the game and server.'''<br />
<br />
Actual dev package names may vary, e.g. libgmp-dev instead of libgmp3-dev and libglew-dev or libglew1.7-dev instead of libglew1.5-dev.<br />
<br />
Since we have a debian directory in the source, you can also to check what's needed then install the listed packages (choosing from alternatives as needed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ dpkg-checkbuilddeps<br />
…<br />
$ sudo apt-get install <var>package(s)</var><br />
<br />
If dpkg-checkbuilddeps produces no output, you have all necessary build dependencies. Also, debhelper's only needed if you're building .debs.<br />
<br />
====Gentoo====<br />
<br />
$ emerge curl freetype glew gmp jpeg ncurses libogg openal libpng libsdl libvorbis zlib<br />
<br />
====openSUSE====<br />
<br />
$ sudo install zypper gcc gcc-c++ Mesa-libGL-devel SDL-devel libjpeg8-devel \<br />
libpng12-devel glew-devel webp-devel ncurses-devel gmp-devel libcurl-devel \<br />
libnettle-devel openal-soft-devel speex-devel libvorbis-devel \<br />
libtheora-devel<br />
<br />
The latest version of WebP must be installed manually:<br />
<br />
$ wget https://webp.googlecode.com/files/libwebp-0.2.1.tar.gz<br />
$ tar xvzf libwebp-0.2.1.tar.gz<br />
$ cd libwebp-0.2.1<br />
$ ./configure && make<br />
$ sudo make install<br />
<br />
You must disable curses (set <code>USE_CURSES</code> appropriately in CMake) as failing to do so will cause Unvanquished to crash on startup.<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 />
On Debian or 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 />
Or, in Debian or Ubuntu, you can build a package (but you'll need to have devscripts and fakeroot installed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ fakeroot dpkg-buildpackage -b -uc<br />
$ sudo dpkg -i <var>../unvanquished_*.deb</var><br />
<br />
Once in <code>ccmake</code>, use the following keys:<br />
<br />
* Press {{Hotkey|c}} to configure. If an error occurs during this phase, make note of it and press {{Hotkey|e}} to dismiss it.<br />
* Use the up and down arrow keys to navigate the compilation options.<br />
* Press {{Hotkey|Enter}} to enable or disable boolean options (i.e., on/off) or to edit textual options.<br />
** Press {{Hotkey|Esc}} when editing a textual option to cancel the change.<br />
<br />
Once you have finished the configuration process, press {{Hotkey|C}} again, then {{Hotkey|G}} 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=====<br />
<br />
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_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 />
* <code>USE_CIN_THEORA</code> &mdash; Disabling this prevents videos from being recorded in Theora.<br />
* <code>USE_CIN_XVID</code> &mdash; Disabling this prevents videos from being recorded in Xvid.<br />
* <code>USE_VOIP</code> &mdash; Disabling this removes VOIP support. Alternatively enabling <code>USE_INTERNAL_SPEEX</code> will use the libraries distributed with Unvanquished for VoIP<br />
* <code>USE_INTERNAL_CRYPTO</code> &mdash; Enable this to use the crypto libraries provided by Unvanquished.<br />
<br />
===Compiling===<br />
<br />
$ cd <var>path/to/unvanquished/build</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 />
===Acquiring mandatory game files===<br />
<br />
The game files are not in the Git repository, and must be downloaded separately. This may be done on the command line or from your web browser. The downloads may be found on [http://sourceforge.net/projects/unvanquished/files/Assets SourceForge.net]. If you download the files from your browser, just download the files named "pak*.pk3", and save them to the [[Running_the_game#Data_locations|data location]] for your system.<br />
<br />
On Linux, this may be done as follows:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
wget -O $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On FreeBSD, using the <code>sh</code> shell:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
fetch -r -o $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On Mac OS X:<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
curl -L "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download" > $file<br />
fi<br />
done<br />
<br />
Linux users may also use the <code>download-pk3.sh</code> script that is distributed with the source code, which requires that curl be installed:<br />
<br />
$ cd <var>[path to Unvanquished source code]</var><br />
$ mkdir -p ~/.Unvanquished/main<br />
$ ./download-pk3.sh ~/.Unvanquished/main<br />
<br />
===Downloading the map pack===<br />
<br />
The map pack exists only for convenience; if you do not download the map pack, Unvanquished will automatically download maps as needed when you attempt to play online.<br />
<br />
To download the map pack on Linux:<br />
<br />
$ wget -O maps.7z "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z"; done<br />
<br />
To download the map pack on Mac OS X:<br />
<br />
$ curl -L "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z" > maps.7z; done<br />
<br />
Note that you will need to unzip the map pack on either system as it is compressed with LZMA. Mac users can use the [http://wakaba.c3.cx/s/apps/unarchiver.html Unarchiver]. Uncompressing the archive on Linux is highly dependent on your distribution.<br />
<br />
===Verifying the Files===<br />
<br />
Download the latest [http://sourceforge.net/projects/unvanquished/files/Assets/{{CurrentVersion|MD5HashFile}} MD5 hash file] and save it to your system's [[Running_the_game#Data_directory|data location]].<br />
<br />
On systems with the <code>md5</code> command (Mac OS X):<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ cat {{CurrentVersion|MD5HashFile}} | while read line; do<br />
file="`echo "$line" | sed -E "s/^[a-fA-F0-9]+ +\*?//"`"<br />
if [ -e "$file" ]; then<br />
if [ `md5 -r "$file" | cut -d\ -f1` = "`echo "$line" | cut -d\ -f1`" ]<br />
then echo "File \"$file\" appears okay."<br />
else echo "File \"$file\" is corrupt"'!' >&2<br />
fi; fi; done<br />
<br />
On systems with the <code>md5sum</code> command (most Linux distributions):<br />
<br />
$ cd <var>[[Running_the_game#Data_directory|/path/to/data/files]]</var><br />
$ md5sum -c {{CurrentVersion|MD5HashFile}} 2>&1 | grep -v "open or read\|file or directory"<br />
<br />
The <code>grep</code> invocation is used to strip output complaining about missing files.<br />
<br />
Any files that are found to be corrupt should be replaced; just download a [http://sourceforge.net/projects/unvanquished/files/Assets new copy] of the affected file(s).<br />
<br />
==Errors==<br />
<br />
===CMake cannot locate Newton===<br />
<br />
If CMake cannot find Newton, you'll need to set it up yourself.<br />
<br />
It should be in <code><var>/path/to/Unvanquished</var>/src/libs/libnewton/libs/<var>your_os</var>/libNewton.so</code>.<br />
Be sure to replace <var>your_os</var> with the proper directory name.<br />
<br />
Use CMake as before to change the <code>NEWTON_LIBRARY</code> build setting to the said path:<br />
<br />
# Start the CMake configurator:<pre>$ ccmake ..</pre><br />
# Scroll down and highlight <code>NEWTON_LIBRARY</code>.<br />
# Press {{Hotkey|Enter}} to begin editing and input in the path.<br />
# Press {{Hotkey|C}} to configure and {{Hotkey|G}} to generate the new makefiles.<br />
# Press {{Hotkey|Q}} to quit.<br />
# Recompile the source:<pre>$ make</pre><br />
<br />
===The C Compiler is not able to compile a simple test program===<br />
<br />
When attempting to generate a solution for Xcode CMake fails with the following error<br />
-- Check for working C compiler using: Xcode -- broken<br />
CMake Error at /Applications/CMake 2.8-8.app/Contents/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):<br />
The C compiler "/usr/bin/gcc" is not able to compile a simple test program.<br />
<br />
It fails with the following output:<br />
<br />
Change Dir: /Users/danielmaloney/Documents/Unvanquished/build-xcode/CMakeFiles/CMakeTmp<br />
<br />
<br />
<br />
Run Build Command:/Applications/CMake\ 2.8-8.app/Contents/bin/cmakexbuild<br />
-project CMAKE_TRY_COMPILE.xcodeproj build -target<br />
cmTryCompileExec1400153232 -configuration Debug<br />
<br />
Error: No developer directory found at /Developer. Run<br />
/usr/bin/xcode-select to update the developer directory path.<br />
<br />
<br />
<br />
<br />
<br />
CMake will not be able to correctly generate this project.<br />
Call Stack (most recent call first):<br />
CMakeLists.txt:19 (project)<br />
<br />
This is due to Xcode 4.3 having a different directory structure to previous versions. Simply running the following command will correct this error:<br />
sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer/</div>Velociostrichhttps://wiki.unvanquished.net/index.php?title=Compiling_the_source&diff=1947Compiling the source2013-04-13T02:47:07Z<p>Velociostrich: /* Troubleshooting */ Add a link to the official docs on toolchain management</p>
<hr />
<div>==Mac OS X==<br />
<br />
First, you need to [[Getting_the_source|acquire the source code]].<br />
<br />
Regardless of what interface you may use to compile the source, you will need [http://www.cmake.org/cmake/resources/software.html CMake] to generate makefiles. You will also need to install [https://developer.apple.com/xcode/ Xcode] (making sure to choose to install the command-line utilities when prompted by the installer).<br />
<br />
Then, you will need to acquire (and in some cases, manually compile) at a minimum the [[#Dependencies|necessary libraries]].<br />
<br />
Once you have the source code and the libraries installed, you may actually proceed to compile the source. You have several options:<br />
* '''Compile the source at the command line'''. This is the easiest if you would just like to compile the game to use yourself and you do not intend to work on the code.<br />
* '''Compile the source using an IDE'''. This is preferred if you intend on developing the source.<br />
** Xcode is Apple's flagship IDE and you should have installed to compile the source regardless of which method you use.<br />
** [http://qt-project.org/downloads QtCreator] is cross-platform and provides real-time feedback of syntax errors, a Vim mode, as well as other features.<br />
** [http://www.codeblocks.org/ Code::Blcoks] is also cross-platform but lacks some of the features of Xcode and QtCreator.<br />
<br />
===Dependencies===<br />
<br />
You only need to use one of the following methods (HomeBrew or compiling by hand). Please try and avoid mixing methods as this may produce unexpected results.<br />
<br />
Unvanquished requires the following libraries:<br />
* [[#JPEG|JPEG]], version 8 or higher. (Version 6 was known to have problems)<br />
* [[#Simple_DirectMedia_Layer_.28SDL.29|Simple DirectMedia Layer]] (The binary provided by libsdl.org causes graphical corruptions. Compile from source or use homebrew/macports)<br />
* [[#The_OpenGL_Extension_Wrangler_Library_.28GLEW.29|The OpenGL Extension Wrangler Library]]<br />
* CuRL<br />
* [[#The_GNU_MP_Bignum_Library_.28libgmp.29|GMP]]<br />
* [[#WebP|WebP]] (v0.2.0 or newer)<br />
<br />
The following libraries are optional:<br />
* Theora<br />
* Speex<br />
* [[#Ogg|Ogg]]<br />
* [[#Vorbis|Vorbis]]<br />
<br />
====HomeBrew====<br />
Install [http://mxcl.github.com/homebrew/ HomeBrew] and then run the following command<br />
<br />
$ brew install nettle libjpeg curl sdl webp xvid gmp glew speex libvorbis theora<br />
<br />
All the necessary libraries should now have been installed.<br />
<br />
====Compiling by hand====<br />
The following are shell scripts that download, compile, and install various libraries. This is more time consuming then other methods but might be useful if you need more control over your libraries<br />
<br />
=====JPEG=====<br />
<br />
$ curl http://www.ijg.org/files/jpegsrc.v8d.tar.gz > jpegsrc.v8d.tar.gz<br />
$ tar xvzf jpegsrc.v8d.tar.gz<br />
$ cd jpeg-8d<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The OpenGL Extension Wrangler Library (GLEW)=====<br />
<br />
$ curl -L https://sourceforge.net/projects/glew/files/glew/1.7.0/glew-1.7.0.tgz/download > glew-1.7.0.tgz<br />
$ tar xvzf glew-1.7.0.tgz<br />
$ cd glew-1.7.0<br />
$ make<br />
$ sudo make install<br />
<br />
=====Simple DirectMedia Layer (SDL)=====<br />
<br />
Do not use the binaries provided by libsdl.org, as these are known to cause issues with gamma and color display. Instead, compile your own:<br />
<br />
$ curl http://www.libsdl.org/release/SDL-1.2.15.tar.gz > SDL-1.2.15.tar.gz<br />
$ tar xvzf SDL-1.2.15.tar.gz<br />
$ cd SDL-1.2.15<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====The GNU MP Bignum Library (libgmp)=====<br />
<br />
$ curl ftp://ftp.gmplib.org/pub/gmp-5.0.5/gmp-5.0.5.tar.bz2 > gmp-5.0.5.tar.bz2<br />
$ tar xvjf gmp-5.0.5.tar.bz2<br />
$ cd gmp-5.0.5<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Ogg=====<br />
<br />
$ curl http://downloads.xiph.org/releases/ogg/libogg-1.3.0.tar.gz > libogg-1.3.0.tar.gz<br />
$ tar xvzf libogg-1.3.0.tar.gz<br />
$ cd libogg-1.3.0<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====Vorbis=====<br />
<br />
$ curl http://downloads.xiph.org/releases/vorbis/libvorbis-1.3.3.tar.gz > libvorbis-1.3.3.tar.gz<br />
$ tar xvzf libvorbis-1.3.3.tar.gz<br />
$ cd libvorbis-1.3.3<br />
$ ./configure<br />
$ make<br />
$ sudo make install<br />
<br />
=====WebP=====<br />
<br />
You do not need to compile WebP by hand; Google provides binaries for Mac OS X available from their [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0-mac-10.5.tar.gz project page]. You will need version 0.2.0 or newer.<br />
<br />
Once downloaded, you must still install the header files and the binary:<br />
<br />
$ curl https://webp.googlecode.com/files/libwebp-0.2.0-mac-10.5.tar.gz > libwebp-0.2.0-mac-10.5.tar.gz<br />
$ tar xvzf libwebp-0.2.0-mac-10.5.tar.gz<br />
$ cd libwebp-0.2.0-mac-10.5<br />
$ sudo cp include/webp /usr/local/include<br />
$ sudo cp lib/libwebp.a /usr/local/lib<br />
<br />
===Configuring with CMake===<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 should be a different directory.<br />
# Hit "Configure". You will be prompted as to which generator you would like to use. If you have Xcode installed, choose that. Wait while the configuration process runs. You may have to set the following:<br />
## If CMake did not find your jpeg headers for some reason, set <code>JPEG_INCLUDE_DIR</code> to <code>/path/to/Unvanquished/src/libs/jpeg</code>.<br />
## Check <code>USE_INTERNAL_CRYPTO</code> to avoid having to compile nettle and hogweed.<br />
## Check <code>USE_INTERNAL_SPEEX</code> to avoid having to compile Speex.<br />
## Uncheck <code>USE_CIN_THEORA</code> and <code>USE_CIN_XVID</code> to avoid having to compile Theora or Xvid. (At present, there are not cutscenes or any such that require it.)<br />
## '''You will probably not be able to compile with the GLSL optimizer enabled; uncheck <code>USE_GLSL_OPTIMIZER</code>'''<br />
## If you have selected to generate Xcode project files, make the <code>SDLMAIN_LIBRARY</code> field blank. This option is not available if you have the generator set to Unix makefiles.<br />
# Hit "Generate".<br />
# You may now close Xcode.<br />
<br />
===Compiling===<br />
<br />
====With Xcode====<br />
<br />
<ol><br />
<li>Compilation will fail unless you manually create certain directories needed by the build scripts:<br />
<pre><br />
$ cd /path/to/build/dir/CMakeFiles<br />
$ mkdir gpp{game,trem,ui}-qvm.dir<br />
</pre><br />
This is a workaround to {{Issue|101}}.<br />
</li><br />
<li>Either start Xcode and open the project file (in the build directory you specified) or double-click the project file in Finder.</li><br />
<li>Open the project file created by CMake, which should be in the build directory you specified.</li><br />
<li>Change the active target to "ALL_BUILD" and click Product&rarr;Build.</li><br />
</ol><br />
<br />
====With Unix Makefiles====<br />
<br />
<ul><br />
<li>Start Terminal (Applications &rarr; Utilities &rarr; Terminal).</li><br />
<li>Input the following commands:<br />
<pre><br />
$ cd /path/to/Unvanquished-build<br />
$ make<br />
</pre><br />
If you are on a multi-core or multi-processor machine, you may speed up the process by passing the <code>-j</code> argument followed by the number of available cores to <code>make</code>; e.g., <code>make -j4</code>. Note that doing so makes reading error messages more difficult, as multiple instances of the compiler will print to the screen at once, causing information to appear out of order.<br />
</li><br />
</ul><br />
<br />
===Testing the build===<br />
<br />
====With Xcode 4====<br />
<br />
To test the game, select the "client" scheme from the combo box on the toolbar, and click the run button or press {{Hotkey|MacCommand}}{{Hotkey|R}}.<br />
<br />
====With Unix Makefiles====<br />
<br />
After compiling, you'll have to place the data files in the <code>main</code> directory in your build directory. [[#Acquiring the Game Files|For download instructions, see below.]]<br />
<br />
Your file structure should look as follows:<br />
<br />
[[File:Build_dir_Mac_OS_X.png]]<br />
<br />
You may now start the application as such:<br />
<br />
$ ./daemon.i386<br />
<br />
Note that older machines will not support the new OpenGL 3 renderer, and must be started specifying the "vanilla" (aka "GL") renderer:<br />
<br />
$ ./daemon.i386 +set cl_renderer GL<br />
<br />
===Bundling the Application===<br />
<br />
====With CPack====<br />
<br />
CPack is able to create standalone bundles (as well as many other types of installers). However you must generate the files using Unix Makefiles instead of Xcode.<br />
<br />
$ cd /path/to/Unvanquished-build<br />
$ cpack -G Bundle<br />
<br />
Some warnings will be printed however these can be safely ignored. There should be a file called Unvanquished.dmg in the Unvanquished-build folder.<br />
<br />
====Manually====<br />
<br />
You'll find the Mac [http://macdylibbundler.sourceforge.net/ dynamic library bundler] to be quite useful (you must generate the files using Unix Makefiles instead of Xcode):<br />
<br />
$ curl -L http://sourceforge.net/projects/macdylibbundler/files/macdylibbundler/0.4.1/dylibbundler0.4.1.zip/download > \<br />
dylibbundler0.4.1.zip<br />
$ unzip dylibbundler0.4.1.zip<br />
$ cd dylibbundler<br />
$ make<br />
$ sudo make install<br />
<br />
Once you've done that, you can proceed to create the application bundle. Note that these steps assume that you have downloaded the data files to <code>main/</code> as shown above:<br />
<br />
<pre><br />
$ git=/path/to/Unvanquished-git-repo<br />
$ build=/path/to/Unvanquished-build-dir<br />
$ mkdir -pv Unvanquished.app/Contents/{libs,MacOS,Resources,Frameworks}<br />
$ cp -r $build/main Unvanquished.app/Contents/MacOS<br />
$ sips -s format tiff $git/debian/unvanquished.png --out temp.tiff<br />
$ tiff2icns temp.tiff Unvanquished.app/Contents/Resources/Unvanquished.icns<br />
$ rm temp.tiff<br />
$ cp $build/daemon{,ded}.i386 $build/*.dylib Unvanquished.app/Contents/MacOS<br />
$ cp -r /Library/Frameworks/SDL.framework Unvanquished.app/Contents/Frameworks<br />
$ install_name_tool -id \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/Frameworks/SDL.framework/Versions/A/SDL<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGLi386.dylib<br />
$ install_name_tool -change @rpath/SDL.framework/Versions/A/SDL \<br />
@executable_path/../Frameworks/SDL.framework/Versions/A/SDL \<br />
Unvanquished.app/Contents/MacOS/librendererGL3i386.dylib<br />
$ for binary in Unvanquished.app/Contents/MacOS/*.{i386,dylib}; do<br />
dylibbundler -b -x $binary -d $dest/Unvanquished.app/Contents/libs/; done<br />
$ cp /usr/lib/libGLEW.1.7.0.dylib ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ chmod +w ./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -id @executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/libs/libGLEW.1.7.0.dylib<br />
$ install_name_tool -change /usr/lib/libGLEW.1.7.0.dylib \<br />
@executable_path/../libs/libGLEW.1.7.0.dylib \<br />
./Unvanquished.app/Contents/MacOS/daemon.i386<br />
$ cat > Unvanquished.app/Contents/Info.plist<br />
<?xml version="1.0" encoding="UTF-8"?><br />
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN"<br />
"http://www.apple.com/DTDs/PropertyList-1.0.dtd"><br />
<plist version="1.0"><br />
<dict><br />
<key>CFBundleName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleDisplayName</key><br />
<string>Unvanquished</string><br />
<key>CFBundleExecutable</key><br />
<string>daemon.i386</string><br />
<key>CFBundleIconFile</key><br />
<string>Unvanquished.icns</string><br />
<key>CFBundleIdentifier</key><br />
<string>net.Unvanquished</string><br />
<key>CFBundleInfoDictionaryVersion</key><br />
<string>6.0</string><br />
<key>CFBundlePackageType</key><br />
<string>APPL</string><br />
<key>CFBundleShortVersionString</key><br />
<string>0.4.0</string><br />
<key>CFBundleVersion</key><br />
<string>0.4.0</string><br />
</dict><br />
</plist><br />
^d<br />
</pre><br />
<br />
Note: <code>^d</code> indicates pressing {{Hotkey|Ctrl}}{{Hotkey|D}} on the keyboard.<br />
<br />
The contents of the completed application bundle should look like this:<br />
<br />
[[File:Bundle_dir_Mac_OS_X.png]]<br />
<br />
'''Note''': If you compiled SDL from source, you will not see a directory titled <code>SDL.framework</code>.<br />
<br />
==Windows==<br />
<br />
===Visual Studio===<br />
<br />
CMake can generate Visual Studio projects for unvanquished however this feature is relatively new and may have some bugs.<br />
<br />
Steps:<br />
<br />
# Double click on Visual_Studio32.bat<br />
# Open build-32/Daemon.sln in Visual Studio 2010.<br />
# In the two text boxes in the toolbar, select "Release" or "Debug" in the first one and Win32 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 />
====Important Notes====<br />
<br />
* LLVM is disabled and does not work correctly with CMake generated Visual Studio projects.<br />
* ncurses is not supported under Visual Studio.<br />
* The path to the build folder must not have any spaces otherwise generation of QVMs will fail. See [https://github.com/Unvanquished/Unvanquished/issues/102 issue 102]<br />
* Due to limitations with cmake neither the startup project nor the working directory can be specified. These must be manually set to the following values for debugging the client under Visual Studio<br />
** Right click on client and select "Set as StartUp project".<br />
** Right click on client, select properties, select Debugging and set "Working Directory" to $(TargetPath)\..<br />
<br />
===MinGW===<br />
<br />
Unvanquished is supported under MinGW. The build process should be fairly similar to the Linux instructions.<br />
<br />
The easiest way to acquire and install MinGW is with the graphical [http://sourceforge.net/projects/mingw/files/Installer/mingw-get-inst/ mingw-get-inst installer]. <!-- TODO: maybe walk the user through the installer? --><br />
<br />
When configuring the build with CMake, you will find that you will have to set a number of libraries manually. You can find precompiled DLLs for most of the dependencies; those that are not pre-compiled can be built with the corresponding <code>USE_INTERNAL_</code> setting.<br />
<br />
On Windows, SDL requires that the Direct X SDK can be installed. You may download the June 2010 release from [http://www.microsoft.com/en-us/download/details.aspx?id=6812 Microsoft's site].<br />
<br />
The easiest way to get a build up (at the time of writing) is as follows: <!-- FIXME: incomplete --><br />
<br />
{{Note|content=Be aware that some of these paths are for the 64 bit versions of libraries; if you are on a 32-bit system, you will need to change some of these paths. The easiest way to locate libraries is to navigate in Windows Explorer to the <code>src/libs</code> directory and search for files matching <code>dll</code>.}}<br />
<br />
<ol><br />
<!-- might not be necessary<br />
<li>Download and extract the latest version of the [http://gmplib.org/ GNU MP Bignum Library (GMP)]. (You will need either cygwin with tar and bz2 installed or 7-zip to extract the archive.)</li><br />
<li>Theoretically, you can compile GMP with either the MSYS shell (from MinGW) or Cygwin, but you may experience issues with the former. Regardless of which you use, the steps to compile are the same:<br />
<pre><br />
$ ./configure --disable-static --enable-shared<br />
$ make<br />
</pre><br />
The <code>--disable-static</code> and <code>--enable-shared</code> flags configure GMP to build a DLL instead of a static library. You may optionally perform <code>make install</code>. Additional compilation instructions [http://www.cs.nyu.edu/exact/core/gmp/ are available].<br />
</li><br />
--><br />
<li>Set the following CMake flags:<br />
{| class="wikitable"<br />
! Setting<br />
! Description<br />
! Type<br />
! Value<br />
|-<br />
| <code>USE_INTERNAL_CRYPTO</code><br />
| Use the provided copies of crypto libraries. <!-- FIXME: I think these are nettle and something else --><br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_GLEW</code><br />
| Use the provided copy of GLEW.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_JPEG</code><br />
| Use the provided copy of JPEG.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SDL</code><br />
| Use the provided copy of SDL.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_SPEEX</code><br />
| Use the provided copy of Speex.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_INTERNAL_WEBP</code><br />
| Use the provided copy of WebP.<br />
| <code>BOOL</code><br />
| <code>true</code><br />
|-<br />
| <code>USE_CURSES</code><br />
| Enables/disables curses.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>PNG_LIBRARY</code><br />
| Path to the PNG library DLL.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng/libs/win64/libpng.lib</code><br />
|-<br />
| <code>PNG_PNG_INCLUDE_DIR</code><br />
| Path to the PNG library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/libpng</code><br />
|-<br />
| <code>FREETYPE_LIBRARY</code><br />
| Path to the compiled FreeType library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/lib/x64/freetype.lib</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_freetype2</code><br />
| Path to the FreeType library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/freetype2</code><br />
|-<br />
| <code>FREETYPE_INCLUDE_DIR_ft2build</code><br />
| Path to the FreeType library file "ftbuild.h".<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/freetype/include/</code><br />
|-<br />
| <code>GMP_INCLUDE_DIR</code><br />
| Path to the GMP library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/gmp/include</code><br />
|-<br />
| <code>GMP_LIBRARY</code><br />
| Path to the GMP library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var></code><br />
|-<br />
| <code>ZLIB_INCLUDE_DIR</code><br />
| Path to the zlib library header files.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/include</code><br />
|-<br />
| <code>ZLIB_LIBRARY</code><br />
| Path to the zlib library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/zlibwapi/lib/x64/zlibstat.lib</code><br />
|-<br />
| <code>CURL_LIBRARY</code><br />
| Path to the CURL library.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/lib/win64/release/libcurl.dll</code><br />
|-<br />
| <code>CURL_INCLUDE_DIR</code><br />
| Path to the zlib library.<br />
| <code>PATH</code><br />
| <code><var>SourcePath</var>/src/libs/curl-7.21.6/include/curl</code><br />
|-<br />
| <code>USE_OPENAL</code><br />
| Enables/disables OpenAL support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_THEORA</code><br />
| Enables/disables Theora support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CIN_XVID</code><br />
| Enables/disables Xvid support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>USE_CODEC_THEORA</code><br />
| Enables/disables Ogg support.<br />
| <code>BOOL</code><br />
| <code>false</code><br />
|-<br />
| <code>SDLMAIN_LIBRARY</code><br />
| Enables/disables Ogg support.<br />
| <code>FILEPATH</code><br />
| <code><var>SourcePath</var>/src/libs/libsdl/src/main/win32/SDL_win32_main.c</code><br />
|-<br />
|}<br />
Do note that CMake is slash-direction&ndash;agnostic; it can handle both forward- and backslashes on Windows.<br />
</li><br />
<li>Open a terminal and <code>cd</code> to your source directory.</li><br />
<li>Run <code>make</code>:<br />
<pre><br />
> mingw32-make<br />
</pre><br />
If you would like verbose output, set the <code>VERBOSE</code> environment variable before running <code>make</code>.<br />
<pre><br />
> set VERBOSE=1<br />
</pre><br />
</li><br />
</ol><br />
<br />
====Notes====<br />
<br />
* If you would like to use curses, try using [http://sourceforge.net/projects/pdcurses/files/pdcurses PDCurses].<br />
<br />
===QtCreator===<br />
<br />
# Install MinGW and follow the above instructions, except select Code::Blocks as the generator.<br />
# Start QtCreator, and select "Open File or Project&hellip;" from the File menu.<br />
# Navigate to your source directory and open CMakeLists.txt.<br />
# At the CMake Wizard, select the same build directory you already configured using CMake. (If you did not chose Code::Blocks as the generator, you will have to start over again, as QtCreator requires a Code::Blocks project file in order to compile the source.)<br />
# Ensure that a generator is selected in the combo box, and click "Run CMake". If there is no generator listed, see the [[#Troubleshooting|troubleshooting]] section below.<br />
# Click "Finish" to close the wizard.<br />
<br />
You should now be able to compile, run, and debug the code using QtCreator.<br />
<br />
====Troubleshooting====<br />
<br />
If at the "Run CMake" prompt of the the CMake Wizard, select "Run CMake" and are warned that no generator was selected, and notice that there are no generators in the combo box, you will likely have to [http://doc.qt.digia.com/qtcreator-2.4/creator-tool-chains.html manually configure your toolchain]. Select "Options&hellip;" from the "Tools" menu, then navigate to "Build &amp; Run".<br />
<br />
At the options window,<br />
* Go to the "Kits" tab, and mouse over the "Desktop (default)" kit under "Manual". If there were any errors in configuring this kit, they will be displayed in the tool tip. If there are problems, select the kit. You may need to manually specify the location of the MinGW debugger, for example, which is typically <code>C:\MinGW\bin\gdb.exe</code>.<br />
* Go to the "Compilers" tab, and ensure that MinGW is present. If not, you will need to add it manually.<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 />
libgmp3-dev libjpeg8-dev libncurses5-dev libogg-dev libopenal-dev \<br />
libpng12-dev libsdl1.2-dev libvorbis-dev zlib1g-dev nettle-dev \<br />
libwebp-dev libspeexdsp-dev libtheora-dev<br />
<br />
If the version of WebP supplied by your version of Debian or Ubuntu is older than v0.2.0, you will need to [https://code.google.com/p/webp/downloads/detail?name=libwebp-0.2.0.tar.gz download] and [https://developers.google.com/speed/webp/docs/compiling#unix compile it from source]. After compiling and installing with <code>sudo make install</code>, in CMake, you'll need to set <code>WEBP_INCLUDE_DIR</code> to <code>/usr/local/include/webp</code> and <code>WEBP_LIBRARY</code> to <code>/usr/local/lib/libwebp.so</code>.<br />
<br />
'''We currently provide a ready-to-use libwebp-dev in our [http://{{SERVERNAME}}/index.php/Download#ubuntu Debian and Ubuntu repositories], alongside .debs of the game and server.'''<br />
<br />
Actual dev package names may vary, e.g. libgmp-dev instead of libgmp3-dev and libglew-dev or libglew1.7-dev instead of libglew1.5-dev.<br />
<br />
Since we have a debian directory in the source, you can also to check what's needed then install the listed packages (choosing from alternatives as needed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ dpkg-checkbuilddeps<br />
…<br />
$ sudo apt-get install <var>package(s)</var><br />
<br />
If dpkg-checkbuilddeps produces no output, you have all necessary build dependencies. Also, debhelper's only needed if you're building .debs.<br />
<br />
====Gentoo====<br />
<br />
$ emerge curl freetype glew gmp jpeg ncurses libogg openal libpng libsdl libvorbis zlib<br />
<br />
====openSUSE====<br />
<br />
$ sudo install zypper gcc gcc-c++ Mesa-libGL-devel SDL-devel libjpeg8-devel \<br />
libpng12-devel glew-devel webp-devel ncurses-devel gmp-devel libcurl-devel \<br />
libnettle-devel openal-soft-devel speex-devel libvorbis-devel \<br />
libtheora-devel<br />
<br />
The latest version of WebP must be installed manually:<br />
<br />
$ wget https://webp.googlecode.com/files/libwebp-0.2.1.tar.gz<br />
$ tar xvzf libwebp-0.2.1.tar.gz<br />
$ cd libwebp-0.2.1<br />
$ ./configure && make<br />
$ sudo make install<br />
<br />
You must disable curses (set <code>USE_CURSES</code> appropriately in CMake) as failing to do so will cause Unvanquished to crash on startup.<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 />
On Debian or 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 />
Or, in Debian or Ubuntu, you can build a package (but you'll need to have devscripts and fakeroot installed):<br />
<br />
$ cd <var>/path/to/unvanquished</var><br />
$ fakeroot dpkg-buildpackage -b -uc<br />
$ sudo dpkg -i <var>../unvanquished_*.deb</var><br />
<br />
Once in <code>ccmake</code>, use the following keys:<br />
<br />
* Press {{Hotkey|c}} to configure. If an error occurs during this phase, make note of it and press {{Hotkey|e}} to dismiss it.<br />
* Use the up and down arrow keys to navigate the compilation options.<br />
* Press {{Hotkey|Enter}} to enable or disable boolean options (i.e., on/off) or to edit textual options.<br />
** Press {{Hotkey|Esc}} when editing a textual option to cancel the change.<br />
<br />
Once you have finished the configuration process, press {{Hotkey|C}} again, then {{Hotkey|G}} 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=====<br />
<br />
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_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 />
* <code>USE_CIN_THEORA</code> &mdash; Disabling this prevents videos from being recorded in Theora.<br />
* <code>USE_CIN_XVID</code> &mdash; Disabling this prevents videos from being recorded in Xvid.<br />
* <code>USE_VOIP</code> &mdash; Disabling this removes VOIP support. Alternatively enabling <code>USE_INTERNAL_SPEEX</code> will use the libraries distributed with Unvanquished for VoIP<br />
* <code>USE_INTERNAL_CRYPTO</code> &mdash; Enable this to use the crypto libraries provided by Unvanquished.<br />
<br />
===Compiling===<br />
<br />
$ cd <var>path/to/unvanquished/build</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 />
===Acquiring mandatory game files===<br />
<br />
The game files are not in the Git repository, and must be downloaded separately. This may be done on the command line or from your web browser. The downloads may be found on [http://sourceforge.net/projects/unvanquished/files/Assets SourceForge.net]. If you download the files from your browser, just download the files named "pak*.pk3", and save them to the [[Running_the_game#Data_locations|data location]] for your system.<br />
<br />
On Linux, this may be done as follows:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
wget -O $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On FreeBSD, using the <code>sh</code> shell:<br />
<br />
$ cd <var>[path to Unvanquished installation or build]</var>/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
fetch -r -o $file "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download"<br />
fi<br />
done<br />
<br />
On Mac OS X:<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ for file in {{CurrentVersion|PakFiles}}; do<br />
if [ ! -e $file ]; then<br />
curl -L "http://sourceforge.net/projects/unvanquished/files/Assets/$file/download" > $file<br />
fi<br />
done<br />
<br />
Linux users may also use the <code>download-pk3.sh</code> script that is distributed with the source code, which requires that curl be installed:<br />
<br />
$ cd <var>[path to Unvanquished source code]</var><br />
$ mkdir -p ~/.Unvanquished/main<br />
$ ./download-pk3.sh ~/.Unvanquished/main<br />
<br />
===Downloading the map pack===<br />
<br />
The map pack exists only for convenience; if you do not download the map pack, Unvanquished will automatically download maps as needed when you attempt to play online.<br />
<br />
To download the map pack on Linux:<br />
<br />
$ wget -O maps.7z "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z"; done<br />
<br />
To download the map pack on Mac OS X:<br />
<br />
$ curl -L "http://sourceforge.net/projects/unvanquished/files/Map%20Pack/maps.7z" > maps.7z; done<br />
<br />
Note that you will need to unzip the map pack on either system as it is compressed with LZMA. Mac users can use the [http://wakaba.c3.cx/s/apps/unarchiver.html Unarchiver]. Uncompressing the archive on Linux is highly dependent on your distribution.<br />
<br />
===Verifying the Files===<br />
<br />
Download the latest [http://sourceforge.net/projects/unvanquished/files/Assets/{{CurrentVersion|MD5HashFile}} MD5 hash file] and save it to your system's [[Running_the_game#Data_directory|data location]].<br />
<br />
On systems with the <code>md5</code> command (Mac OS X):<br />
<br />
$ cd ~/Library/Application\ Support/Unvanquished/main<br />
$ cat {{CurrentVersion|MD5HashFile}} | while read line; do<br />
file="`echo "$line" | sed -E "s/^[a-fA-F0-9]+ +\*?//"`"<br />
if [ -e "$file" ]; then<br />
if [ `md5 -r "$file" | cut -d\ -f1` = "`echo "$line" | cut -d\ -f1`" ]<br />
then echo "File \"$file\" appears okay."<br />
else echo "File \"$file\" is corrupt"'!' >&2<br />
fi; fi; done<br />
<br />
On systems with the <code>md5sum</code> command (most Linux distributions):<br />
<br />
$ cd <var>[[Running_the_game#Data_directory|/path/to/data/files]]</var><br />
$ md5sum -c {{CurrentVersion|MD5HashFile}} 2>&1 | grep -v "open or read\|file or directory"<br />
<br />
The <code>grep</code> invocation is used to strip output complaining about missing files.<br />
<br />
Any files that are found to be corrupt should be replaced; just download a [http://sourceforge.net/projects/unvanquished/files/Assets new copy] of the affected file(s).<br />
<br />
==Errors==<br />
<br />
===CMake cannot locate Newton===<br />
<br />
If CMake cannot find Newton, you'll need to set it up yourself.<br />
<br />
It should be in <code><var>/path/to/Unvanquished</var>/src/libs/libnewton/libs/<var>your_os</var>/libNewton.so</code>.<br />
Be sure to replace <var>your_os</var> with the proper directory name.<br />
<br />
Use CMake as before to change the <code>NEWTON_LIBRARY</code> build setting to the said path:<br />
<br />
# Start the CMake configurator:<pre>$ ccmake ..</pre><br />
# Scroll down and highlight <code>NEWTON_LIBRARY</code>.<br />
# Press {{Hotkey|Enter}} to begin editing and input in the path.<br />
# Press {{Hotkey|C}} to configure and {{Hotkey|G}} to generate the new makefiles.<br />
# Press {{Hotkey|Q}} to quit.<br />
# Recompile the source:<pre>$ make</pre><br />
<br />
===The C Compiler is not able to compile a simple test program===<br />
<br />
When attempting to generate a solution for Xcode CMake fails with the following error<br />
-- Check for working C compiler using: Xcode -- broken<br />
CMake Error at /Applications/CMake 2.8-8.app/Contents/share/cmake-2.8/Modules/CMakeTestCCompiler.cmake:52 (MESSAGE):<br />
The C compiler "/usr/bin/gcc" is not able to compile a simple test program.<br />
<br />
It fails with the following output:<br />
<br />
Change Dir: /Users/danielmaloney/Documents/Unvanquished/build-xcode/CMakeFiles/CMakeTmp<br />
<br />
<br />
<br />
Run Build Command:/Applications/CMake\ 2.8-8.app/Contents/bin/cmakexbuild<br />
-project CMAKE_TRY_COMPILE.xcodeproj build -target<br />
cmTryCompileExec1400153232 -configuration Debug<br />
<br />
Error: No developer directory found at /Developer. Run<br />
/usr/bin/xcode-select to update the developer directory path.<br />
<br />
<br />
<br />
<br />
<br />
CMake will not be able to correctly generate this project.<br />
Call Stack (most recent call first):<br />
CMakeLists.txt:19 (project)<br />
<br />
This is due to Xcode 4.3 having a different directory structure to previous versions. Simply running the following command will correct this error:<br />
sudo /usr/bin/xcode-select -switch /Applications/Xcode.app/Contents/Developer/</div>Velociostrich