BuildingOnWindows.wiki
changeset 1955 637685e52477
parent 1895 93f8269fca27
child 1956 625477ff2786
equal deleted inserted replaced
1954:1e0fad9c1a4e 1955:637685e52477
     1 #summary Instructions for building Hedgewars on Windows (Currently outdated)
     1 #summary Instructions for building Hedgewars on Windows
     2 #labels Phase-Implementation,Phase-Design,Phase-Support
     2 #labels Phase-Implementation,Phase-Design,Phase-Support
     3 
     3 
     4 = Building on Windows =
     4 = Building on Windows =
     5 == Warning! ==
       
     6 These build instructions are very outdated. Try to build under [BuildingOnLinux GNU/Linux], if you can.
       
     7 
       
     8 If you have managed to get a successful Windows build for a recent Hedgewars build, please get in touch with us (Try the forums, for example: https://hedgewars.org/forum)
       
     9 
     5 
    10 == Things to download ==
     6 == Things to download ==
    11 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 need it while doing the setup.
     7 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.
    12 
     8 
    13 Basically, you need to have all dependencies listed at [Dependencies]. The following is a list of where you can obtain the dependencies for Windows:
     9 == Required Tools ==
       
    10 Choose either 32-bit or 64-bit depending on your system and which build you want to make
    14 
    11 
    15  # CMake - download the *Windows (Win32 Installer)* 
    12  # CMake - click either *Windows win64-x64 Installer* or *Windows win32-x86 Installer*
    16   * Link: https://cmake.org/download/
    13   * Link: https://cmake.org/download/
    17  # FreePascal - download the *Download as installer* 
    14  # Visual Studio - click *Download Visual Studio -> Community 2019* (earlier version starting from Community 2015 Update 3 might also work)
    18   * Link: http://sourceforge.net/projects/freepascal/
    15   * Link: https://visualstudio.microsoft.com/
    19  # Qt SDK - Select the online installer, as it will save you ~1 GB of bandwidth. Nokia will also require you to register an account to download it.
    16  # Vcpkg
    20   * Link: https://www.qt.io/download-qt-installer
    17   * Link: https://github.com/Microsoft/vcpkg
       
    18  # FreePascal
       
    19   * 32-bit compiler - click *Windows 32-bit*
       
    20    * Link: https://www.freepascal.org/download.html
       
    21   * 64-bit compiler (necessary for 64-bit builds, bundled with Lazarus IDE) - click *Windows (64 Bits)*
       
    22    * Link: https://www.lazarus-ide.org/index.php?page=downloads
    21  # Mercurial - pick one (TortoiseHg has a GUI and is more user-friendly)
    23  # Mercurial - pick one (TortoiseHg has a GUI and is more user-friendly)
    22   * TortoiseHg - Chose one based on your OS version
    24   * TortoiseHg - Chose one based on your OS version
    23    * Link: https://tortoisehg.bitbucket.io/
    25    * Link: https://tortoisehg.bitbucket.io/
    24   * Command-line mercurial
    26   * Command-line mercurial
    25    * Link: http://mercurial.selenic.com/downloads/
    27    * Link: http://mercurial.selenic.com/downloads/
    26  #  _Windows building archive_ - it contains everything you need to compile Hedgewars on Windows. 
       
    27    * Link (**!!!LINK IS DEAD!!!**): http://hedgewars.googlecode.com/files/hedgewars-win32-buildscripts.zip
       
    28 
    28 
    29 == Setup ==
    29 == Setup ==
    30  # Install CMake, but please *ensure* you select "Add CMake to the system PATH for all users", so you can run CMake directly from command line.
    30  # 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.
    31  # Install FreePascal.
    31  # Install FreePascal / Lazarus IDE. Add the directory containing fpc.exe to the PATH environment variable (either user or system).
    32  # Install Qt SDK, with the "Custom" option:
    32  # Install VisualStudio, ensuring the *Workloads -> Desktop development with C++* option is selected.
    33   * Click the *DESELECT ALL* button. We will then check only what we need
    33  # 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.
    34   * Check *Qt SDK/Miscellaneous/MinGW <any version>*
       
    35   * Check *Qt SDK/Development Tools/Desktop Qt/Qt <newest version>/Desktop Qt <newest version> - Mingw*
       
    36   * !!If there are any error message boxes, just press ignore until they are all gone. :)
       
    37  # Install TortoiseHg / Mercurial
    34  # Install TortoiseHg / Mercurial
    38  # Restart the computer
    35  # Restart the computer
    39  # Download the Hedgewars source:
    36  # Download the Hedgewars source:
    40   # Using TortoiseHg
    37   # Using TortoiseHg
    41    * Right-click in any folder on your computer
    38    * Right-click in any folder on your computer
    42    * Select Tortoise HG -> Clone.
    39    * Select Tortoise HG -> Clone.
    43    * In the _Source_ textbox enter: https://hg.hedgewars.org/hedgewars/
    40    * In the _Source_ textbox enter: https://hg.hedgewars.org/hedgewars/
    44    * Press clone
    41    * Press clone
    45   # Using command-line Mercurial
    42   # Using command-line Mercurial
    46    * If you have Windows 7 skip the next 3 steps, and instead, SHIFT + Right click in the folder where you want to download the source.
    43    * 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.
    47    * Start _Run..._ ( WINDOWS Key + R , or Start -> Run... )
    44    * Start _Run..._ ( WINDOWS Key + R , or Start -> Run... )
    48    * Enter:
    45    * Enter:
    49 {{{
    46 {{{
    50 cmd.exe
    47 cmd.exe
    51 }}} 
    48 }}}
    52    * Navigate to where you want to download the source
    49    * Navigate to where you want to download the source
    53    * Type and execute ( The initial clone of the repository will take a while, is about 550MiB or so... ):
    50    * Type and execute (The initial clone of the repository will take a while):
    54 {{{
    51 {{{
    55 hg clone https://hg.hedgewars.org/hedgewars/ trunk
    52 hg clone https://hg.hedgewars.org/hedgewars/ trunk
    56 }}}
    53 }}}
    57  # Navigate to the where you cloned the repository source to.
    54  # Run Vckpg in the command line to build the necessary libraries (this will also take a while, especially for Qt). The command is:
    58  # Go to the "tools/build_windows.bat" file, and modify the following:
    55   * For 32-bit builds
    59   * SET PASCAL=<put the path to the directory that contains fpc's executable (fpc.exe)> (for example: c:\FPC\2.4.4\bin\i386-win32\)
    56 {{{
    60   * SET SET QTDIR=<path to the QtSDK\Desktop\Qt\<your version>> (for example: c:\QtSDK\Desktop\Qt\4.8.1\)
    57 ./vcpkg.exe install sdl2 sdl2-image sdl2-ttf sdl2-mixer sdl2-mixer[libvorbis] physfs openssl qt5-base qt5-tools ffmpeg
    61  # You can now build hedgewars, by running the *tools/build_windows.bat* command.
    58 }}}
    62  # After building it, you can run it from the Desktop - using the *Hedgewars* shortcut.
    59   * For 32-bit builds
       
    60 {{{
       
    61 ./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
       
    62 }}}
       
    63  # Build Hedgewars
       
    64   * 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).
       
    65   * For 64-bit builds, in the dev command prompt run the following command (not necessary for 32-bit builds)
       
    66 {{{
       
    67 VC\Auxiliary\Build\vcvarsall.bat amd64
       
    68 }}}
       
    69   * Navigate *<hedgewars_root>/tools* where *<hedgewars_root>* is the directory where you cloned the repository source to.
       
    70   * Run *build_vcpkg.bat* script
       
    71  # After building, you can run Hedgewars from the installed location (default is *C:/Program Files (x86)/hedgewars/hedgewars.exe*)
    63 
    72 
    64 == Additional setup for Visual Studio 2010 ==
    73 == Caveats ==
    65 To build Hedgewars using Visual Studio 2010, you will need to update a few SDL files using this zip file (http://hedgewars.googlecode.com/files/hedgewars-VS2010-additional.zip). Just download and overwrite it into your currect hedgewars project folder. This is mainly an update to SDL_mixer (updating it to version 1.2.12), and changing the SDLconfig.h file to work with the sperate platform headers instead of the current one.
    74  # 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)
    66 
       
    67 Next you will need to change some project settings. If you don't have the SDL directives set correctly in CMake then your project files will be incorect (they still may be incorrect even if you did get them set right). You need to change the following Project Settings for the 'hedgewars' project.
       
    68  # Make sure that under C/C++ => Additional Include Directories you have \hedgewars\misc\winutils\include\.
       
    69  # Change the Linker => Input => Additional Dependencies option to have the following at the end:
       
    70   * \hedgewars\misc\winutils\lib\SDL.lib
       
    71   * \hedgewars\misc\winutils\lib\SDLmain.lib
       
    72   * \hedgewars\misc\winutils\lib\SDL_mixer.lib
       
    73  # Adjust the Output Directory under the General settings to be just \hedgewars\bin\.
       
    74 
       
    75 == Building process ==
       
    76 Run the *tools/build_windows.bat* file each time you want to build the source. Please note that there might some incompatibilities with the environment paths of this script in case that you are running MinSYS or Cygwin: we are quite confident that if you use such software you're quite able to correctly set up any paths.