aboutsummaryrefslogtreecommitdiff
path: root/thirdparty/fmt/doc
diff options
context:
space:
mode:
Diffstat (limited to 'thirdparty/fmt/doc')
-rw-r--r--thirdparty/fmt/doc/api.md50
-rw-r--r--thirdparty/fmt/doc/syntax.md10
2 files changed, 56 insertions, 4 deletions
diff --git a/thirdparty/fmt/doc/api.md b/thirdparty/fmt/doc/api.md
index 2c584abc0..9fbc9f2fe 100644
--- a/thirdparty/fmt/doc/api.md
+++ b/thirdparty/fmt/doc/api.md
@@ -708,3 +708,53 @@ following differences:
`std::to_chars` which tries to generate the smallest number of characters
(ignoring redundant digits and sign in exponent) and may procude more
decimal digits than necessary.
+
+## Configuration Options
+
+{fmt} provides configuration via CMake options and preprocessor macros to
+enable or disable features and to optimize for binary size. For example, you
+can disable OS-specific APIs defined in `fmt/os.h` with `-DFMT_OS=OFF` when
+configuring CMake.
+
+### CMake Options
+
+- **`FMT_OS`**: When set to `OFF`, disables OS-specific APIs (`fmt/os.h`).
+- **`FMT_UNICODE`**: When set of `OFF`, disables Unicode support on
+ Windows/MSVC. Unicode support is always enabled on other platforms.
+
+### Macros
+
+- **`FMT_HEADER_ONLY`**: Enables the header-only mode when defined. It is an
+ alternative to using the `fmt::fmt-header-only` CMake target.
+ Default: not defined.
+
+- **`FMT_USE_EXCEPTIONS`**: Disables the use of exceptions when set to `0`.
+ Default: `1` (`0` if compiled with `-fno-exceptions`).
+
+- **`FMT_USE_LOCALE`**: When set to `0`, disables locale support.
+ Default: `1` (`0` when `FMT_OPTIMIZE_SIZE > 1`).
+
+- **`FMT_CUSTOM_ASSERT_FAIL`**: When set to `1`, allows users to provide a
+ custom `fmt::assert_fail` function which is called on assertion failures and,
+ if exceptions are disabled, on runtime errors. Default: `0`.
+
+- **`FMT_BUILTIN_TYPES`**: When set to `0`, disables built-in handling of
+ arithmetic and string types other than `int`. This reduces library size at
+ the cost of per-call overhead. Default: `1`.
+
+- **`FMT_OPTIMIZE_SIZE`**: Controls binary size optimizations:
+ - `0` - off (default)
+ - `1` - disables locale support and applies some optimizations
+ - `2` - disables some Unicode features, named arguments and applies more
+ aggresive optimizations
+
+### Binary Size Optimization
+
+To minimize the binary footprint of {fmt} as much as possible at the cost of
+some features, you can use the following configuration:
+
+- CMake options:
+ - `FMT_OS=OFF`
+- Macros:
+ - `FMT_BUILTIN_TYPES=0`
+ - `FMT_OPTIMIZE_SIZE=2`
diff --git a/thirdparty/fmt/doc/syntax.md b/thirdparty/fmt/doc/syntax.md
index 46d7d2fd2..ac5128233 100644
--- a/thirdparty/fmt/doc/syntax.md
+++ b/thirdparty/fmt/doc/syntax.md
@@ -251,7 +251,7 @@ The available integer presentation types are:
<td><code>'b'</code></td>
<td>
Binary format. Outputs the number in base 2. Using the <code>'#'</code>
- option with this type adds the prefix <code>"0b"</code> to the output value.
+ option with this type adds the prefix <code>"0b"</code> to the output value.
</td>
</tr>
<tr>
@@ -718,7 +718,7 @@ These modifiers are only supported for the `'H'`, `'I'`, `'M'`, `'S'`, `'U'`,
Format specifications for range types have the following syntax:
<pre><code class="language-json"
->range_format_spec ::= ["n"][range_type][range_underlying_spec]</code>
+>range_format_spec ::= ["n"][range_type][":" range_underlying_spec]</code>
</pre>
The `'n'` option formats the range without the opening and closing brackets.
@@ -761,14 +761,16 @@ fmt::print("{::}", std::vector{'h', 'e', 'l', 'l', 'o'});
// Output: [h, e, l, l, o]
fmt::print("{::d}", std::vector{'h', 'e', 'l', 'l', 'o'});
// Output: [104, 101, 108, 108, 111]
+fmt::print("{:n:f}", std::array{std::numbers::pi, std::numbers::e});
+// Output: 3.141593, 2.718282
```
## Format Examples
This section contains examples of the format syntax and comparison with
-the printf formatting.
+the `printf` formatting.
-In most of the cases the syntax is similar to the printf formatting,
+In most of the cases the syntax is similar to the `printf` formatting,
with the addition of the `{}` and with `:` used instead of `%`. For
example, `"%03.2f"` can be translated to `"{:03.2f}"`.