Add a compiler flag to enable terminus locator PDR

Tested:
Tested on a machine to make sure that the PDR is not present when
it is disabled.

Google-Bug-Id: 423027264
Change-Id: Ica0ceb28d02e9996c8ad4f2dba32f25ebf36df48
Signed-off-by: Kasun Athukorala <kasunath@google.com>
diff --git a/libpldmresponder/platform.cpp b/libpldmresponder/platform.cpp
index d6082af..22bb307 100644
--- a/libpldmresponder/platform.cpp
+++ b/libpldmresponder/platform.cpp
@@ -188,7 +188,9 @@
 
     if (!pdrCreated)
     {
+#ifdef GENERATE_TERMINUS_LOCATOR_PDR
         generateTerminusLocatorPDR(pdrRepo);
+#endif
         if (platformConfigHandler)
         {
             auto systemType = platformConfigHandler->getPlatformName();
diff --git a/libpldmresponder/platform.hpp b/libpldmresponder/platform.hpp
index 6f85f66..a1a206f 100644
--- a/libpldmresponder/platform.hpp
+++ b/libpldmresponder/platform.hpp
@@ -68,7 +68,9 @@
     {
         if (!buildPDRLazily)
         {
+#ifdef GENERATE_TERMINUS_LOCATOR_PDR
             generateTerminusLocatorPDR(pdrRepo);
+#endif
             generate(*dBusIntf, pdrJsonsDir, pdrRepo);
             pdrCreated = true;
         }
diff --git a/meson.build b/meson.build
index 6fa74c7..61c0c4f 100644
--- a/meson.build
+++ b/meson.build
@@ -43,6 +43,9 @@
 if cpp.has_header('poll.h')
     conf_data.set('PLDM_HAS_POLL', 1)
 endif
+if get_option('generate-terminus-locator-pdr').allowed()
+    add_project_arguments('-DGENERATE_TERMINUS_LOCATOR_PDR', language: 'cpp')
+endif
 if get_option('libpldmresponder').allowed()
     conf_data.set_quoted('BIOS_JSONS_DIR', join_paths(package_datadir, 'bios'))
     conf_data.set(
diff --git a/meson.options b/meson.options
index bd51f70..e689ba7 100644
--- a/meson.options
+++ b/meson.options
@@ -223,3 +223,10 @@
                     `GetSensorReading` if the sensor need to be updated.''',
     value: 249,
 )
+
+option(
+    'generate-terminus-locator-pdr',
+    type: 'feature',
+    value: 'enabled',
+    description: 'Enable generating terminus locator pdr',
+)