[reSIProcate] new dependency: fmt library
Daniel Pocock
daniel at pocock.pro
Mon Jul 5 05:37:06 CDT 2021
I've been looking at the fmt library
https://fmt.dev/
It is very similar to std::format in C++20. fmt works with C++11 so it
is suitable for reSIProcate on older systems. In future, it would be
very easy to convert code using fmt to use std::format.
In fact, std::format doesn't have the named arguments, but they do exist
in the standalone fmt library. This is one of the most useful features
for some of the things we do in reSIProcate. For example, we could use
it in these places:
- database query templates
- static route templates (repro)
- values from the config files (e.g. Log filename)
As a first attempt to use it, I tweaked reConServer to support two named
arguments in the log filename:
LogFilename = reConServer-test-{timestamp}-{pid}.log
Here is the commit:
https://github.com/resiprocate/resiprocate/commit/28486a601221721e7052bbc3a9fa43c25f5ddc5e
I could move this logic into the rutil/ConfigParse.cxx class so that all
config strings can use named arguments
Looking at versions on different Linux distributions, none of them have
the latest version of fmt 8.0.
https://src.fedoraproject.org/rpms/fmt
Fedora 34: 7.1.3
RHEL8 / EPEL8: 6.2.1
https://tracker.debian.org/pkg/fmtlib
Debian buster-backports: 6.1.2
Debian buster: 5.2.1
Based on the above, I decided to begin with 5.2.1 as it is the lowest
common denominator. I put a snapshot of 5.2.1 in contrib/fmt. If
anybody wants to compile against a newer version they can do so but I
feel it is important not to rely on features from new versions.
More information about the resiprocate-devel
mailing list