BuildingOnWindows.wiki
author alfadur
Thu, 22 Aug 2019 00:17:48 +0200
changeset 1955 637685e52477
parent 1895 93f8269fca27
child 1956 625477ff2786
permissions -rw-r--r--
Update Windows building guide

#summary Instructions for building Hedgewars on Windows
#labels Phase-Implementation,Phase-Design,Phase-Support

= Building on Windows =

== Things to download ==
First of all, figure out whether your system is a 32-bit or a 64-bit system. You can use the guide at [http://windows.microsoft.com/en-US/windows7/find-out-32-or-64-bit]. You will only be able to make a 64-bit build on a 64-bit system. 32-bit builds can be made on both 32-bit and 64-bit systems.

== Required Tools ==
Choose either 32-bit or 64-bit depending on your system and which build you want to make

 # CMake - click either *Windows win64-x64 Installer* or *Windows win32-x86 Installer*
  * Link: https://cmake.org/download/
 # Visual Studio - click *Download Visual Studio -> Community 2019* (earlier version starting from Community 2015 Update 3 might also work)
  * Link: https://visualstudio.microsoft.com/
 # Vcpkg
  * Link: https://github.com/Microsoft/vcpkg
 # FreePascal
  * 32-bit compiler - click *Windows 32-bit*
   * Link: https://www.freepascal.org/download.html
  * 64-bit compiler (necessary for 64-bit builds, bundled with Lazarus IDE) - click *Windows (64 Bits)*
   * Link: https://www.lazarus-ide.org/index.php?page=downloads
 # Mercurial - pick one (TortoiseHg has a GUI and is more user-friendly)
  * TortoiseHg - Chose one based on your OS version
   * Link: https://tortoisehg.bitbucket.io/
  * Command-line mercurial
   * Link: http://mercurial.selenic.com/downloads/

== Setup ==
 # Install CMake, but please *ensure* you select "Add CMake to the system PATH for all users", so you can run CMake directly from the command line.
 # Install FreePascal / Lazarus IDE. Add the directory containing fpc.exe to the PATH environment variable (either user or system).
 # Install VisualStudio, ensuring the *Workloads -> Desktop development with C++* option is selected.
 # Install Vcpkg by following the instructions under *Quick Start* section on the project page. If you don't have Git, use *Clone or download -> Download ZIP* option and extract the ZIP file. Create VCPKG_ROOT environment variable pointing to the directory you've clones/extracted it to.
 # Install TortoiseHg / Mercurial
 # Restart the computer
 # Download the Hedgewars source:
  # Using TortoiseHg
   * Right-click in any folder on your computer
   * Select Tortoise HG -> Clone.
   * In the _Source_ textbox enter: https://hg.hedgewars.org/hedgewars/
   * Press clone
  # Using command-line Mercurial
   * If you have Windows 7 or later, skip the next 3 steps, and instead, SHIFT + Right click in the folder where you want to download the source.
   * Start _Run..._ ( WINDOWS Key + R , or Start -> Run... )
   * Enter:
{{{
cmd.exe
}}}
   * Navigate to where you want to download the source
   * Type and execute (The initial clone of the repository will take a while):
{{{
hg clone https://hg.hedgewars.org/hedgewars/ trunk
}}}
 # Run Vckpg in the command line to build the necessary libraries (this will also take a while, especially for Qt). The command is:
  * For 32-bit builds
{{{
./vcpkg.exe install sdl2 sdl2-image sdl2-ttf sdl2-mixer sdl2-mixer[libvorbis] physfs openssl qt5-base qt5-tools ffmpeg
}}}
  * For 32-bit builds
{{{
./vcpkg.exe install sdl2:x64-windows sdl2-image:x64-windows sdl2-ttf:x64-windows sdl2-mixer:x64-windows sdl2-mixer[libvorbis]:x64-windows physfs:x64-windows openssl:x64-windows qt5-base:x64-windows qt5-tool:x64-windows ffmpeg:x64-windows
}}}
 # Build Hedgewars
  * Run the Developer Command Prompt for VS 2019 (or other installed version) from the Start menu (if you want Hedgewars to install to the default location in *C:/Program Files (x86)*, run it as administrator).
  * For 64-bit builds, in the dev command prompt run the following command (not necessary for 32-bit builds)
{{{
VC\Auxiliary\Build\vcvarsall.bat amd64
}}}
  * Navigate *<hedgewars_root>/tools* where *<hedgewars_root>* is the directory where you cloned the repository source to.
  * Run *build_vcpkg.bat* script
 # After building, you can run Hedgewars from the installed location (default is *C:/Program Files (x86)/hedgewars/hedgewars.exe*)

== Caveats ==
 # The linker from 64-bit FPC included in the Lazarus IDE might occasionally fail, producing *hwengine.exe* filled with zeroes. If this happens, just delete it and rerun *tools/build_vcpkg.bat* again (or run *nmake hedgewars* in the root directory to only rebuild the engine)