This documents how to build and install libdistance on your computer.


In the following section, you are supposed to have fetched the libdistance sources and being located in its root directory:

git clone
cd libdistance

Installation from source

libdistance depends on cmake>=3.10 and arrayfire that you need to install:

  • cmake is widely distributed, on Ubuntu/Debian just have a sudo apt install cmake.

  • install arrayfire following those instructions.

Then compile and install libdistance:

mkdir -p build
cd build
cmake ..
make -j
make install


By default libdistance is installed to /usr/local on UNIX and c:/Program Files/libdistance on Windows. To install it in another directory use cmake -DCMAKE_INSTALL_PREFIX=<installation_path> ...

Run the tests (optional)

To build and run the tests you need the boost-test library. Specify the option BUILD_TEST=ON to cmake:

cd build
cmake -DBUILD_TEST=ON ..
make all -j
make test


To install the boost-test library

  • On Ubuntu/Debian: sudo apt install libboost-test-dev

  • On Fedora/CentOS: sudo yum install boost-test

  • On MacOS: brew install boost

  • On Windows: see here.

Build the documentation (optional)

To build a local version of the documentation (the one you are currently reading), you need python3 and doxygen. Specify the option BUILD_DOC=ON to cmake:

cd build
cmake -DBUILD_DOC=ON ..
make doc

The HTML documentation is now in libdistance/build/doc/html.


Doxygen is available on OS packages managers for Linux and MacOS. Install it with apt/yum/brew install doxygen. On Windows, a installer is available from here.