comparison mupdf-source/thirdparty/zint/win32/README @ 2:b50eed0cc0ef upstream

ADD: MuPDF v1.26.7: the MuPDF source as downloaded by a default build of PyMuPDF 1.26.4. The directory name has changed: no version number in the expanded directory now.
author Franz Glasner <fzglas.hg@dom66.de>
date Mon, 15 Sep 2025 11:43:07 +0200
parents
children
comparison
equal deleted inserted replaced
1:1d09e1dec1d9 2:b50eed0cc0ef
1 % win32/README 2024-01-18
2
3 Visual Studio 2022
4 ------------------
5
6 To build the Zint library DLL and the command line tool "zint.exe" with PNG
7 support for x86/Win32:
8
9 Install git (https://git-scm.com/downloads)
10 Install cmake (https://cmake.org/download/)
11
12 Open a "Developer Command Prompt for VS 2022" (should be available under the
13 "Visual Studio 2022" tab in the Start menu).
14
15 Make sure git and cmake are in your PATH, e.g. (your paths may differ)
16
17 set "PATH=C:\Program Files\Git\cmd;%PATH%"
18 set "PATH=C:\Program Files\CMake\bin;%PATH%"
19
20 Download zint, zlib and libpng by going to the directory you want to clone them
21 into:
22
23 cd <project-directory>
24
25 and cloning each:
26
27 git clone https://git.code.sf.net/p/zint/code zint
28 git clone https://git.code.sf.net/p/libpng/code lpng
29 git clone https://github.com/madler/zlib.git zlib
30
31 First build zlib:
32
33 cd zlib
34 nmake -f win32\Makefile.msc clean
35 nmake -f win32\Makefile.msc
36 cd ..
37
38 and then lpng:
39
40 cd lpng
41 nmake -f scripts\makefile.vcwin32 clean
42 nmake -f scripts\makefile.vcwin32
43 cd ..
44
45 If you now open "%cd%\zint\win32\zint.sln" with Visual Studio 2022, you
46 should be able to build the Release configuration for Win32.
47
48 "zint.dll" and "zint.exe" will be in "zint\win32\Release".
49
50 To build Zint Studio ("qtZint.exe"), you need to have Qt installed, which
51 involves signing up for a Qt account and installing the Qt Maintenance Tool.
52 (https://www.qt.io/download-qt-installer)
53 Using this tool you can install various versions of Qt and various optional
54 components.
55
56 The following requires the "MSVC 2019 32-bit" component to be installed.
57
58 As of writing Qt 5.15.2 is the latest release that includes this component and
59 is used here. Add the location of this component to your PATH, e.g. (your path
60 may differ):
61
62 set "PATH=C:\Qt\5.15.2\msvc2019\bin;%PATH%"
63
64 Next build the Zint backend Qt library "QtZintDLL.lib":
65
66 cd zint\backend_qt
67 qmake backend_qt_zintdll.pro
68 nmake clean
69 nmake release
70 cd ..\..
71
72 Then Zint Studio "qtZint.exe":
73
74 cd zint\frontend_qt
75 qmake frontend_qt_zintdll.pro
76 nmake clean
77 nmake release
78 cd ..\..
79
80 This creates "zint\frontend_qt\release\qtZint.exe". It requires the Zint DLL to
81 run, so add its location to your PATH:
82
83 set "PATH=%cd%\zint\win32\Release;%PATH%"
84
85 You should now be able to run Zint Studio:
86
87 zint\frontend_qt\release\qtZint
88
89
90 Visual Studio 2019 and 2017
91 ---------------------------
92
93 Solutions for Visual Studio 2019 and 2017 are in sub-directories vs2019 and
94 vs2017. The steps are the same as for Visual Studio 2022.
95
96
97 Visual Studio 2015
98 ------------------
99
100 A solution for Visual Studio 2015 is in sub-directory vs2015. The steps are
101 almost the same as for Visual Studio 2022, except that "rc.exe" may not be
102 available. If so, you need to install a Windows Kit and then update your PATH,
103 e.g. (adjust for version):
104
105 set "PATH=C:\Program Files (x86)\Windows Kits\10\bin\10.0.20348.0\x86;%PATH%"
106
107 Recent versions of Qt no longer supply a specific component for Visual Studio
108 2015 32-bit, but you can use "MSVC 2019 32-bit" instead as it's compatible.
109
110 For information on building a standalone version of Zint Studio using Visual
111 Studio 2015, see "frontend_qt\howto_build_qzint_using_msvs2015.txt"
112
113
114 CMake and Visual Studio
115 -----------------------
116
117 Zint can also be built using CMake with Visual Studio 2022, 2019, 2017 or 2015.
118 The following example uses Visual Studio 2019 to build for x86/Win32:
119
120 As above, follow the steps to build zlib and lpng.
121
122 CMake needs to be able to find zlib and lpng. One way to do this (requires
123 Administrator privileges) is to create two sub-directories in
124 "C:\Program Files (x86)" called "include" and "lib", and then copy
125
126 "zlib\zlib.h", "zlib\zconf.h", "lpng\png.h", "lpng\pngconf.h" and
127 "lpng\pnglibconf.h" into "include", and
128
129 "zlib\zlib.lib" and "lpng\libpng.lib" into "lib".
130
131 This example uses Qt 5.15.2 and component "MSVC 2019 32-bit" so install them and
132 add to path (your path may differ):
133
134 set "PATH=C:\Qt\5.15.2\msvc2019\bin;%PATH%"
135
136 Now build zint:
137
138 cd zint
139 cmake -G "Visual Studio 16 2019" -A Win32 -DCMAKE_BUILD_TYPE=Release -B build
140 cmake --build build --config Release
141 cd ..
142
143 You should be able to run zint CLI and Zint Studio:
144
145 set "PATH=%cd%\zint\build\backend\Release;%PATH%"
146 zint\build\frontend\Release\zint.exe
147 zint\build\frontend_qt\Release\zint-qt.exe
148
149 Note that the program name for Zint Studio when built using CMake is not
150 "qtZint.exe" but "zint-qt.exe".
151
152 For MSVC 2015 32-bit, MSVC 2017 32-bit and MSVC 2022 32-bit, the zint cmake
153 equivalents are:
154
155 cmake -G "Visual Studio 14 2015" -DCMAKE_BUILD_TYPE=Release -B build
156 cmake -G "Visual Studio 15 2017" -DCMAKE_BUILD_TYPE=Release -B build
157 cmake -G "Visual Studio 17 2022" -A Win32 -DCMAKE_BUILD_TYPE=Release -B build
158
159
160 Visual C++ 6
161 ------------
162
163 The zint library and command line tool can be built using VC6.
164
165 See "win32\zint_cmdline_vc6\readme.txt"
166
167
168 MinGW/MSYS
169 ----------
170
171 If not already installed, download and run the MinGW Installation Manager setup
172 (https://osdn.net/projects/mingw/downloads/68260/mingw-get-setup.exe/) and
173 using it install the packages:
174
175 mingw-developer-toolkit-bin
176 mingw32-base-bin
177 mingw32-gcc-g++-bin
178 msys-base-bin
179
180 (This should include mingw32-libz-dll)
181
182 Any reasonably modern version of Qt can be used. The following uses Qt 5.15.2.
183 Using the Qt Maintenance Tool (see the Visual Studio 2022 instructions above)
184 install the "MinGW 8.1.0 32-bit" component.
185
186 (Note the Qt MinGW versions actually refer to Mingw-w64, the 64-bit fork of
187 MinGW, but versions up to 8.1.0 at least are compatible.)
188
189 Open a MinGW/MSYS shell by clicking/running e.g. (your path may differ)
190
191 C:\MinGW\msys\1.0\msys.bat
192
193 As above make sure git and cmake are in your PATH.
194
195 Add the Qt MinGW 8.1.0 32-bit component to your PATH, e.g. (your path may
196 differ):
197
198 export PATH="/c/Qt/5.15.2/mingw81_32/bin":${PATH}
199
200 Go into the directory you want to use and clone zint and libpng:
201
202 cd <project-directory>
203
204 git clone https://git.code.sf.net/p/zint/code zint
205 git clone https://git.code.sf.net/p/libpng/code lpng
206
207 To compile lpng on MSYS, a bit of fiddling is needed. Go to the directory:
208
209 cd lpng
210
211 On Windows git usually converts UNIX line endings to DOS ones. Undo this:
212
213 dos2unix * scripts/*
214
215 Attempt to do the usual GNU make:
216
217 ./configure
218 make
219
220 This will fail with a syntax error. To fix:
221
222 sed -i 's/\r//' pnglibconf.h
223
224 (ignore "preserving permissions" warning if any)
225
226 And then do the make again:
227
228 make
229 make install
230
231 cd ..
232
233 The lpng includes should be in "/usr/local/include". Tell gcc to search there by
234 setting C_INCLUDE_PATH:
235
236 export C_INCLUDE_PATH=/usr/local/include
237
238 Now we should be able to build zint normally, except for telling cmake to
239 generate MSYS compatible makefiles:
240
241 cd zint
242
243 mkdir build
244 cd build
245 cmake -G "MSYS Makefiles" ..
246 make
247
248 cd ../..
249
250 This creates:
251
252 zint/build/backend/libzint.dll
253 zint/build/frontend/zint.exe
254 zint/build/backend_qt/libQZint.lib
255 zint/build/frontend_qt/zint-qt.exe
256
257 The Zint command line tool "zint.exe" and Zint Studio "zint-qt.exe" need
258 "libzint.dll" to run so add its location to your PATH:
259
260 export PATH="$(pwd)/zint/build/backend":${PATH}
261
262 You should now be able to run the command line tool:
263
264 zint/build/frontend/zint
265
266 And Zint Studio:
267
268 zint/build/frontend_qt/zint-qt