Build zint
with PNG support
We will %BUILD_ROOT%
in some %BUILD_ROOT%
directory. Everywhere in the future, the directory separator should be a forward slash ( /
). When using the reverse ( \
) possible assembly errors.
In this case, CMake
version 3.3.2 and MinGW-builds
version 5.2.0rev0 were used for the assembly.
- Build the
zlib
library (version 1.2.8 was used).
Download the zlib
source archive and unpack it into the %BUILD_ROOT%/zlib
directory. Next, collect:
cd /d %BUILD_ROOT% mkdir zlib-build cd zlib-build cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%BUILD_ROOT%/zlib-out ../zlib cmake --build . mingw32-make install
After that, the %BUILD_ROOT%/zlib-out
directory will %BUILD_ROOT%/zlib-out
compiled zlib
library.
- Build
libpng
(version 1.6.19 was used).
Download the libpng
source archive and unpack it into the %BUILD_ROOT%/libpng
directory. We collect:
cd /d %BUILD_ROOT% mkdir libpng-build cd libpng-build cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%BUILD_ROOT%/libpng-out -DZLIB_LIBRARY=%BUILD_ROOT%/zlib-out/lib/libzlib.dll.a -DZLIB_INCLUDE_DIR=%BUILD_ROOT%/zlib-out/include ../libpng cmake --build . mingw32-make install
Warnings CMake
ignored. After that, the %BUILD_ROOT%/libpng-out
directory will %BUILD_ROOT%/libpng-out
compiled libpng
.
- Build the
zint
library (version 2.4.3 was used).
Download the zint
source zint
and unpack it into the %BUILD_ROOT%/zint
. The CMakeLists.txt
file is either not suitable for new versions of CMake
, or it is initially an error, but in any case, an error occurs during the assembly, due to the inability to find the png.h
file. To correct the error, you need to slightly edit this file, namely, in the 14th line, replace ${PNG_INCLUDES}
with ${PNG_INCLUDE_DIRS}
. Now you can collect:
cd /d %BUILD_ROOT% mkdir zint-build cd zint-build cmake -G "MinGW Makefiles" -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX=%BUILD_ROOT%/zint-out -DZLIB_LIBRARY=%BUILD_ROOT%/zlib-out/lib/libzlib.dll.a -DZLIB_INCLUDE_DIR=%BUILD_ROOT%/zlib-out/include -DPNG_LIBRARY=%BUILD_ROOT%/libpng-out/lib/libpng.dll.a -DPNG_PNG_INCLUDE_DIR=%BUILD_ROOT%/libpng-out/include ../zint cmake --build . mingw32-make install
Assembly warnings are ignored. After performing all the steps in the %BUILD_ROOT%/zint-out
required libzint.dll
library will be libzint.dll
.
- Build without dependencies.
The resulting libzint.dll
has libzint.dll
dependencies, and that, in turn, has libzlib.dll
. In addition, all of these libraries depend on libgcc*.dll
. To remove all these dependencies and make the assembly (almost) completely independent, you can do the following.
We define two variables:
set CFLAGS=-static set CXXFLAGS=%CFLAGS%
These variables will remove the dependence of libraries on libgcc*.dll
.
To remove libpng.dll
dependency on zlib.dll
, fix one parameter when running cmake
:
-DZLIB_LIBRARY=%BUILD_ROOT%/zlib-out/lib/libzlibstatic.a
And to remove the dependency of libzint.dll
from libpng16.dll
and libzlib.dll
, cmake
needs to fix two parameters:
-DZLIB_LIBRARY=%BUILD_ROOT%/zlib-out/lib/libzlibstatic.a -DPNG_LIBRARY=%BUILD_ROOT%/libpng-out/lib/libpng.a
Done! The resulting library depends only on kernel32.dll
and msvcrt.dll
.