fmt: Remove fmtlib dependencies
Remove the remaining usage for the fmtlib.
Tested: working fine with the error messages.
Change-Id: I68dc70428a75706b2fc70e43f8da321d84f052cc
Signed-off-by: Willy Tu <wltu@google.com>
diff --git a/bifurcation/bifurcation_static.cpp b/bifurcation/bifurcation_static.cpp
index c4b0f89..75e94dd 100644
--- a/bifurcation/bifurcation_static.cpp
+++ b/bifurcation/bifurcation_static.cpp
@@ -15,9 +15,8 @@
#include "bifurcation.hpp"
-#include <fmt/format.h>
-
#include <nlohmann/json.hpp>
+#include <stdplus/print.hpp>
#include <charconv>
#include <filesystem>
@@ -50,8 +49,8 @@
std::ifstream jsonFile(bifurcationFile.c_str());
if (!jsonFile.is_open())
{
- fmt::print(stderr, "Unable to open file {} for bifurcation.\n",
- bifurcationFile.data());
+ stdplus::print(stderr, "Unable to open file {} for bifurcation.\n",
+ bifurcationFile.data());
return std::nullopt;
}
@@ -62,7 +61,7 @@
}
catch (const nlohmann::json::parse_error& ex)
{
- fmt::print(
+ stdplus::print(
stderr,
"Failed to parse the static config. Parse error at byte {}\n",
ex.byte);
@@ -78,8 +77,8 @@
}
catch (const std::exception& e)
{
- fmt::print(stderr,
- "Failed to convert bifurcation value to vec[uin8_t]\n");
+ stdplus::print(stderr,
+ "Failed to convert bifurcation value to vec[uin8_t]\n");
return std::nullopt;
}
diff --git a/bifurcation/meson.build b/bifurcation/meson.build
index d653099..5e1050d 100644
--- a/bifurcation/meson.build
+++ b/bifurcation/meson.build
@@ -1,7 +1,7 @@
bifurcation_inc = include_directories('.')
bifurcation_deps = [
- fmt_dep,
+ stdplus,
]
bifurcation_lib = static_library(
diff --git a/meson.build b/meson.build
index 407f257..62be177 100644
--- a/meson.build
+++ b/meson.build
@@ -34,30 +34,17 @@
'nlohmann::json',
dependencies: json_dep)
-fmt_dep = dependency('fmt', required: false)
-if not fmt_dep.found()
- fmt_proj = import('cmake').subproject(
- 'fmt',
- cmake_options: [
- '-DCMAKE_POSITION_INDEPENDENT_CODE=ON',
- '-DMASTER_PROJECT=OFF'
- ],
- required: false)
- assert(fmt_proj.found(), 'fmtlib is required')
- fmt_dep = fmt_proj.dependency('fmt')
-endif
-
+stdplus = dependency('stdplus')
subdir('bifurcation')
sys_pre = declare_dependency(
include_directories: root_inc,
dependencies: [
json_dep,
- fmt_dep,
dependency('phosphor-dbus-interfaces'),
dependency('phosphor-logging'),
dependency('sdbusplus'),
- dependency('stdplus'),
+ stdplus,
bifurcation_dep,
])
diff --git a/pcie_bifurcation.cpp b/pcie_bifurcation.cpp
index 4722853..19ac183 100644
--- a/pcie_bifurcation.cpp
+++ b/pcie_bifurcation.cpp
@@ -20,8 +20,6 @@
#include "errors.hpp"
#include "handler.hpp"
-#include <fmt/format.h>
-
#include <ipmid/api-types.hpp>
#include <stdplus/print.hpp>
@@ -49,8 +47,8 @@
{
if (data.size() < sizeof(struct PcieBifurcationRequest))
{
- fmt::print(stderr, "Invalid command length: {}\n",
- static_cast<uint32_t>(data.size()));
+ stdplus::print(stderr, "Invalid command length: {}\n",
+ static_cast<uint32_t>(data.size()));
return ::ipmi::responseReqDataLenInvalid();
}