From 483eb2f56657e8e7f419ab1a4fab8dce9ade8609 Mon Sep 17 00:00:00 2001 From: Daniel Baumann Date: Sat, 27 Apr 2024 20:24:20 +0200 Subject: Adding upstream version 14.2.21. Signed-off-by: Daniel Baumann --- src/seastar/fmt/doc/usage.rst | 123 ++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 123 insertions(+) create mode 100644 src/seastar/fmt/doc/usage.rst (limited to 'src/seastar/fmt/doc/usage.rst') diff --git a/src/seastar/fmt/doc/usage.rst b/src/seastar/fmt/doc/usage.rst new file mode 100644 index 00000000..e8894cfc --- /dev/null +++ b/src/seastar/fmt/doc/usage.rst @@ -0,0 +1,123 @@ +***** +Usage +***** + +To use the fmt library, add :file:`format.h` and :file:`format.cc` from +a `release archive `_ +or the `Git repository `_ to your project. +Alternatively, you can :ref:`build the library with CMake `. + +If you are using Visual C++ with precompiled headers, you might need to add +the line :: + + #include "stdafx.h" + +before other includes in :file:`format.cc`. + +.. _building: + +Building the library +==================== + +The included `CMake build script`__ can be used to build the fmt +library on a wide range of platforms. CMake is freely available for +download from http://www.cmake.org/download/. + +__ https://github.com/fmtlib/fmt/blob/master/CMakeLists.txt + +CMake works by generating native makefiles or project files that can +be used in the compiler environment of your choice. The typical +workflow starts with:: + + mkdir build # Create a directory to hold the build output. + cd build + cmake # Generate native build scripts. + +where :file:`{}` is a path to the ``fmt`` repository. + +If you are on a \*nix system, you should now see a Makefile in the +current directory. Now you can build the library by running :command:`make`. + +Once the library has been built you can invoke :command:`make test` to run +the tests. + +You can control generation of the make ``test`` target with the ``FMT_TEST`` +CMake option. This can be useful if you include fmt as a subdirectory in +your project but don't want to add fmt's tests to your ``test`` target. + +If you use Windows and have Visual Studio installed, a :file:`FORMAT.sln` +file and several :file:`.vcproj` files will be created. You can then build them +using Visual Studio or msbuild. + +On Mac OS X with Xcode installed, an :file:`.xcodeproj` file will be generated. + +To build a `shared library`__ set the ``BUILD_SHARED_LIBS`` CMake variable to +``TRUE``:: + + cmake -DBUILD_SHARED_LIBS=TRUE ... + +__ http://en.wikipedia.org/wiki/Library_%28computing%29#Shared_libraries + +Header-only usage with CMake +============================ + +You can add the ``fmt`` library directory into your project and include it in +your ``CMakeLists.txt`` file:: + + add_subdirectory(fmt) + +or + +:: + + add_subdirectory(fmt EXCLUDE_FROM_ALL) + +to exclude it from ``make``, ``make all``, or ``cmake --build .``. + +You can detect and use an installed version of {fmt} as follows:: + + find_package(fmt) + target_link_libraries( fmt::fmt) + +Setting up your target to use a header-only version of ``fmt`` is equaly easy:: + + target_link_libraries( PRIVATE fmt-header-only) + +Building the documentation +========================== + +To build the documentation you need the following software installed on your +system: + +* `Python `_ with pip and virtualenv +* `Doxygen `_ +* `Less `_ with ``less-plugin-clean-css``. + Ubuntu doesn't package the ``clean-css`` plugin so you should use ``npm`` + instead of ``apt`` to install both ``less`` and the plugin:: + + sudo npm install -g less less-plugin-clean-css. + +First generate makefiles or project files using CMake as described in +the previous section. Then compile the ``doc`` target/project, for example:: + + make doc + +This will generate the HTML documentation in ``doc/html``. + +Android NDK +=========== + +fmt provides `Android.mk file`__ that can be used to build the library +with `Android NDK `_. +For an example of using fmt with Android NDK, see the +`android-ndk-example `_ +repository. + +__ https://github.com/fmtlib/fmt/blob/master/Android.mk + +Homebrew +======== + +fmt can be installed on OS X using `Homebrew `_:: + + brew install fmt -- cgit v1.2.3