temp windows gui - Cockatrice/Cockatrice GitHub Wiki

NOTE ABOUT THIS PAGE

This page contains some updated instructions for compiling on windows; if someone with experience compiling on windows could merge this into https://github.com/Cockatrice/Cockatrice/wiki/Compiling-Cockatrice-(Windows) it would be very much appreciated.

Related ticket: https://github.com/Cockatrice/Cockatrice/issues/2147

On Windows

02/28/2015

The windows compiling instructions have been tested successfully using a Windows 7 SP1 OR Windows 10 computer. Visual Studio versions 2010 Express, 2013 (Desktop Edition) and 2015 community editions were all tested. When using a Visual Studio version other than 2015 you will need to substitute the correct version number in place of apps/commands that contain 2015 in the instructions listed below. Also, Qt only supports Visual Studio 2015 starting at version 5.6 and only supports Visual Studio 2010 up till version 5.5. If using Visual Studio 2010 you will need to install Qt version 5.5 and substitute the correct version number in place of apps/commands that contain 5.6 in the instructions below.

Required Software

  1. Visual Studio

    2015 Community edition is recommended. When installing, you need to select "Custom" under the type of installation. On the next screen, expand the "Programming Languages" section at the top of the features list, and then check "Visual C++". It is NOT checked by default, and is required to build Cockatrice.

  2. Qt libraries

    You only need to install Qt->Qt5.6->msvc2015 32-bit

  3. CMake

    Choose to add CMake to the System path for all users.

  4. GitHub for Windows

  5. Nullsoft Scriptable Install System

  6. GnuWin zLib

    There's an known bug in the gnuwin32's zlib package.(http://sourceforge.net/p/gnuwin32/bugs/169/)To resolve edit c:\program files (x86)\GnuWin32\include\zconf.h with admin rights.At line #287 and change #if 1 to #ifdef HAVE_UNISTD_H

  7. OpenSSL for Windows

    Win32 Open-SSL (NOT Light version)

  8. MySQL Database Server (install x86 NOT x64)

    As of this writing version 5.7 of the server has been tested. Select the "Developer" install during the installation. You do not need to have the MySQL server running to compile Cockatrice, you may uncheck that option during the installation.

  9. Powershell Version 4.0

    If you have Windows 7, 8, 2008R2 or 2012 you need to sownload this. If you have Windows 8.1, 10, or 2012R2 then Powershell version 4.0 is built in


Compiling Protobuf

As protobuf does neither provide an installer nor the libraries needed for Cockatrice, you have to build those with Visual Studio from the protobuf sources.

  1. Open the GitHub Shell (Start → All Programs → GitHub, Inc → Git Shell )
  2. Execute the following commands from inside the shell window:
git clone -b v2.6.1 https://github.com/google/protobuf c:\protobuf
  1. Open Visual Studio and open the protobuf.sln project located under C:\protobuf\vsprojects

    Upon first opening the solution file you will be prompted to perform a one way conversion. Click ok to begin the conversion and once completed you can close the migration report open in a web browser.

  2. View the code to the libprotobuf->Header Files->hash.h file and add the following line to the top of the file.

    #define _SILENCE_STDEXT_HASH_DEPRECATION_WARNINGS 1

  3. Choose "Release" in the Solutions Configurations drop down along the top toolbar.

  4. Right click and choose build for the following projects in the solutions explorer along the right.

    libprotobuf, libprotobuf-lite, libprotoc, protoc

If all goes well each should compile successfully. You can now close Visual Studio and the Github Shell.


Compiling Cockatrice

  1. Open the GitHub Shell (Start → All Programs → GitHub, Inc → Git Shell )
  2. Execute the following commands from inside the shell window:
git clone https://github.com/Cockatrice/Cockatrice c:\Cockatrice
mkdir c:\Cockatrice\build
cd c:\Cockatrice\build
cmake -DWITH_SERVER=1 -DCMAKE_PREFIX_PATH="C:\Qt\5.6\msvc2015\lib\cmake;C:\protobuf\src;C:\protobuf\vsprojects\Release" ..
  1. Open Visual Studio and open the Cockatrice.sln project located under C:\Cockatrice\build

  2. Choose "Release" in the Solutions Configurations drop down along the top toolbar.

  3. Right click and choose build for the following projects in the solutions explorer along the right.

    PACKAGE

If all goes well each should compile successfully. Once completed there will be an executable installer file located under the C:\Cockatrice\build directory. You can now close Visual Studio and the Github Shell.

Alternately, after step 2 you can open the "MSBuild command prompt for VS2015" and execute the following command to build the application from the command line: msbuild C:\Cockatrice\build\PACKAGE.vcxproj /p:Configuration=Release


Connecting and Configuring MySQL (for use with servatrice)

First you will need to copy the mysql libraries that are included with the installer into the windows directory. Copy the file libmysql.dll from the {MySQL-Install-Diretory}\lib directory to C:\Windows directory.

Default install path for MySQL [ %ProgramFiles(x86)%\MySQL\MySQL Server 5.7\ ]

Next set the sql mode. Edit the my.ini file and remove the "STRICT_TRANS_TABLES" text from the sql-mode line.

my.ini file can be found in [ %PROGRAMDATA%\MySQL\MySQL Server 5.7\ ] 
The line should look like this: sql-mode="NO_AUTO_CREATE_USER,NO_ENGINE_SUBSTITUTION"

After the change is made, restart your PC.

Finally, edit your servatrice.ini and setup the [database] section accordingly.

Note: If you do not want to pass the "--config" option through command line to start servatrice, the servatrice.ini configuration file will need to be placed in the %LOCALAPPDATA%\Cockatrice\Servatrice\ folder.