Example of C++ project skeleton with Meson Build and Catch.
This project consists of:
- a library (let's name it
luuid
) - an executable
uuidgen
using thatluuid
- unit test executable for
luuid
and using Catch framework
This project was created as learning example for article: Choosing C++ stack
Both test frameworks are quite similar, you can check differencies here: https://github.com/onqtam/doctest/blob/master/doc/markdown/faq.md#how-is-doctest-different-from-catch
I've created project using both frameworks you can find them in corresponding branches: doctest branch and catch branch.
For now I will merge doctest branch to master, both are quite similar, but doctest is supposed to be lighter and faster.
meson build .
cd build
ninja
ninja test # to run unit tests
ninja test
ninja install
You can run it just with command uuidgen
.
DESTDIR=./install ninja install
Running uuidgen
is a little bit more difficult in this case because the installation directory might not belong to library path (LD_LIBRARY_PATH
).
export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./install/usr/local/lib
./install/usr/local/bin/uuidgen #path to installed binary