Skip to content

Commit 105bee2

Browse files
committed
Port away from fmt to std::format
1 parent 98fac6a commit 105bee2

File tree

3 files changed

+6
-12
lines changed

3 files changed

+6
-12
lines changed

CMakeLists.txt

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -16,18 +16,11 @@ set(GCOV_TOOL "gcov" CACHE STRING "Path to gcov tool used by coverage.")
1616
find_package(Fcitx5Core ${REQUIRED_FCITX_VERSION} REQUIRED)
1717
find_package(Fcitx5Module REQUIRED COMPONENTS TestFrontend)
1818
find_package(Gettext REQUIRED)
19-
find_package(fmt REQUIRED)
2019
find_package(PkgConfig REQUIRED)
2120
pkg_check_modules(M17NGui IMPORTED_TARGET "m17n-gui>=1.6.3" REQUIRED)
2221
# Required for data and testing
2322
pkg_check_modules(M17NDB "m17n-db" REQUIRED)
2423

25-
if (TARGET fmt::fmt-header-only)
26-
set(FMT_TARGET fmt::fmt-header-only)
27-
else()
28-
set(FMT_TARGET fmt::fmt)
29-
endif ()
30-
3124
include("${FCITX_INSTALL_CMAKECONFIG_DIR}/Fcitx5Utils/Fcitx5CompilerSettings.cmake")
3225
add_definitions(-DFCITX_GETTEXT_DOMAIN=\"fcitx5-m17n\" -D_GNU_SOURCE)
3326
fcitx5_add_i18n_definition()

im/CMakeLists.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@ set(fcitx_m17n_sources
55
)
66

77
add_fcitx5_addon(m17n ${fcitx_m17n_sources})
8-
target_link_libraries(m17n Fcitx5::Core Fcitx5::Config ${FMT_TARGET} PkgConfig::M17NGui)
8+
target_link_libraries(m17n Fcitx5::Core Fcitx5::Config PkgConfig::M17NGui)
99
target_include_directories(m17n PRIVATE ${PROJECT_BINARY_DIR})
1010
set_target_properties(m17n PROPERTIES PREFIX "")
1111
install(TARGETS m17n DESTINATION "${CMAKE_INSTALL_LIBDIR}/fcitx5")

im/engine.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
#include <fcitx/text.h>
3333
#include <fcitx/userinterface.h>
3434
#include <fcntl.h>
35-
#include <fmt/format.h>
35+
#include <format>
3636
#include <m17n-core.h>
3737
#include <m17n.h>
3838
#include <memory>
@@ -348,9 +348,10 @@ std::vector<InputMethodEntry> M17NEngine::listInputMethods() {
348348

349349
std::string iconName;
350350
auto uniqueName = stringutils::concat("m17n_", lang, "_", name);
351-
auto fxName = fmt::format(
352-
_("{0} (M17N)"),
353-
(item && item->i18nName.size()) ? _(item->i18nName) : name);
351+
const std::string i18nname =
352+
(item && item->i18nName.size()) ? _(item->i18nName) : name;
353+
auto fxName =
354+
std::vformat(_("{0} (M17N)"), std::make_format_args(i18nname));
354355

355356
info = minput_get_title_icon(mlang, mname);
356357
// head of info is a MText

0 commit comments

Comments
 (0)