2024-01-19 12:28:03 +03:00
% win32/README 2024-01-18
2024-01-17 04:45:45 +03:00
2023-12-16 16:06:48 +03:00
Visual Studio 2022
2020-06-17 22:46:18 +03:00
------------------
2020-06-16 20:10:44 +03:00
2020-06-18 17:51:57 +03:00
To build the Zint library DLL and the command line tool "zint.exe" with PNG
2020-06-17 22:46:18 +03:00
support for x86/Win32:
2020-06-16 20:10:44 +03:00
Install git (https://git-scm.com/downloads)
Install cmake (https://cmake.org/download/)
2023-12-16 16:06:48 +03:00
Open a "Developer Command Prompt for VS 2022" (should be available under the
"Visual Studio 2022" tab in the Start menu).
2020-06-16 20:10:44 +03:00
Make sure git and cmake are in your PATH, e.g. (your paths may differ)
2020-06-17 22:46:18 +03:00
set "PATH=C:\Program Files\Git\cmd;%PATH%"
set "PATH=C:\Program Files\CMake\bin;%PATH%"
2020-06-16 20:10:44 +03:00
Download zint, zlib and libpng by going to the directory you want to clone them
into:
2021-06-14 02:48:29 +03:00
cd <project-directory>
2020-06-16 20:10:44 +03:00
and cloning each:
git clone https://git.code.sf.net/p/zint/code zint
git clone https://git.code.sf.net/p/libpng/code lpng
git clone https://github.com/madler/zlib.git zlib
First build zlib:
cd zlib
2021-06-10 13:15:39 +03:00
nmake -f win32\Makefile.msc clean
- API: add new zint_symbol `dpmm` field for output resolution (BMP/
EMF/PCX/PNG/TIF only, i.e. excluding EPS, GIF & SVG)
- Add support for specifying scale by X-dimension and resolution
with new option `--scalexdimdp` for CLI/Tcl & new API function
`ZBarcode_Scale_From_XdimDp()` (+ `ZBarcode_XdimDp_From_Scale()`
& `ZBarcode_Default_Xdim()`) and new GUI popup; manual: document
- BMP/EMF/PCX/PNG/TIF: use new `dpmm` resolution field (for EMF
following Inkscape)
- backend_qt: add `dpmm()`, `vectorWidth()`, `vectorHeight()`,
`noPng()`, `getVersion()`, `takesGS1AIData()`, & `XdimDp` stuff
incl. new `QZintXdimDp` struct for passing around scale vars &
use in `getAsCLI()`; add comments
- Raise `scale` limit to 200 (from 100) to allow for large dpmm
- output: create directories & subdirectories as necessary for
output path using new function `out_fopen()` and use in BMP/EMF/
EPS/GIF/PCX/PNG/SVG/TIF
- DPLEIT/DPIDENT: format HRT according to (incomplete)
documentation, and set default height to 72X (from 50X)
- CODE128B renamed to CODE128AB as can use subsets A and/or B
- CODABAR: fix minimum height calc
- EMF: fix indexing of handles (zero-based not 1-based)
- GUI: fix symbology zap (previous technique of clearing and
re-loading settings without doing a sync no longer works);
fix UPCEAN guard descent enable
- MAILMARK: better error message if input < 14 characters
- GUI: add "Default" button for DAFT tracker ratio & enable/disable
various default buttons; use new `takesGS1AIData()` to
enable/disable GS1-specific checkboxes
- CLI: use new `validate_float()` to parse float options (7
significant digits allowed only, no scientific notation)
- DATAMATRIX/GRIDMATRIX/PDF417/QR/ULTRA: micro-optimize structapp
ID parse
- library/CLI: fiddle with static asserts (make CHAR_BIT sensitive,
supposedly)
- win32/README: update building libpng (assembly removed)
- README.linux: document incompatibility of Qt6 >= 6.3
- manual: expand Barcode Studio waffle
- test suite: change range separator to hyphen and allow multiple
excludes
2022-12-03 00:39:01 +03:00
nmake -f win32\Makefile.msc
2020-06-16 20:10:44 +03:00
cd ..
and then lpng:
cd lpng
2023-12-16 16:06:48 +03:00
nmake -f scripts\makefile.vcwin32 clean
nmake -f scripts\makefile.vcwin32
2020-06-16 20:10:44 +03:00
cd ..
2023-12-16 16:06:48 +03:00
If you now open "%cd%\zint\win32\zint.sln" with Visual Studio 2022, you
2020-06-18 17:51:57 +03:00
should be able to build the Release configuration for Win32.
2020-06-16 20:10:44 +03:00
2020-06-18 17:51:57 +03:00
"zint.dll" and "zint.exe" will be in "zint\win32\Release".
2020-06-16 20:10:44 +03:00
2020-06-17 22:46:18 +03:00
To build Zint Studio ("qtZint.exe"), you need to have Qt installed, which
involves signing up for a Qt account and installing the Qt Maintenance Tool.
2020-06-18 17:51:57 +03:00
(https://www.qt.io/download-qt-installer)
2020-06-17 22:46:18 +03:00
Using this tool you can install various versions of Qt and various optional
components.
2020-06-16 20:10:44 +03:00
2023-12-16 16:06:48 +03:00
The following requires the "MSVC 2019 32-bit" component to be installed.
2020-06-17 22:46:18 +03:00
2023-12-16 16:06:48 +03:00
As of writing Qt 5.15.2 is the latest release that includes this component and
2020-06-17 22:46:18 +03:00
is used here. Add the location of this component to your PATH, e.g. (your path
may differ):
2023-12-16 16:06:48 +03:00
set "PATH=C:\Qt\5.15.2\msvc2019\bin;%PATH%"
2020-06-17 22:46:18 +03:00
2021-06-24 20:31:08 +03:00
Next build the Zint backend Qt library "QtZintDLL.lib":
cd zint\backend_qt
qmake backend_qt_zintdll.pro
nmake clean
nmake release
cd ..\..
Then Zint Studio "qtZint.exe":
2020-06-17 22:46:18 +03:00
cd zint\frontend_qt
qmake frontend_qt_zintdll.pro
nmake clean
nmake release
cd ..\..
2020-06-18 17:51:57 +03:00
This creates "zint\frontend_qt\release\qtZint.exe". It requires the Zint DLL to
run, so add its location to your PATH:
2020-06-17 22:46:18 +03:00
2021-07-06 21:53:31 +03:00
set "PATH=%cd%\zint\win32\Release;%PATH%"
2020-06-17 22:46:18 +03:00
You should now be able to run Zint Studio:
zint\frontend_qt\release\qtZint
2020-06-16 20:10:44 +03:00
2023-12-16 16:06:48 +03:00
Visual Studio 2019 and 2017
---------------------------
2021-06-10 13:15:39 +03:00
2023-12-16 16:06:48 +03:00
Solutions for Visual Studio 2019 and 2017 are in sub-directories vs2019 and
vs2017. The steps are the same as for Visual Studio 2022.
2021-06-10 13:15:39 +03:00
2020-06-16 20:10:44 +03:00
Visual Studio 2015
------------------
2023-12-16 16:06:48 +03:00
A solution for Visual Studio 2015 is in sub-directory vs2015. The steps are
almost the same as for Visual Studio 2022, except that "rc.exe" may not be
available. If so, you need to install a Windows Kit and then update your PATH,
e.g. (adjust for version):
2021-06-10 13:15:39 +03:00
2023-12-16 16:06:48 +03:00
set "PATH=C:\Program Files (x86)\Windows Kits\10\bin\10.0.20348.0\x86;%PATH%"
2021-06-10 13:15:39 +03:00
Recent versions of Qt no longer supply a specific component for Visual Studio
2023-12-16 16:06:48 +03:00
2015 32-bit, but you can use "MSVC 2019 32-bit" instead as it's compatible.
2020-06-16 20:10:44 +03:00
2020-06-17 22:46:18 +03:00
For information on building a standalone version of Zint Studio using Visual
2021-07-07 12:46:26 +03:00
Studio 2015, see "frontend_qt\howto_build_qzint_using_msvs2015.txt"
2020-06-17 22:46:18 +03:00
2020-06-16 20:10:44 +03:00
2021-06-10 13:15:39 +03:00
CMake and Visual Studio
-----------------------
2023-06-13 20:12:20 +03:00
Zint can also be built using CMake with Visual Studio 2022, 2019, 2017 or 2015.
The following example uses Visual Studio 2019 to build for x86/Win32:
2021-06-10 13:15:39 +03:00
2023-12-16 16:06:48 +03:00
As above, follow the steps to build zlib and lpng.
2021-06-10 13:15:39 +03:00
CMake needs to be able to find zlib and lpng. One way to do this (requires
2021-06-12 18:01:16 +03:00
Administrator privileges) is to create two sub-directories in
2021-06-10 13:15:39 +03:00
"C:\Program Files (x86)" called "include" and "lib", and then copy
"zlib\zlib.h", "zlib\zconf.h", "lpng\png.h", "lpng\pngconf.h" and
"lpng\pnglibconf.h" into "include", and
2023-12-16 16:06:48 +03:00
"zlib\zlib.lib" and "lpng\libpng.lib" into "lib".
2021-07-26 17:29:05 +03:00
2021-06-10 20:04:27 +03:00
This example uses Qt 5.15.2 and component "MSVC 2019 32-bit" so install them and
2021-06-10 13:15:39 +03:00
add to path (your path may differ):
set "PATH=C:\Qt\5.15.2\msvc2019\bin;%PATH%"
Now build zint:
cd zint
cmake -G "Visual Studio 16 2019" -A Win32 -DCMAKE_BUILD_TYPE=Release -B build
cmake --build build --config Release
cd ..
You should be able to run zint CLI and Zint Studio:
2021-07-06 21:53:31 +03:00
set "PATH=%cd%\zint\build\backend\Release;%PATH%"
2021-06-10 13:15:39 +03:00
zint\build\frontend\Release\zint.exe
zint\build\frontend_qt\Release\zint-qt.exe
Note that the program name for Zint Studio when built using CMake is not
"qtZint.exe" but "zint-qt.exe".
2023-06-13 20:12:20 +03:00
For MSVC 2015 32-bit, MSVC 2017 32-bit and MSVC 2022 32-bit, the zint cmake
equivalents are:
2021-07-06 21:53:31 +03:00
cmake -G "Visual Studio 14 2015" -DCMAKE_BUILD_TYPE=Release -B build
cmake -G "Visual Studio 15 2017" -DCMAKE_BUILD_TYPE=Release -B build
2023-06-13 20:12:20 +03:00
cmake -G "Visual Studio 17 2022" -A Win32 -DCMAKE_BUILD_TYPE=Release -B build
2021-07-06 21:53:31 +03:00
2021-06-10 13:15:39 +03:00
2020-06-16 20:10:44 +03:00
Visual C++ 6
------------
2021-06-10 13:15:39 +03:00
The zint library and command line tool can be built using VC6.
2020-06-16 20:10:44 +03:00
See "win32\zint_cmdline_vc6\readme.txt"
2020-06-18 17:51:57 +03:00
MinGW/MSYS
2020-06-16 20:10:44 +03:00
----------
2020-06-18 17:51:57 +03:00
If not already installed, download and run the MinGW Installation Manager setup
(https://osdn.net/projects/mingw/downloads/68260/mingw-get-setup.exe/) and
using it install the packages:
mingw-developer-toolkit-bin
mingw32-base-bin
mingw32-gcc-g++-bin
msys-base-bin
(This should include mingw32-libz-dll)
2024-01-19 12:28:03 +03:00
Any reasonably modern version of Qt can be used. The following uses Qt 5.15.2.
2024-01-06 01:55:57 +03:00
Using the Qt Maintenance Tool (see the Visual Studio 2022 instructions above)
2024-01-19 12:28:03 +03:00
install the "MinGW 8.1.0 32-bit" component.
2020-06-18 17:51:57 +03:00
2021-06-10 13:15:39 +03:00
(Note the Qt MinGW versions actually refer to Mingw-w64, the 64-bit fork of
2024-01-19 12:28:03 +03:00
MinGW, but versions up to 8.1.0 at least are compatible.)
2020-06-18 17:51:57 +03:00
Open a MinGW/MSYS shell by clicking/running e.g. (your path may differ)
C:\MinGW\msys\1.0\msys.bat
As above make sure git and cmake are in your PATH.
2024-01-19 12:28:03 +03:00
Add the Qt MinGW 8.1.0 32-bit component to your PATH, e.g. (your path may
2020-06-18 17:51:57 +03:00
differ):
2024-01-19 12:28:03 +03:00
export PATH="/c/Qt/5.15.2/mingw81_32/bin":${PATH}
2020-06-18 17:51:57 +03:00
Go into the directory you want to use and clone zint and libpng:
2021-06-10 13:15:39 +03:00
cd <project-directory>
2020-06-18 17:51:57 +03:00
git clone https://git.code.sf.net/p/zint/code zint
git clone https://git.code.sf.net/p/libpng/code lpng
To compile lpng on MSYS, a bit of fiddling is needed. Go to the directory:
cd lpng
On Windows git usually converts UNIX line endings to DOS ones. Undo this:
dos2unix * scripts/*
Attempt to do the usual GNU make:
./configure
make
This will fail with a syntax error. To fix:
sed -i 's/\r//' pnglibconf.h
2021-06-10 13:15:39 +03:00
(ignore "preserving permissions" warning if any)
2020-06-18 17:51:57 +03:00
And then do the make again:
make
make install
cd ..
The lpng includes should be in "/usr/local/include". Tell gcc to search there by
setting C_INCLUDE_PATH:
export C_INCLUDE_PATH=/usr/local/include
Now we should be able to build zint normally, except for telling cmake to
generate MSYS compatible makefiles:
cd zint
mkdir build
cd build
cmake -G "MSYS Makefiles" ..
make
cd ../..
This creates:
zint/build/backend/libzint.dll
zint/build/frontend/zint.exe
2021-06-24 20:31:08 +03:00
zint/build/backend_qt/libQZint.lib
2020-06-18 17:51:57 +03:00
zint/build/frontend_qt/zint-qt.exe
2020-11-25 01:22:12 +03:00
The Zint command line tool "zint.exe" and Zint Studio "zint-qt.exe" need
"libzint.dll" to run so add its location to your PATH:
2020-06-18 17:51:57 +03:00
2021-07-06 21:53:31 +03:00
export PATH="$(pwd)/zint/build/backend":${PATH}
2020-06-18 17:51:57 +03:00
2020-11-25 01:22:12 +03:00
You should now be able to run the command line tool:
2020-06-18 17:51:57 +03:00
2020-11-25 01:22:12 +03:00
zint/build/frontend/zint
2020-06-18 17:51:57 +03:00
2020-11-25 01:22:12 +03:00
And Zint Studio:
2020-06-18 17:51:57 +03:00
zint/build/frontend_qt/zint-qt