new MSVC Compile guide

Website issues & feedback. Constructive criticism is welcome.
(Guest posting is allowed under certain circumstances)
If you have a problem with certain individuals, then PM the Staff account.
User avatar
Ezio
Trained
Trained
Posts: 306
Joined: 24 Apr 2010, 16:42

new MSVC Compile guide

Post by Ezio »

This should help most update in MSVC compile guide, i made this since i don't want more people ended up compiling old version of game (one from SVN). i was one of them thought :annoyed:

not sure about Flex/bison but i've done editing git and qt
= Windows Compile Guide (MSVC) =

[[TOC]]

NOTE: We are using git as main repository and SVN for historical purposes, but that WON'T get any updates.

NOTE:

This will guide you through the steps necessary to compile Warzone on Windows using Microsoft Visual C++. Alternatively, there is a guide dedicated to compiling with MinGW, the [wiki:CompileGuideWindows/MinGW Windows Compile Guide (MinGW)].

== Prerequesites ==

* Current version of [http://code.google.com/p/gitextensions/ Git Extensions]
* GnuWin packages: [http://gnuwin32.sourceforge.net/packages/flex.htm Flex] (version [http://sourceforge.net/projects/gnuwin3 ... e/download 2.5.4a-1] will do the job), [http://gnuwin32.sourceforge.net/packages/bison.htm Bison] (version [http://sourceforge.net/projects/gnuwin3 ... e/download 2.1] is required at least).
* Latest Warzone Developer's Package [http://developer.wz2100.net/ticket/2643 devpkg] *1
* [http://www.microsoft.com/express/vc/ Microsoft Visual C++ Express Edition] (current devpkg and build system are tuned to MSVC 2010, 2.3 below still use 2005 and 2008 [http://sourceforge.net/projects/warzone ... z/download devpkg], 2.3 with 2010 [http://developer.wz2100.net/ticket/2783 devpkg])
* [http://qt.nokia.com/downloads Qt libraries for Windows (VS)] *1
* [http://qt.nokia.com/downloads/visual-studio-add-in Qt Visual Studio Add-in]

== Downloading the sourcecode ==

* Create a directory where you want to store the Warzone sourcecode. You will need the path to the sourcecode, so remember it's location!
* Right-click on it and choose “Git Extensions - Clone”
* Set "Repository to clone” to git:\\github.com\Warzone2100\warzone2100.git, Destination to directory you've create earlier, and Branch set to master *1. leave everything else as is and click Clone.
* Git Extensions will now checkout the current sourcecode from our git repository. This may take a while, especially on slow internet connections.

== Preparing ==

1. Extract the Developer's Package into the directory where you have the Warzone 2100 sourcecode, right where the src\, data\, win32\ and other directories are. Note: You will find a "devpkg" folder in the package, this will be a new folder in the root directory of the Warzone 2100 sourcecode folder. "Data" folder should be merged with the same folder in Warzone 2100 root directory.
1. Open the Solution “Warzone2100.sln” in win32\ folder.
1. Your environment PATH variable should include the “<path to GnuWin32>\bin” directory. This should be where your bison.exe, flex.exe and gettext files were installed.
1. Add new environment variable name Qtdir with value "<path to Qt>\<version>" directory. This should be where include folder, lib folder were installed"

== Updating the %PATH% ==

In order for Flex/Bison to work fine, you will need to add some directories %PATH% environment variable. In Windows 2000 and later you do this by right clicking "My Computer" then select "Properties" -> "Advanced" -> "Environment variables". Now in the sub-box called "System variables" you should select "PATH" (or "Path"), click "Edit" (or "Modify" ?) and at the end of that line add ";C:\Program Files\GnuWin32\bin" (assuming you installed Bison/Flex in "C:\Program Files\GnuWin32"). The final path will then look like this (note the absence of the "double quotes"):

{{{
C:\WINDOWS\system32;C:\Windows;C:\Program Files\GnuWin32\bin
}}}

== Adding %Qtdir% ==

In order for Qt to work fine, you will need to add new environment variable. In Windows 2000 and later you do this by right clicking "My Computer" then select "Properties" -> "Advanced" -> "Environment variables". Now in the sub-box called "System variables" you should click "New" add variable name "Qtdir" and variable value "C:\Qt\4.7.3" (assuming you installed Qt in "C:\"). The final path will then look like this (note the absence of the "double quotes"):

{{{
Qtdir C:\Qt\4.7.3
}}}

== Compile ==

Choose “Build / Solution” from the menu.

== Troubleshooting ==

* Some people report that the following could help if bison generates errors: Under Build -> Batch build... -> Mark all -> Build.
* If you encounter an error about some missing lib try checking for newer devpkg.
* Feel free to ask for help on our forum.

== Final steps ==

Take a look at the [wiki:Coding Coding ] section.