Building dpScreenOCR on Windows with MSYS2.

Contents:

  1 Setting up environment
    1.1 MSYS2
    1.2 Dependencies
    1.3 Pandoc
  2 Building
  3 Packaging
    3.1 CPack
    3.2 Inno Setup


1 Setting up environment
========================


1.1 MSYS2
---------

Visit https://www.msys2.org for instructions on how to install and set
up MSYS2.

MSYS2 provides several shells. Pick a MinGW shell depending on whether
you want to build a 32-bit or 64-bit version of the program, e.g.
"MSYS2 MinGW x86" or "MSYS2 MinGW x64". You will never need the MSYS
shell ("MSYS2 MSYS").


1.2 Dependencies
----------------

You will need the following tools and libraries to build dpScreenOCR:

Required:

  * C++ compiler with C++17 support
  * CMake >= 3.16. A particular version of Qt may require a newer
    version of CMake.
  * Make
  * Qt 5.3.2 - 6. DPSO_QT_VERSION CMake option.
  * tesseract >= 4.1.0
  * jansson >= 2.7
  * pkg-config (recent MSYS2 uses a compatible pkgconf tool)
  * dos2unix

Optional:

  * gettext >= 0.21. DPSO_ENABLE_NLS CMake option.
  * pandoc to generate HTML manual. DPSO_GEN_HTML_MANUAL CMake option.

To install all dependencies except Pandoc, run in a MinGW shell:

    pacman -S --needed \
        dos2unix \
        make \
        $MINGW_PACKAGE_PREFIX-cmake \
        $MINGW_PACKAGE_PREFIX-gcc \
        $MINGW_PACKAGE_PREFIX-gettext \
        $MINGW_PACKAGE_PREFIX-jansson \
        $MINGW_PACKAGE_PREFIX-pkgconf \
        $MINGW_PACKAGE_PREFIX-qt5-base \
        $MINGW_PACKAGE_PREFIX-qt5-translations \
        $MINGW_PACKAGE_PREFIX-tesseract-data-eng \
        $MINGW_PACKAGE_PREFIX-tesseract-ocr

Note that Tesseact data files don't depend on the architecture, so
there is no need to install "tesseract-data-eng" and other languages
for both i686 and x86_64; when building for x86_64, you can use data
from i686 and vice versa. Alternatively, you can download languages as
described in the user manual. Still, be aware that CMake will try to
copy the English language pack installed for the current architecture.


1.3 Pandoc
----------

MSYS2 does not provide Pandoc, so you have to download it from
https://pandoc.org and make it visible to CMake by extending PATH in a
MinGW shell:

    export PATH="$PATH:path_to_pandoc_dir"


2 Building
==========

You can build dpScreenOCR with the following commands:

    cd path_to_dpscreenocr_source
    mkdir build
    cd build
    cmake -G "Unix Makefiles" -DCMAKE_BUILD_TYPE=Release ..
    make

You can configure the build with various CMake options; run
"cmake -LH .." to see them all. Options specific to dpScreenOCR have
the "DPSO_" prefix.


3 Packaging
===========


3.1 CPack
---------

To create packages, run "cpack -G <generators>", where <generators>
is a semicolon-separated list of generator names you can find in
"cpack --help".

The NSIS, NSIS64, and WIX generators are no longer supported. Use Inno
Setup instead.


3.2 Inno Setup
--------------

There is inno_setup.iss in the build directory to create an installer
with Inno Setup.

Unless you disable the DPSO_ENABLE_NLS option, you will need some
unofficial language files listed in inno_setup_languages.isi. Download
them from the Inno Setup website or source code repository
(Files/Languages/Unofficial/) to the "Languages/Unofficial/" directory
in the root of your Inno Setup installation.
