================================================================================
Compiling Doomseeker in MinGW-w64 8.1.0 with Qt 5.7.1
Written by Zalewa, September 2015, Updated February 2019
================================================================================
1. Quick introduction.

This guide describes how I compile Doomseeker on Windows.
This is a solution that I find efficient enough.

Compiling other people's programs on Windows is usually a difficult and
frustrating task. If you follow this guide you should be able to compile
binaries for Doomseeker, Wadseeker and all plugins by yourself.
================================================================================
2. Compiler.

On Windows only one compiler is officially supported:

  MinGW-w64 release-posix-dwarf-rt_v6-rev0

This guide uses MinGW-w64 version 8.1.0, but if a new one is already available
then it should be compatible as long as you stick to "posix" threads and "dwarf"
exceptions. These requirements are imposed by the precompiled Qt5 libraries.

First step is to get MinGW-w64

  https://sourceforge.net/projects/mingw-w64/files/Toolchains%20targetting%20Win32/Personal%20Builds/mingw-builds/8.1.0/threads-posix/dwarf/


================================================================================
3. Qt.

While newer versions of Qt were already available when this instruction was
written, Qt 5.7.1 is the final Qt version that still runs on Windows XP.
This is the version that we will be using for this guide.

Using older Qt5 versions is discouraged as they had localization bugs and
they linked against ICU (about 30MB of additional DLL dependency).

Get Qt 5.7.1 for MinGW-w64 from Qt's official home page and install it.

  https://download.qt.io/new_archive/qt/5.7/5.7.1/qt-opensource-windows-x86-mingw530-5.7.1.exe

================================================================================
3.1. Extra Qt translation files.

If your Qt installation happens to not come with certain translation files,
you can fetch them from here:

  https://doomseeker.drdteam.org/files/translations/

Qt translation sets are in "qt_*.zip" files. Download whatever you are
missing and then unpack it directly, with no subdirectories, to:

  X:\QT_BASE\5.7\mingw53_32\translations\

================================================================================
4. OpenSSL

Link:
https://doomseeker.drdteam.org/files/dependencies/openssl-1.0.2j.7z

Doomseeker will work without OpenSSL, but it won't be able to access HTTPS sites.
Many of the features contact HTTPS sites, therefore lack of OpenSSL will be
crippling and may result in additional error popups.

================================================================================
5. CMake.

https://www.cmake.org/

CMake is a quite useful tool that helps with creation of project files and
makefiles for various different compilers and Operating Systems. It allows
programmers to avoid uploading all that mess that IDEs create when they
spawn a new project. Also, it helps with keeping track of all the dependencies
that the program needs in order to compile.

CMake version 3.14.0-rc1 was used when writing this doc.

Get CMake now.

Launch CMake GUI.

The first thing you need to set is "Where to build the binaries". This
should be located somewhere outside the repository. For example:

  D:\dev\Doomseeker\mingw64-release

The second thing is "Where is the source code". Pick the top-most directory
that contains the CMakeLists.txt file. In case of Doomseeker this is the root
directory of the repository. For example:

  D:\dev\Doomseeker\repo

Now press "Configure" button.

CMake should prompt about the type of compiler you want to use.
Pick "MinGW Makefiles" and "Use default native compilers".

Now press "Finish". If you did everything right up to this point then
CMake should find the GNU compiler, then an error pop-up will appear.
This error is nothing to worry about. We just need to manually provide
some options before continuing.

Find "Grouped" and "Advanced" checkboxes in CMake GUI and check them both. The
list should now change and you should see following items:
- Ungrouped Entries
- CMAKE
- CPACK

In "Ungrouped Entries" find "Qt5_DIR" option and point it to the sub-directory
in your Qt installation directory:

  X:\QT_BASE\5.7\mingw53_32\lib\cmake\Qt5

Also, in "CMAKE" group, set "CMAKE_BUILD_TYPE" option to "Release".
Should you wish to create a debug build instead, set the option to "Debug".

When you finish setting everything press "Configure" button again so that all
red options should turn to normal background color. If there are more red
options, then press "Configure" once more. When everything is in normal
background color, press "Generate" button. This should create the makefiles
in the target directory.

It is now possible to compile from command line by using cmake:

  cd mingw64-release
  cmake --build . -- -j<processes>

Specify number of concurrent compilation processes instead of <processes>

================================================================================
6. Tweaks.

6.1. Enabling INSTALL target.

Open OPENSSL branch and point both settings there to appropriate DLL files.
The setting names tell you which file you need for which setting.

Remember to change CMAKE_INSTALL_PREFIX path to something less stupid than
"C:\Program Files (x86)\Doomseeker". Be aware that the installed files are
dumped directly to this directory.

6.2. IP2C

Procedures to spawn the optional IpToCountry.dat file are the same as
for any other platform. Refer to the corresponding section in COMPILE.txt.
A Python3 installation is required to spawn the database.
================================================================================
7. Runtime dependencies.

The compiled executable may not run if it won't see the necessary DLLs from Qt,
MinGW and OpenSSL. Moreover, there may be startup crashes if it finds DLLs with
same names but incompatible interfaces somewhere else in the system. Build
scripts can package proper DLLs for you if you use the install target.

Point CMAKE_INSTALL_PREFIX to an empty directory, such as:

  D:\dev\doomseeker\install

Then run the 'install' target from your build directory:

  cmake --build . --target install

Debug builds will need Qt libraries with the 'd' suffix.

================================================================================
Copyright (C) 2012 The Doomseeker Team

Copying and distribution of this file, with or without modification,
are permitted in any medium without royalty provided the copyright
notice and this notice are preserved.  This file is offered as-is,
without any warranty.
================================================================================
