nvmesensor: Introduce nvme-mi-mctp build feature
Allow MCTP support to be configured at build time.
Signed-off-by: Andrew Jeffery <andrew@aj.id.au>
Change-Id: I280337fce81a24c47bdb3b86279f2664ba80b380
diff --git a/src/NVMeSensorMain.cpp b/src/NVMeSensorMain.cpp
index f1254cb..9c44dee 100644
--- a/src/NVMeSensorMain.cpp
+++ b/src/NVMeSensorMain.cpp
@@ -129,7 +129,11 @@
}
else
{
+#if HAVE_NVME_MI_MCTP
context = std::make_shared<NVMeMCTPContext>(io, rootBus);
+#else
+ context = std::make_shared<NVMeBasicContext>(io, rootBus);
+#endif
nvmeDeviceMap[rootBus] = context;
}
@@ -154,7 +158,9 @@
auto systemBus = std::make_shared<sdbusplus::asio::connection>(io);
systemBus->request_name("xyz.openbmc_project.NVMeSensor");
sdbusplus::asio::object_server objectServer(systemBus);
+#if HAVE_NVME_MI_MCTP
nvmeMCTP::init();
+#endif
io.post([&]() { createSensors(io, objectServer, systemBus); });