From cc9947bd8b476f5efa740959887c8e6a0a7882b9 Mon Sep 17 00:00:00 2001 From: Mateusz Pusz Date: Fri, 12 Jan 2024 14:18:57 +0100 Subject: [PATCH] refactor: :boom: `MP_UNITS_USE_LIBFMT` renamed to `MP_UNITS_USE_FMTLIB` --- conanfile.py | 2 +- .../getting_started/installation_and_usage.md | 20 +++++++++---------- .../use_cases/wide_compatibility.md | 2 +- src/CMakeLists.txt | 4 ++-- src/core/CMakeLists.txt | 4 ++-- .../include/mp-units/bits/external/hacks.h | 6 +++--- src/mp-unitsConfig.cmake | 2 +- test_package/CMakeLists.txt | 2 +- test_package/conanfile.py | 2 +- 9 files changed, 22 insertions(+), 22 deletions(-) diff --git a/conanfile.py b/conanfile.py index 40df3a0e..b2a8938a 100644 --- a/conanfile.py +++ b/conanfile.py @@ -146,7 +146,7 @@ class MPUnitsConan(ConanFile): tc.variables["CMAKE_CXX_SCAN_FOR_MODULES"] = True tc.variables["MP_UNITS_BUILD_CXX_MODULES"] = True tc.variables["MP_UNITS_BUILD_LA"] = self._build_all and not self._skip_la - tc.variables["MP_UNITS_USE_LIBFMT"] = self._use_libfmt + tc.variables["MP_UNITS_USE_FMTLIB"] = self._use_libfmt tc.generate() deps = CMakeDeps(self) deps.generate() diff --git a/docs/getting_started/installation_and_usage.md b/docs/getting_started/installation_and_usage.md index b2c820a4..c8c3730d 100644 --- a/docs/getting_started/installation_and_usage.md +++ b/docs/getting_started/installation_and_usage.md @@ -221,6 +221,16 @@ tools.build:compiler_executables={"c": "gcc-12", "cpp": "g++-12"} [build_cxx_modules support]: https://github.com/mpusz/mp-units/releases/tag/v2.2.0 +[`MP_UNITS_USE_FMTLIB`](#MP_UNITS_USE_FMTLIB){ #MP_UNITS_USE_FMTLIB } + +: [:octicons-tag-24: 2.2.0][use fmtlib support] · :octicons-milestone-24: `ON`/`OFF` (Default: `ON`) + + Forces usage of [{fmt}](https://github.com/fmtlib/fmt) library instead of the C++20 Standard + Library features. + + [use fmtlib support]: https://github.com/mpusz/mp-units/releases/tag/v2.2.0 + + [`MP_UNITS_AS_SYSTEM_HEADERS`](#MP_UNITS_AS_SYSTEM_HEADERS){ #MP_UNITS_AS_SYSTEM_HEADERS } : [:octicons-tag-24: 2.0.0][as system headers support] · :octicons-milestone-24: `ON`/`OFF` (Default: `OFF`) @@ -249,16 +259,6 @@ tools.build:compiler_executables={"c": "gcc-12", "cpp": "g++-12"} [iwyu support]: https://github.com/mpusz/mp-units/releases/tag/v2.0.0 -[`MP_UNITS_USE_LIBFMT`](#MP_UNITS_USE_LIBFMT){ #MP_UNITS_USE_LIBFMT } - -: [:octicons-tag-24: 2.0.0][use libfmt support] · :octicons-milestone-24: `ON`/`OFF` (Default: `ON`) - - Forces usage of [{fmt}](https://github.com/fmtlib/fmt) library instead of the C++20 Standard - Library features. - - [use libfmt support]: https://github.com/mpusz/mp-units/releases/tag/v2.0.0 - - ## CMake with presets support It is recommended to use at least CMake 3.23 to build this project as this version introduced support diff --git a/docs/users_guide/use_cases/wide_compatibility.md b/docs/users_guide/use_cases/wide_compatibility.md index 95cc054a..b995358c 100644 --- a/docs/users_guide/use_cases/wide_compatibility.md +++ b/docs/users_guide/use_cases/wide_compatibility.md @@ -155,5 +155,5 @@ use [fmtlib](https://github.com/fmtlib/fmt) as their primary formatting facility from additional features provided with the library). This macro resolves to either the `std` or `fmt` namespace, depending on the value of -[MP_UNITS_USE_LIBFMT](../../getting_started/installation_and_usage.md#MP_UNITS_USE_LIBFMT) +[MP_UNITS_USE_FMTLIB](../../getting_started/installation_and_usage.md#MP_UNITS_USE_FMTLIB) CMake option. diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt index 589cc9d5..1665b352 100644 --- a/src/CMakeLists.txt +++ b/src/CMakeLists.txt @@ -31,8 +31,8 @@ message(STATUS "${projectPrefix}BUILD_CXX_MODULES: ${${projectPrefix}BUILD_CXX_M option(${projectPrefix}AS_SYSTEM_HEADERS "Exports library as system headers" OFF) message(STATUS "${projectPrefix}AS_SYSTEM_HEADERS: ${${projectPrefix}AS_SYSTEM_HEADERS}") -option(${projectPrefix}USE_LIBFMT "Enables usage of libfmt instead of the one from 'std'" ON) -message(STATUS "${projectPrefix}USE_LIBFMT: ${${projectPrefix}USE_LIBFMT}") +option(${projectPrefix}USE_FMTLIB "Enables usage of fmtlib instead of the 'std::format' facilities" ON) +message(STATUS "${projectPrefix}USE_FMTLIB: ${${projectPrefix}USE_FMTLIB}") list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake") diff --git a/src/core/CMakeLists.txt b/src/core/CMakeLists.txt index 4044cd35..e4c2e96f 100644 --- a/src/core/CMakeLists.txt +++ b/src/core/CMakeLists.txt @@ -78,10 +78,10 @@ add_mp_units_module( ) target_compile_definitions( - mp-units-core ${${projectPrefix}TARGET_SCOPE} ${projectPrefix}USE_LIBFMT=$ + mp-units-core ${${projectPrefix}TARGET_SCOPE} ${projectPrefix}USE_FMTLIB=$ ) -if(${projectPrefix}USE_LIBFMT) +if(${projectPrefix}USE_FMTLIB) if(NOT TARGET fmt::fmt) find_package(fmt REQUIRED) endif() diff --git a/src/core/include/mp-units/bits/external/hacks.h b/src/core/include/mp-units/bits/external/hacks.h index 542ebcc6..b453aac6 100644 --- a/src/core/include/mp-units/bits/external/hacks.h +++ b/src/core/include/mp-units/bits/external/hacks.h @@ -100,11 +100,11 @@ #endif -#ifndef MP_UNITS_USE_LIBFMT -#define MP_UNITS_USE_LIBFMT 1 +#ifndef MP_UNITS_USE_FMTLIB +#define MP_UNITS_USE_FMTLIB 1 #endif -#if MP_UNITS_USE_LIBFMT +#if MP_UNITS_USE_FMTLIB MP_UNITS_DIAGNOSTIC_PUSH MP_UNITS_DIAGNOSTIC_IGNORE_UNREACHABLE diff --git a/src/mp-unitsConfig.cmake b/src/mp-unitsConfig.cmake index 519b180b..084bd61d 100644 --- a/src/mp-unitsConfig.cmake +++ b/src/mp-unitsConfig.cmake @@ -22,7 +22,7 @@ include(CMakeFindDependencyMacro) -if(MP_UNITS_USE_LIBFMT) +if(MP_UNITS_USE_FMTLIB) find_dependency(fmt) endif() diff --git a/test_package/CMakeLists.txt b/test_package/CMakeLists.txt index e19fe46d..22640892 100644 --- a/test_package/CMakeLists.txt +++ b/test_package/CMakeLists.txt @@ -27,4 +27,4 @@ find_package(mp-units REQUIRED) add_executable(test_package test_package.cpp) target_link_libraries(test_package PRIVATE mp-units::mp-units) -target_compile_definitions(test_package PRIVATE MP_UNITS_USE_LIBFMT=$) +target_compile_definitions(test_package PRIVATE MP_UNITS_USE_FMTLIB=$) diff --git a/test_package/conanfile.py b/test_package/conanfile.py index 83eae228..0a870a02 100644 --- a/test_package/conanfile.py +++ b/test_package/conanfile.py @@ -47,7 +47,7 @@ class TestPackageConan(ConanFile): def generate(self): tc = CMakeToolchain(self) - tc.variables["MP_UNITS_USE_LIBFMT"] = self._use_libfmt + tc.variables["MP_UNITS_USE_FMTLIB"] = self._use_libfmt tc.generate() def build(self):