Building Third Party Support Libraries for DCMTK

The DCMTK Support Libraries project is a collection of (mainly) CMake scripts to ease the creation of various third party libraries used by DCMTK.

Note

The project is currently limited to building the libraries for Windows using Microsoft Visual Studio, which is also its main purpose since building the libraries with other compilers is typically straight forward and does not require these complex scripts.

Libraries and Versions

The scripts are modular and (in theory) allow downloading and building any library in any version. The top level CMakeLists.txt contains build instructions for the following libraries in the following versions:

Library Version Dowload URI Hash  
zlib 1.2.11 http://www.zlib.net/zlib-1.2.11.tar.gz SHA256: c3e5e9fdd5004dcb542feda5ee4f0ff0744628baf8ed2dd5d66f8ca1197cb1a1
libpng 1.6.35 https://sourceforge.net/projects/libpng/files/libpng16/1.6.35/libpng-1.6.35.tar.gz/download SHA256: 2b82ab3e996803b80bc73206857e826a155d3ebb374e8eb03a87a63c6f672cf7
libtiff 4.0.10 https://download.osgeo.org/libtiff/tiff-4.0.10.tar.gz SHA256: 2c52d11ccaf767457db0c46795d9c7d1a8d8f76f68b0b800a3dfe45786b996e4
libiconv 1.15 https://ftp.gnu.org/pub/gnu/libiconv/libiconv-1.15.tar.gz MD5: ace8b5f2db42f7b3b3057585e80d9808
libxml2 2.9.7 ftp://xmlsoft.org/libxml2/libxml2-2.9.7.tar.gz SHA256: f63c5e7d30362ed28b38bfa1ac6313f9a80230720b7fb6c80575eeab3ff5900c
openssl 1.1.1 https://www.openssl.org/source/openssl-1.1.1.tar.gz SHA256: 2836875a0f89c03d0fdf483941512613a50cfb421d6fd94b9f41d7279d586a3d

Prerequisites

The project requires several tools to be installed:

The tools must be setup correctly and in the search paths, and/or it might become necessary to set certain CMake Cache Variables to point CMake to the required tools and files.

Building the Libraries

The easiest way to use the scripts is to open the CMake GUI, select the project source directory as the source code folder and chose an appropriately named build directory (e.g. msvc14 when building with Visual Studio 2015) before hitting Configure. This is assuming that all required tools have been installed on the system, as described in the prior section.

After ensuring all requirements were set up correctly, you may start the build process as you would do for a normal CMake project.

Adjusting Library Versions

You may optionally adjust several CMake cache variables of the format <LIBRARY>_URL, <LIBRARY>_VERSION and <LIBRARY>_HASH, e.g. ZLIB_URL, ZLIB_VERSION and ZLIB_HASH to download and build a different version of the zlib library. If everything is to your linking hit Configure and Generate.

Building with the Visual Studio GUI

You may now open the created Visual Studio solution file in Visual Studio for building the libraries. The ALL_BUILD option will build all libraries in all configurations and create all appropriate .zip packages. This may take some time, so you may also just build individual libraries or just the MT package etc.

Building from the command line

You may also build the third party libraries from the command line using MSBuild or (probably easier) using the CMake Build Tool Mode cmake --build as a wrapper around MSBuild as described here.

CMake Module

The project is implemented mainly in two files, the top level CMakeLists.txt, which configures building the several libraries and a custom CMake Module:

You may use this module to add support for additional libraries to CMakeLists.txt.