The easiest way to install YAZ on Windows is by downloading an installer from Index Data's Windows support area . The installer comes with source too - in case you wish to compile YAZ with different compiler options, etc.
YAZ is shipped with "makefiles" for the NMAKE tool that comes with Microsoft Visual Studio. It has been tested with Microsoft Visual Studio 2019 and 2022.
Install the external libraries with vcpkg as described in Section 3.3, “Installing Windows dependencies with vcpkg”. Then open a Visual Studio Native Tools Command Prompt for the target architecture (x64 for the default build).
For Visual Studio 2022, you can create Windows shortcuts with the
following Target values (each on a single line).
These examples use the default Community edition installation path;
adjust the path to VsDevCmd.bat for your edition
and installation location.
Use this shortcut for BARCH=x64:
%comspec% /k ""C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd.bat" -arch=amd64 -host_arch=amd64"
Use this shortcut for BARCH=x86:
%comspec% /k ""C:\Program Files\Microsoft Visual Studio\2022\Community\Common7\Tools\VsDevCmd.bat" -arch=x86 -host_arch=x86"
%comspec% starts the Windows command interpreter,
and /k keeps it open after initializing the build
environment. The -arch option selects the target
architecture (amd64 means x64), while
-host_arch selects the architecture of the compiler
tools. See Microsoft's
Developer Command Prompt documentation
for more details.
In the chosen command prompt, switch to the subdirectory
win where the file makefile
is located. Customize the installation by editing the
makefile file (for example by using notepad).
The following summarizes the most important settings in that file:
BARCH
Target architecture: x64 for a 64-bit build,
or x86 for a 32-bit build. Unless explicitly
set, this is taken from the Visual Studio environment variable
VSCMD_ARG_TGT_ARCH, falling back to
x64 if that variable is not defined.
There is normally no need to set BARCH when
using a Native Tools Command Prompt for the target architecture.
The compiler environment and dependency libraries must match
this architecture.
The default dependency paths use
$(BARCH)-windows to select the vcpkg triplet.
DEBUGIf set to 1, the software is compiled with debugging libraries (code generation is multi-threaded debug DLL). If set to 0, the software is compiled with release libraries (code generation is multi-threaded DLL).
HAVE_TCL, TCL
If HAVE_TCL is set to 1, nmake will
use the ASN.1 compiler (Tcl based).
You must set TCL to the full path of the Tcl
interpreter. A Windows version of Tcl is part of
Git for Windows.
If you do not have Tcl installed, set
HAVE_TCL to 0.
HAVE_BISON,
BISON
If GNU Bison is present, you might set HAVE_BISON
to 1 and specify the Bison executable in BISON.
Bison is only required if you use the Git version of
YAZ or if you modify the grammar for CQL
(cql.y).
On Windows, download the binary ZIP archive from the
winflexbison
releases and extract it, for example to
C:\winflexbison. Add the extracted directory
to PATH; win\makefile
defaults to HAVE_BISON=1 and
BISON=win_bison.
Alternatively, set BISON to the full executable
path in the makefile:
BISON=C:\winflexbison\win_bison.exeQuote the executable path if it contains spaces.
When building a source release with the generated CQL parser
already included, set HAVE_BISON=0 if Bison
is not installed and you have not modified
cql.y.
HAVE_ICONV,
ICONV_DIR
If HAVE_ICONV is set to 1, YAZ is compiled
with iconv support. In this configuration, set
ICONV_DIR to the vcpkg installation prefix,
for example C:\vcpkg\installed\x64-windows.
HAVE_LIBXML2,
LIBXML2_DIR
If HAVE_LIBXML2 is set to 1, YAZ is compiled
with SRU support. In this configuration, set
LIBXML2_DIR to the
vcpkg installation prefix containing
libxml2, for example
C:\vcpkg\installed\x64-windows.
HAVE_LIBXSLT,
LIBXSLT_DIR
If HAVE_LIBXSLT is set to 1, YAZ is compiled
with XSLT support. In this configuration, set
LIBXSLT_DIR to the
vcpkg installation prefix containing
libxslt, for example
C:\vcpkg\installed\x64-windows.
libxslt depends on libxml2.
HAVE_ICU,
ICU_BASE, ICU_VER
If HAVE_ICU is set to 1, YAZ is compiled
with ICU support.
Set ICU_BASE to the vcpkg installation prefix,
for example C:\vcpkg\installed\x64-windows.
ICU_INCLUDE, ICU_LIB and
ICU_BIN default to its
include, lib and
bin subdirectories.
Set ICU_VER to the version suffix of the
installed ICU DLLs. For example, icuuc78.dll
requires ICU_VER=78. Check this setting when
installing or updating ICU with vcpkg.
When satisfied with the settings in the makefile, type
nmake
If the nmake command is not found on your system
you probably haven't defined the environment variables required to
use that tool. Open a Native Tools Command Prompt or one of the
shortcuts above for the target architecture, then run
nmake from the win
subdirectory in that prompt.
If you wish to recompile YAZ - for example if you modify
settings in the makefile you can delete
object files, etc by running.
nmake clean
The following files are generated upon successful compilation:
bin/yaz5.dll /
bin/yaz5d.dllYAZ Release/Debug DLL.
lib/yaz5.lib /
lib/yaz5d.lib
Import library for yaz5.dll /
yaz5d.dll.
bin/yaz_cond5.dll /
bin/yaz_cond5d.dllRelease/Debug DLL for condition variable utilities (condvar.c).
lib/yaz_cond5.lib /
lib/yaz_cond5d.lib
Import library for yaz_cond5.dll /
yaz_cond5d.dll.
bin/yaz_icu5.dll /
bin/yaz_icu5d.dllRelease/Debug DLL for the ICU wrapper utility. Only build if HAVE_ICU is 1.
lib/yaz_icu5.lib /
lib/yaz_icu5d.lib
Import library for yaz_icu5.dll /
yaz_icu5d.dll.
bin/yaz-ztest.exeZ39.50 multi-threaded test/example server. It's a WIN32 console application.
bin/yaz-client.exeYAZ Z39.50 client application. It's a WIN32 console application. See chapter YAZ client for more information.
bin/yaz-icu.exeThis program exposes the ICU wrapper library if that is enabled for YAZ. Only if ICU is available this program is built.
bin/zoomsh.exeSimple console application implemented on top of the ZOOM functions. The application is a command line shell that allows you to enter simple commands to perform ZOOM operations.
bin/zoomtst1.exe,
bin/zoomtst2.exe, ..Several small applications that demonstrate the ZOOM API.
This section will go though the process of linking your Windows applications with YAZ.
Some people are confused by the fact that we use the nmake tool to build YAZ. They think they have to do that too - in order to make their Windows applications work with YAZ. The good news is that you don't have to. You can use the integrated environment of Visual Studio if desired for your own application.
When setting up a project or Makefile you have to set the following:
Set it to the include directory of YAZ.
yaz5.lib
You must link with this library. It's located in the
sub directory lib of YAZ.
If you want to link with the debug version of YAZ, you must
link against yaz5d.lib instead.
yaz5.dll
This DLL must be in your execution path when you invoke your application. Specifically, you should distribute this DLL with your application.
The Windows makefile uses libraries installed with
vcpkg
in classic mode. Install Visual Studio with the
Desktop development with C++ workload (including
the Windows SDK), and install
Git for Windows.
The following commands are for a Windows command prompt and install
vcpkg in C:\vcpkg, matching the makefile defaults:
git clone https://github.com/microsoft/vcpkg.git C:\vcpkg
cd /d C:\vcpkg
bootstrap-vcpkg.bat
Install libxml2, libxslt, iconv and ICU for the default 64-bit build:
vcpkg install libxml2:x64-windows libxslt:x64-windows libiconv:x64-windows icu:x64-windows
vcpkg builds and installs these libraries and their dependencies.
The x64-windows triplet selects 64-bit DLLs,
as required by the makefile. Headers, import libraries and runtime
DLLs are installed under
C:\vcpkg\installed\x64-windows.
In win\makefile, keep
HAVE_LIBXML2, HAVE_LIBXSLT,
HAVE_ICONV and HAVE_ICU set to 1
to enable these libraries. If you installed vcpkg elsewhere, adjust
LIBXML2_DIR, LIBXSLT_DIR,
ICONV_DIR and ICU_BASE to the
corresponding installed triplet directory. Check that
ICU_VER matches the installed ICU DLL names.
The makefile reads these paths directly; running
vcpkg integrate install is not required for NMAKE.
Open an x64 Native Tools Command Prompt for Visual Studio, change to
the win directory in the YAZ source tree,
and build with:
nmake
The makefile selects BARCH=x64 from the Visual
Studio environment and builds in release mode by default.
It copies the dependency DLLs it names from the vcpkg
bin directory to YAZ's
bin directory.
For a 32-bit build, install the same packages with
:x86-windows instead of
:x64-windows, and run the same build command from
an x86 Native Tools Command Prompt. The makefile selects
BARCH=x86 from that environment, and the default
dependency paths then select
C:\vcpkg\installed\x86-windows.