Harald Oehlmann
2025-09-26

How to build qtZint.exe using:
- QT 5.15.16 source package
- MS Visual Studio 2015 (VC14)

Build static Qt:
---------------
- Go to: https://www.qt.io/offline-installers
- Download the zip "Qt 5.15.x source packages" (nearly 1 GB):
  https://download.qt.io/official_releases/qt/5.15/5.15.16/single/qt-everywhere-opensource-src-5.15.16.zip
- Unzip to C:\ resulting in having the source in C:\qt-everywhere-opensource-src-5.15.16\qt-everywhere-src-5.15.16
- Install Python (https://www.python.org/downloads/windows/) and make it available within the path.

- Start the VS2015 x86 native console by the start menu entry:
  Visual Studio 2015\Visual Studio Tools\Windows Desktop Command Prompts\VS2015 x86 Native Tools-Eingabeaufforderung
- ("Eingabeaufforderung" = "Command Prompt")

- WARNING: MS Visual Studio 2015 will only work with up to Windows Kit 10.0.20348.0, which was removed in a recent update
  (see https://developercommunity.visualstudio.com/t/Visual-Studio-update-171411-removed-th/10953401?sort=newest)
  It can be reinstalled at https://developer.microsoft.com/en-us/windows/downloads/sdk-archive/index-legacy
  You may need to manually reset the environment variables INCLUDE, LIB, UCRTVersion, WindowsSDKLibVersion and WindowsSDKVersion, e.g.

  set "INCLUDE=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\INCLUDE;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\INCLUDE;C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\ucrt;C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\shared;C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\um;C:\Program Files (x86)\Windows Kits\10\include\10.0.20348.0\winrt;"
  set "LIB=C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\LIB;C:\Program Files (x86)\Microsoft Visual Studio 14.0\VC\ATLMFC\LIB;C:\Program Files (x86)\Windows Kits\10\lib\10.0.20348.0\ucrt\x86;C:\Program Files (x86)\Windows Kits\10\lib\10.0.20348.0\um\x86;"
  set UCRTVersion=10.0.20348.0
  set WindowsSDKLibVersion=10.0.20348.0\
  set WindowsSDKVersion=10.0.20348.0\

- Note: if "rc.exe" not available, install a Windows Kit and update PATH (e.g.):
  set "PATH=C:\Program Files (x86)\Windows Kits\10\bin\10.0.20348.0\x86;%PATH%"

  cd C:\qt-everywhere-opensource-src-5.15.16\qt-everywhere-src-5.15.16
  configure.bat -static -release -prefix c:\qt\5.15.16static -qt-zlib -qt-pcre -qt-libpng -qt-libjpeg -qt-freetype -opengl desktop -no-openssl -opensource -confirm-license -make libs -nomake tools -nomake examples -nomake tests -mp
- One may set another destination folder after the -prefix option.
- Attention, the upper command is one long line.
  nmake
  nmake install
- The last 3 commands run around 3 hours.
- Make sure, that python may be found in the path.
- the huge source folder may be deleted to save around 6GB of space.

Zint Folder structure:
----------------------
- zint source files in %ZH%, e.g.
  set "ZH=%cd%\zint"
  git clone https://git.code.sf.net/p/zint/code "%ZH%"
-> this file is in %ZH%\frontend_qt

- libpng source files in %ZH%\..\lpng
  git clone https://git.code.sf.net/p/libpng/code "%ZH%\..\lpng"
-> %ZH%\..\lpng\png.h exists

- zlib source files in %ZH%\..\zlib
  git clone https://github.com/madler/zlib.git "%ZH%\..\zlib"
-> %ZH%\..\zlib\zlib.h exists

- gs1-syntax-engine source files in %ZH%\..\gs1-syntax-engine
  git clone https://github.com/gitlost/gs1-syntax-engine "%ZH%\..\gs1-syntax-engine"

Build libpng:
-------------
  cd "%ZH%\..\zlib"
  nmake -f win32\Makefile.msc clean
  nmake -f win32\Makefile.msc
  cd ..\lpng
  nmake -f scripts\makefile.vcwin32 clean
  nmake -f scripts\makefile.vcwin32

Build gs1-syntax-engine:
------------------------
  cd "%ZH%\..\gs1-syntax-engine\src\c-lib"
  nmake -f makefile.vcwin32 clean
  nmake -f makefile.vcwin32

Build zint:
-----------
  set QTDIR=C:\Qt\5.15.16static
  set PATH=C:\Qt\5.15.16static\bin;%PATH%
  set QMAKESPEC=win32-msvc
  cd "%ZH%"

  cd backend_qt
  qmake backend_qt.pro
  nmake clean
  nmake release

  cd ..\frontend_qt
  qmake frontend_qt.pro
  nmake clean
  nmake release
-> qtZint.exe is in the release folder
