TinyMAT
a library to write Matlab MAT-files
Loading...
Searching...
No Matches
Build Instructions

This page explains how to build TinyMAT.

Build using CMake

Running a Build with CMake

The preferred way to build TinyMAT 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" "-DCMAKE_PREFIX_PATH=<path_to_your_qt_sources>" -DTinyMAT_QT_SUPPORT=ON -DTinyMAT_OPENCV_SUPPORT=ON -DBUILD_SHARED_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" "-DCMAKE_PREFIX_PATH=<path_to_your_qt_sources>" -DTinyMAT_QT5_SUPPORT=ON -DTinyMAT_OPENCV_SUPPORT=ON -DTinyMAT_BUILD_SHARED_LIBS=ON -DTinyMAT_BUILD_STATIC_LIBS=ON

Where <path_to_your_qt_sources> could be e.g. C:/development/Qt5/5.12.0/msvc2017_64 . This call results in a Visual Studio solution build/TinyMAT.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
  • BUILD_SHARED_LIBS : Build as static library (default: OFF )
  • TinyMAT_BUILD_DECORATE_LIBNAMES_WITH_BUILDTYPE : If set, the build-type is appended to the library name (default: ON )
  • TinyMAT_QT_SUPPORT : build with support for Qt5/6 datatypes ... you'll need to make sure that Qt5/6 can be found on your system, e.g. by providing CMAKE_PREFIX_PATH= <path_to_your_qt_sources>
  • TinyMAT_OPENCV_SUPPORT : enables support for OpenCV ... you'll need to make sure that Open can be found on your system, e.g. by providing CMAKE_PREFIX_PATH= <path_to_your_opencv_sources>
  • TinyMAT_BUILD_EXAMPLES : Build examples (default: ON )
  • CMAKE_INSTALL_PREFIX : Install directory for the library