meson: Specify OEM extensions in an array
Prevent a proliferation of options by exploiting choice-constrained
arrays.
Change-Id: I5bb5c9bfd41d2854fafee189734abcf58b058d82
Signed-off-by: Andrew Jeffery <andrew@codeconstruct.com.au>
diff --git a/CHANGELOG.md b/CHANGELOG.md
index d273229..6b26a03 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -32,6 +32,11 @@
The prototype for `decode_query_downstream_identifiers_resp()` was updated to
improve ergonomics for the iterator APIs.
+3. meson: Specify OEM extensions in an array
+
+ `include/libpldm/meson.build` is modified, but not in ways that are
+ significant.
+
### Fixed
1. dsp: platform: Fix location of closing paren in overflow detection
diff --git a/README.md b/README.md
index 3424e9c..9b18c86 100644
--- a/README.md
+++ b/README.md
@@ -212,6 +212,6 @@
For consistency would recommend using "oem-<oem_name>".
-The `meson.build` and the corresponding source file(s) will need to incorporate
-the logic of adding its mapped compiler flag to allow conditional compilation of
-the code.
+Finally, the OEM name must be added to the list of choices for the `oem` meson
+option, and the `meson.build` files updated throughout the tree to guard
+integration of the OEM extensions.
diff --git a/include/libpldm/meson.build b/include/libpldm/meson.build
index e11bb4c..9dff827 100644
--- a/include/libpldm/meson.build
+++ b/include/libpldm/meson.build
@@ -20,7 +20,7 @@
'utils.h',
)
-if get_option('oem-ibm').allowed()
+if get_option('oem').contains('ibm')
libpldm_headers += files(
'oem/ibm/entity.h',
'oem/ibm/file_io.h',
@@ -31,7 +31,7 @@
)
endif
-if get_option('oem-meta').allowed()
+if get_option('oem').contains('meta')
libpldm_headers += files('oem/meta/file_io.h')
endif
diff --git a/meson.options b/meson.options
index 9bec992..dcd63d0 100644
--- a/meson.options
+++ b/meson.options
@@ -1,5 +1,4 @@
option('abi', type: 'array', description: 'Constrain exposed symbol classes', choices: ['deprecated', 'stable', 'testing'], value: ['deprecated', 'stable', 'testing'])
option('abi-compliance-check', type: 'feature', description: 'Detect public ABI/API changes')
-option('oem-ibm', type: 'feature', description: 'Enable IBM OEM PLDM')
-option('oem-meta', type: 'feature', description: 'Enable Meta OEM PLDM')
+option('oem', type: 'array', description: 'Enable OEM PLDM extensions', choices: ['ibm', 'meta'], value: ['ibm', 'meta'])
option('tests', type: 'feature', description: 'Build tests')
diff --git a/src/meson.build b/src/meson.build
index a4c8609..aa224f4 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -4,11 +4,11 @@
subdir('requester')
subdir('transport')
-if get_option('oem-ibm').allowed()
+if get_option('oem').contains('ibm')
subdir('oem/ibm')
endif
-if get_option('oem-meta').allowed()
+if get_option('oem').contains('meta')
subdir('oem/meta')
endif
diff --git a/tests/meson.build b/tests/meson.build
index a32cf8d..e85e1ba 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -24,11 +24,11 @@
subdir('transport')
endif
-if get_option('oem-ibm').allowed()
+if get_option('oem').contains('ibm')
subdir('oem/ibm')
endif
-if get_option('oem-meta').allowed()
+if get_option('oem').contains('meta')
subdir('oem/meta')
endif