TinyTIFF
a lightweight C/C++ library for reading and writing TIFF files
Loading...
Searching...
No Matches
Build Instructions

This page explains how to build TinyTIFF.

Build using CMake

Running a Build with CMake

The preferred way to build TinyTIFF is using CMake. You can find a detailed explanation of CMake at https://cliutils.gitlab.io/modern-cmake/. The CMake-build is defined in CMakeLists.txt files, found in many of the directories of the code repository. Especially in the root directory and the two subdirectories ./src/ and ./examples/ .

Building with MinGW/GNU/... Makefiles

You can use (MinGW) Makefiles by calling:

$ mkdir build
$ cd build
$ cmake .. -G "MinGW Makefiles" -DTinyTIFF_BUILD_SHARED_LIBS=ON -DTinyTIFF_BUILD_STATIC_LIBS=ON
$ cmake --build . --config "Debug"
$ cmake --build . --config "Debug" --target install

Note that we set several compiler options on the first run of cmake. The options are describe in detail below in Configuring a Build with CMake .

Building with Visual Studio

For Visual Studio it could look like this:

$ mkdir build
$ cd build
$ cmake .. -G "Visual Studio 15 2017 Win64" -DTinyTIFF_BUILD_SHARED_LIBS=ON -DTinyTIFF_BUILD_STATIC_LIBS=ON

This call results in a Visual Studio solution build/TinyTIFF.sln that you can load and compile from the Visual Studio IDE. Alternatively you can also build the solution directly calling:

$ cmake --build . --config "Debug"

Afterwards you can install the library by

$ cmake --build . --config "Debug" --target install

Configuring a Build with CMake

The CMake build system offers several configuration variables that you may set/change to modify the outcome of the build:

  • CMAKE_PREFIX_PATH : add the path to your Qt installatrion to this variable, so the find_package(Qt5...) commands find the libraries you want to use
  • TinyTIFF_BUILD_SHARED_LIBS : Build as shared library (default: ON )
  • TinyTIFF_BUILD_STATIC_LIBS : Build as static library (default: OFF )
  • TinyTIFF_BUILD_DECORATE_LIBNAMES_WITH_BUILDTYPE : If set, the build-type is appended to the library name (default: ON )
  • TinyTIFF_BUILD_EXAMPLES : Build examples (default: ON )
  • CMAKE_INSTALL_PREFIX : Install directory for the library