Installation

The library is written in C++20, and has the following requirements:

  • GCC (with G++ frontend), version >= 10.2.0,
  • libfmt, version >= 8.0.0
  • libpng-dev
  • libfreetype6-dev
  • libeigen3-dev, version >= 3.0.0

Installation of dependencies (Ubuntu)

Warning
This has been tested with Ubuntu version 22.04 (with previous versions, it may not work).

To install the required dependencies, you can use the following command:

sudo apt-get install gcc g++ make pkg-config libfmt-dev libeigen3-dev libpng-dev libfreetype6-dev

Installation of dependencies (Windows)

This has been tested with Windows 11 and MSYS2/MINGW64 environment.

  • Download and install the MSYS2 environnement, available at the following url: https://www.msys2.org/ (select the 64 bits version).
  • In the folder c:/msys64, launch the program "mingw64.exe"
  • In this terminal, execute the following command:

    pacman -Syu
    

  • Close the terminal, and open again another one (mingw64.exe)
  • In this terminal, execute the following command:

    pacman -S mingw-w64-x86_64-gcc mingw-w64-x86_64-gdb mingw-w64-x86_64-make mingw-w64-x86_64-pkg-config mingw-w64-x86_64-eigen3 mingw-w64-x86_64-fmt mingw-w64-x86_64-freetype mingw-w64-x86_64-libpng  make pkg-config
    

Compilation and installation

The process described below is the same for Windows or Linux.

In a terminal (standard terminal for Linux, MSYS terminal for windows), execute the following commands:

git clone tsdconseil/libtsd
cd libtsd
make -j 8
sudo make install

Once the library is installed, you can check the installation is sucessful by compiling an example. In the exemples folder, you can find an one (example.cc). To compile, use the following command:

cd libtsd/exemples
make

A file named example.exe should have been created (note that the .exe extension is here just for Windows system compatibity: it is here also in Linux, but useless). Then, you can run it:

./example.exe

A PNG image file with a plot should have been created: cosinus.png. You can reuse the compilation options from the Makefile in your own program (see section 'Using the library' below).

Compiling and running autotests

cd libtsd
make TESTS=1 -j 8
./build/debug/tests.exe

Using the library

The following compiling and linking options must be added to your makefile:

CXXFLAGS = -g -march=native -fPIC -std=c++2a `pkg-config --cflags eigen3` -I/usr/local/include
LDFLAGS  = -ltsd -lfreetype -lpng -lz -lfmt -L/usr/local/lib

Then, in your C++ file, just add the following line at the beginning:

#include <dsp/dsp-all.hpp>

The dsp, lien non trouvé : [namespacedsp_1_1fourier]dsp::fourier, dsp::view and dsp::filter namespaces are then made available.