Daenyth/Cockatrice — pull request #61 by VanNostrand (2014-03-11 17:02:52+00:00)
Title: Windows compile fixes

Short version: It is possible to compile cockatrice with Visual Studio 2010 instead of MinGW.
This pull request includes everything from source code fixes, CMake changes to an updated NSIS installer.
The usermanual still has to be updated. I will do this as soon as pull request #53 has been merged.

Here is a preliminary version of the compile howto, unformatted and raw, if you are eager to test this on your machines:
```
Tested on Windows 7 Professional SP1 with all updates (2014-03-11).

Before you start: Update your Windows.

Then the following programs (all are freely available) need to be installed:
- Windows SDK with Update
- Visual C++ 2010 Express with SP1
- Qt libraries 4.8.x for Windows (VS 2010)
- cmake
- git
- NSIS installer v3
If not mentioned otherwise, default options are used when asked by the compiler.

Install Microsoft Windows SDK for Windows 7 and .NET Framework 4 (http://www.microsoft.com/en-us/download/details.aspx?id=8279)
Download and apply the Visual C++ 2010 SP 1 Compiler Update for Windows SDK 7.1 (VC-Compiler-KB2519277) from http://www.microsoft.com/en-us/download/details.aspx?displaylang=en&id=4422

Install Visual C++ 2010 Express (http://go.microsoft.com/?linkid=9709949)
Start the web installer, you may disable Silverlight

Download and install Microsoft Visual Studio 2010 Service Pack 1 (VS10sp1-KB983509) from http://www.microsoft.com/de-de/download/details.aspx?id=23691

Install Qt4 VS 2010 edition.

Install cmake. Download and start the Win32 Installer from http://cmake.org/cmake/resources/software.html. Choose to add CMake to the System path.

Install git. Download and start the installer from www.git-scm.com/downloads.
Choose Run Git from Windows Command Prompt

Building Cockatrice

1. Downloading the sources
Right Click into a Folder, select Git Gui, then Clone Existing Directory,
enter Source Location https://github.com/Daenyth/Cockatrice
enter target directory (from now on called Cockatrice), klick clone and wait until the sources have been downloaded.
Then close Git Gui.
Create a build directory inside the Cockatrice directory.
Copy the protobuf-2.5.0.zip into the build directory. Rightclick the zip, choose Extract all.
To be clear: you will have a Cockatrice/build/protobuf-2.5.0/protobuf-2.5.0 directory hierarchy after that.

2. Building the dependencies
Start Visual C++ 2010 Express and from the File menu Open Project/Solution, move to the Cockatrice/build/protobuf-2.5.0/protobuf-2.5.0/vsprojects directory and choose protobuf.sln.
Let you guide through the Conversion Wizard, you don't need to create a backup.
After the conversion is finished, open the projects (uncheck Ask me for every project in this solution and click OK).
You may look at the conversion report if something failed, which should not happen.

Rightclick on libprotobuf in the Solution Explorer on the left, choose Properties. Click on Configuration Manager and change libprotobuf, libprotoc and protoc Configuration to Release. Accept and close the dialogs to get back to the main window.
Rightclick on libprotobuf again, choose Build this time. Note that the output should say: Build started: Project libprotobuf, Configuration: Release Win32
Then rightclick on protoc, choose Build.
After the build succeeded, you will find a Release directory in the vsprojects directory which contains our freshly built library.
Close Visual C++

3. Compiling Cockatrice.
Start CMake GUI, locate the Cockatrice directory and locate the Cockatrice/build directory. Then click Configure. Choose Visual Studio 10.
An error will occur during the Configure process because CMake does not know the location of the protobuf library.
So CMake will show some variables in red and you need to change two of them:
Set CMAKE_CONFIGURATION_TYPES to Release
Check Advanced, enter protobuf in the Search field
Set PROTOBUF_INCLUDE_DIR to Cockatrice/build/protobuf-2.5.0/protobuf-2.5.0/src/
Set PROTOBUF_LIBRARY to Cockatrice/build/protobuf-2.5.0/protobuf-2.5.0/vsprojects/Release/libprotobuf.lib
Set PROTOBUF_PROTOC_EXECUTABLE to Cockatrice/build/protobuf-2.5.0/protobuf-2.5.0/vsprojects/Release/protoc.exe
Set PROTOBUF_PROTOC_LIBRARY to Cockatrice/build/protobuf-2.5.0/protobuf-2.5.0/vsprojects/Release/libprotoc.lib
Click Configure again, then Generate.
Close CMake GUI.

Start Visual C++ 2010 Express and from the File menu Open Project/Solution, point to the Cockatrice/build directory and choose Project.sln.
Rightclick on ALL_BUILD, choose Build.

Creating the installer
Install NSIS, rightclick on nsis/cockatrice.nsi and create the installable package.
The enduser probably needs vcruntime2010 aka Microsoft Visual C++ 2010 Redistributable Package if not already installed.
```