mitteLib
|
Nice C++17 goodies made in Mittelab
Repo: https://git.mittelab.org/proj/mittelib
Documentation: https://proj.mittelab.dev/mittelib/
PlatformIO lib: https://platformio.org/lib/show/12998/mitteLib
EspressIF component: https://components.espressif.com/components/mittelab/mittelib
This library aim at providing some handy, general purpose functionalities to embedded development. The C++ STL is rich but some functionalities (e.g. std::variant
) require features (e.g. CTTI) that are generally disabled on embedded platforms; other helper classes instead are common patterns when interoperating with C libraries. This was originally developed for ESP-IDF, in C++17, but it can be used on desktop too (functionalities have been ported). Among the added features, binary streams, enum-based variants, observer-pattern helper classes, string helpers, a simple logging facility like IDF's.
or in you idf_component.yml
:
In your idf_component.yml
:
This is somewhat awkward because the library is in the mittelib
subfolder, and the root CMakeLists.txt
is for tests and usage on desktop, and IDF expects to find a direct call to idf_component_register
in the CMakeLists.txt
file inside the component folder. So we have to create a "mittelib" component that includes the right files. Luckily (or intentionally) Mittelib is just a collection of cpp files, so this is easy.
components/mittelib
components/mittelib/thirdparty
(you can choose another name)components/mittelib/CMakeLists.txt
:This uses FetchContent to download the library. In a directory thirdparty/mittelib
(you can choose a different path), add a CMakeLists.txt
file that contains
In your project root CMakeLists.txt
, add
Assume you have added this repo as a submodule at thirdparty/mittelib
. In your project root CMakeList.txt
, add
This is correct, there is one extra "mittelib" subfolder.