Skip to content

Move from C++ <format> to fmt #510

@BlakeFreer

Description

@BlakeFreer

C++20 introduced the <format> library to help print values nicely. We switched to it in #368. Unfortunately, the default macOS C++ compiler does not support it. There are workarounds (installing a GCC compiler and aliasing it to replace Clang) but this can be difficult, hard to remember, and overall unportable.

@ManushPatell found a 3rd party formatting library call fmt which is compatible with GCC, Clang, and only requires C++11.

Task

  1. Add fmt to all project's common.lib_deps section in their platformio.ini file.

    See https://registry.platformio.org/libraries/fmtlib/fmt

    Look at how we include Embedded Template Library in the libdeps section. The line for fmt should look something like this

  2. Replace all uses of <format> in the repository with the equivalent fmt call.

  3. Have someone with a Mac try to build the projects (there's no reason it shouldn't work, but let's make sure)

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions