|
635 | 635 | </li> |
636 | 636 |
|
637 | 637 | <li class="md-nav__item"> |
638 | | - <a href="#compile-time-configuration" class="md-nav__link"> |
| 638 | + <a href="#configuration-options" class="md-nav__link"> |
639 | 639 | <span class="md-ellipsis"> |
640 | | - Compile-Time Configuration |
| 640 | + Configuration Options |
641 | 641 | </span> |
642 | 642 | </a> |
643 | 643 |
|
644 | | - <nav class="md-nav" aria-label="Compile-Time Configuration"> |
| 644 | + <nav class="md-nav" aria-label="Configuration Options"> |
645 | 645 | <ul class="md-nav__list"> |
646 | 646 |
|
647 | 647 | <li class="md-nav__item"> |
|
654 | 654 | </li> |
655 | 655 |
|
656 | 656 | <li class="md-nav__item"> |
657 | | - <a href="#size-optimization-recipe" class="md-nav__link"> |
| 657 | + <a href="#binary-size-optimization" class="md-nav__link"> |
658 | 658 | <span class="md-ellipsis"> |
659 | | - Size Optimization Recipe |
| 659 | + Binary Size Optimization |
660 | 660 | </span> |
661 | 661 | </a> |
662 | 662 |
|
@@ -1972,77 +1972,60 @@ <h2 id="compatibility-with-c20-stdformat">Compatibility with C++20 <code>std::fo |
1972 | 1972 | decimal digits than necessary.</p> |
1973 | 1973 | </li> |
1974 | 1974 | </ul> |
1975 | | -<h2 id="compile-time-configuration">Compile-Time Configuration</h2> |
1976 | | -<p>{fmt} provides configuration via CMake options and preprocessor macros to enable or disable features and to optimize for binary size. You can set CMake options when generating your build system (e.g. <code>-DFMT_OS=OFF</code>) and define macros or pass them to your compiler (e.g. <code>-DFMT_USE_EXCEPTIONS=0</code>).</p> |
| 1975 | +<h2 id="configuration-options">Configuration Options</h2> |
| 1976 | +<p>{fmt} provides configuration via CMake options and preprocessor macros to |
| 1977 | +enable or disable features and to optimize for binary size. For example, you |
| 1978 | +can disable OS-specific APIs defined in <code>fmt/os.h</code> with <code>-DFMT_OS=OFF</code> when |
| 1979 | +configuring CMake.</p> |
1977 | 1980 | <h3 id="available-options">Available Options</h3> |
1978 | | -<table> |
1979 | | -<thead> |
1980 | | -<tr> |
1981 | | -<th>Option</th> |
1982 | | -<th>Type</th> |
1983 | | -<th>Default</th> |
1984 | | -<th>Description</th> |
1985 | | -</tr> |
1986 | | -</thead> |
1987 | | -<tbody> |
1988 | | -<tr> |
1989 | | -<td>Header-Only Mode</td> |
1990 | | -<td>CMake target</td> |
1991 | | -<td><code>fmt::fmt</code></td> |
1992 | | -<td>Enable header-only usage by linking the <code>fmt::fmt-header-only</code> target.</td> |
1993 | | -</tr> |
1994 | | -<tr> |
1995 | | -<td><code>FMT_HEADER_ONLY</code></td> |
1996 | | -<td>0 / 1</td> |
1997 | | -<td>0</td> |
1998 | | -<td>Enables header-only mode when set to 1 (CMake target <code>fmt::fmt-header-only</code> defines it); disable with 0 for library mode.</td> |
1999 | | -</tr> |
2000 | | -<tr> |
2001 | | -<td><code>FMT_OS</code></td> |
2002 | | -<td>ON / OFF</td> |
2003 | | -<td>ON</td> |
2004 | | -<td>Enables OS-specific APIs (<code>fmt/os.h</code>); disable with OFF.</td> |
2005 | | -</tr> |
2006 | | -<tr> |
2007 | | -<td><code>FMT_UNICODE</code></td> |
2008 | | -<td>ON / OFF</td> |
2009 | | -<td>ON</td> |
2010 | | -<td>Enables Unicode support; disable with OFF.</td> |
2011 | | -</tr> |
2012 | | -<tr> |
2013 | | -<td><code>FMT_USE_EXCEPTIONS</code></td> |
2014 | | -<td>0 / 1</td> |
2015 | | -<td>1 (0 if compiled with <code>-fno-exceptions</code>)</td> |
2016 | | -<td>Enables exception-based error handling; disable with 0.</td> |
2017 | | -</tr> |
2018 | | -<tr> |
2019 | | -<td><code>FMT_BUILTIN_TYPES</code></td> |
2020 | | -<td>0 / 1</td> |
2021 | | -<td>1</td> |
2022 | | -<td>Enables built-in type formatters; disable with 0.</td> |
2023 | | -</tr> |
2024 | | -<tr> |
2025 | | -<td><code>FMT_OPTIMIZE_SIZE</code></td> |
2026 | | -<td>0 / 1 / 2</td> |
2027 | | -<td>0</td> |
2028 | | -<td>Controls size-optimized routines: 0 = off, 1 = size optimization, >1 = aggressive size optimization disabling format-string checks.</td> |
2029 | | -</tr> |
2030 | | -<tr> |
2031 | | -<td><code>FMT_USE_LOCALE</code></td> |
2032 | | -<td>0 / 1</td> |
2033 | | -<td>1 (0 when <code>FMT_OPTIMIZE_SIZE > 1</code>)</td> |
2034 | | -<td>Enables locale-dependent formatting; disable with 0.</td> |
2035 | | -</tr> |
2036 | | -<tr> |
2037 | | -<td><code>FMT_THROW(x)</code></td> |
2038 | | -<td>macro</td> |
2039 | | -<td><code>throw x</code> (or <code>abort</code>)</td> |
2040 | | -<td>Defines error handling via macro (not a toggle flag): if exceptions enabled, <code>throw x</code>; otherwise, <code>fmt::assert_fail(...)</code>.</td> |
2041 | | -</tr> |
2042 | | -</tbody> |
2043 | | -</table> |
2044 | | -<h3 id="size-optimization-recipe">Size Optimization Recipe</h3> |
2045 | | -<p>To minimize your binary footprint, use the following CMake configuration and compile definitions:</p> |
| 1981 | +<ul> |
| 1982 | +<li> |
| 1983 | +<p><strong><code>FMT_HEADER_ONLY</code></strong> |
| 1984 | + Default: <code>0</code> |
| 1985 | + Enables header-only mode when set to <code>1</code> (CMake target <code>fmt::fmt-header-only</code> |
| 1986 | + defines it); disable with <code>0</code> for library mode.</p> |
| 1987 | +</li> |
| 1988 | +<li> |
| 1989 | +<p><strong><code>FMT_OS</code></strong> |
| 1990 | + Default: <code>ON</code> |
| 1991 | + Enables OS-specific APIs (<code>fmt/os.h</code>); disable with <code>OFF</code>.</p> |
| 1992 | +</li> |
| 1993 | +<li> |
| 1994 | +<p><strong><code>FMT_UNICODE</code></strong> |
| 1995 | + Default: <code>ON</code> |
| 1996 | + Enables Unicode support; disable with <code>OFF</code>.</p> |
| 1997 | +</li> |
| 1998 | +<li> |
| 1999 | +<p><strong><code>FMT_USE_EXCEPTIONS</code></strong> |
| 2000 | + Default: <code>1</code> (<code>0</code> if compiled with <code>-fno-exceptions</code>) |
| 2001 | + Enables exception-based error handling; disable with <code>0</code>.</p> |
| 2002 | +</li> |
| 2003 | +<li> |
| 2004 | +<p><strong><code>FMT_BUILTIN_TYPES</code></strong> |
| 2005 | + Default: <code>1</code> |
| 2006 | + Enables built-in type formatters; disable with <code>0</code>.</p> |
| 2007 | +</li> |
| 2008 | +<li> |
| 2009 | +<p><strong><code>FMT_OPTIMIZE_SIZE</code></strong> |
| 2010 | + Default: <code>0</code> |
| 2011 | + Controls size-optimized routines: <code>0</code> = off, <code>1</code> = size optimization, <code>>1</code> = |
| 2012 | + aggressive size optimization disabling format-string checks.</p> |
| 2013 | +</li> |
| 2014 | +<li> |
| 2015 | +<p><strong><code>FMT_USE_LOCALE</code></strong> |
| 2016 | + Default: <code>1</code> (<code>0</code> when <code>FMT_OPTIMIZE_SIZE > 1</code>) |
| 2017 | + Enables locale-dependent formatting; disable with <code>0</code>.</p> |
| 2018 | +</li> |
| 2019 | +<li> |
| 2020 | +<p><strong><code>FMT_THROW(x)</code></strong> |
| 2021 | + Default: <code>throw x</code> (or <code>abort</code>) |
| 2022 | + Defines error handling via macro (not a toggle flag): if exceptions enabled, |
| 2023 | + <code>throw x</code>; otherwise, <code>fmt::assert_fail(...)</code>.</p> |
| 2024 | +</li> |
| 2025 | +</ul> |
| 2026 | +<h3 id="binary-size-optimization">Binary Size Optimization</h3> |
| 2027 | +<p>To minimize your binary footprint, use the following CMake configuration and |
| 2028 | +compile definitions:</p> |
2046 | 2029 | <pre><code class="language-cmake"># Link to the header-only target |
2047 | 2030 | target_link_libraries(${PROJECT_NAME} PRIVATE fmt::fmt-header-only) |
2048 | 2031 | # Disable OS-specific APIs |
|
0 commit comments