libcommon is a collection of reusable C++ code shared by many C++ projects at CM4all GmbH.
The project was created when code duplication between C++ projects got out of hand. Commonly used code was moved into this library, instead of keeping several copies in sync.
The library is meant to be included in other projects as a git submodule. It is a lively and volatile project, which makes it hard to turn it into a shared library. Retaining ABI stability (which is very difficult with C++ anyway) would be too hard at this stage, and not worthwile.
You need:
- a C++20 compiler (GCC or clang)
- Meson 1.0
- libfmt
- libsystemd
- libdbus
- libcap
- libseccomp
- OpenSSL
Optional dependencies:
- Avahi
- libcurl
- libmariadb
- libpq
- libsodium
- liburing
- libwas
- LuaJit
- Nettle
- nlohmann_json
- PCRE
- GoogleTest
To build it, type:
meson . build ninja -C build
That produces several static libraries.
Each directory below src
contains a sub-library:
adata
: data structures using our pool allocatorco
: C++20 Coroutinesevent
: a non-blocking I/O event loopevent/net
: non-blocking networking librariesevent/systemd
: non-blocking systemd clientsevent/uring
: integration of io_uring in the event loophttp
: HTTP protocol definitions and helpersio
: file I/O utilitiesio/config
: a configuration file parserio/linux
: Linux-specific I/O helpersio/uring
: liburing C++ wrapperjwt
: helpers for JSON Web Tokenslib
: C++ wrappers or additional utilities for various external libraries.lua
: Lua C++ wrapperslua/event
: non-blocking Lualua/io
: I/O helpers for Lualua/json
: Lua JSON librarylua/mariadb
: Lua wrapper for libmariadblua/net
: networking helpers for Lualua/pg
: non-blocking PostgreSQL client for Lualua/sodium
: Lua wrappers for libsodiummemory
: memory allocatorsnet
: networking/socket utilitiespg
: libpq C++ wrappersspawn
: a process spawnerstock
: manage stocks of reusable objects (e.g. for connection pooling)system
: operating system utilitiesthread
: helpers for multi-threaded applicationstime
: dealing with date and timetranslation
: implementation of the CM4all translation protocoluri
: URI utilitiesutil
: generic utilitieswas
: helpers for libwaswas/async
: a non-blocking implementation of the Web Application Socket protocol
These directories contain C++ wrappers or additional utilities for external libraries:
lib/avahi
: Avahi C++ wrapperslib/cap
: libcap C++ wrapperslib/curl
: libcurl C++ wrapperslib/dbus
: libdbus C++ wrapperslib/fmt
: libfmt helperslib/mariadb
: C++ wrappers for the MariaDB client librarylib/nettle
: Nettle C++ wrapperslib/nlohmann_json
: nlohmann_json helperslib/openssl
: OpenSSL C++ wrapperslib/pcre
: PCRE C++ wrapperslib/sodium
: libsodium C++ wrapperslib/zlib
: zlib C++ wrappers
Special directories:
pluggable
: contains fallback implementations for modules that should be replaced by applications using libcommon