build: use allowed over enabled
Meson feature options are typically in a tri-state of enabled, disabled,
or auto. The enabled and disabled functions on an option (from
`get_option`) no longer return true for auto features. Instead, the
expectation is to use `allowed()` which is true for both enabled and auto.
Switch all uses of `enabled` to `allowed`.
Change-Id: I37fcb391dcb215a86a60c26f7512f6ccb8312dc4
Signed-off-by: Patrick Williams <patrick@stwcx.xyz>
diff --git a/meson.build b/meson.build
index b9b2d87..a128829 100644
--- a/meson.build
+++ b/meson.build
@@ -17,7 +17,7 @@
build_tests = get_option('tests')
-if get_option('oe-sdk').enabled()
+if get_option('oe-sdk').allowed()
# Setup OE SYSROOT
OECORE_TARGET_SYSROOT = run_command('sh', '-c', 'echo $OECORE_TARGET_SYSROOT').stdout().strip()
if OECORE_TARGET_SYSROOT == ''
@@ -34,7 +34,7 @@
gmock = dependency('gmock', disabler: true, required: false)
gtest = dependency('gtest', main: true, disabler: true, required: false)
-if (not gtest.found() or not gmock.found()) and build_tests.enabled()
+if (not gtest.found() or not gmock.found()) and build_tests.allowed()
gtest_opts = import('cmake').subproject_options()
gtest_opts.add_cmake_defines({
'BUILD_SHARED_LIBS': 'ON'
@@ -194,7 +194,7 @@
if get_option('utils')
subdir('tools/power-utils')
endif
-if get_option('tests').enabled()
+if get_option('tests').allowed()
subdir('test')
endif
if get_option('cold-redundancy')
diff --git a/phosphor-power-supply/meson.build b/phosphor-power-supply/meson.build
index 3b4a052..35034b3 100644
--- a/phosphor-power-supply/meson.build
+++ b/phosphor-power-supply/meson.build
@@ -27,6 +27,6 @@
power_supply = phosphor_psu_monitor.extract_objects('power_supply.cpp')
-if get_option('tests').enabled()
+if get_option('tests').allowed()
subdir('test')
endif
diff --git a/phosphor-power-supply/test/meson.build b/phosphor-power-supply/test/meson.build
index 1e5fe05..86143aa 100644
--- a/phosphor-power-supply/test/meson.build
+++ b/phosphor-power-supply/test/meson.build
@@ -21,7 +21,7 @@
link_with: [
libpower,
],
- build_rpath: get_option('oe-sdk').enabled() ? rpath : '',
+ build_rpath: get_option('oe-sdk').allowed() ? rpath : '',
objects: power_supply,
)
)
diff --git a/phosphor-regulators/meson.build b/phosphor-regulators/meson.build
index cd2c39c..a9a3dd5 100644
--- a/phosphor-regulators/meson.build
+++ b/phosphor-regulators/meson.build
@@ -4,6 +4,6 @@
subdir('src')
-if get_option('tests').enabled()
+if get_option('tests').allowed()
subdir('test')
endif
diff --git a/phosphor-regulators/test/meson.build b/phosphor-regulators/test/meson.build
index b290cd0..74695be 100644
--- a/phosphor-regulators/test/meson.build
+++ b/phosphor-regulators/test/meson.build
@@ -52,7 +52,7 @@
]
# Long-running tests that are excluded from CI
-if get_option('long-tests').enabled()
+if get_option('long-tests').allowed()
# This test requires the Python module 'jsonschema'
phosphor_regulators_tests_source_files += 'validate-regulators-config_tests.cpp'
endif
@@ -69,7 +69,7 @@
sdbusplus,
],
link_args: dynamic_linker,
- build_rpath: get_option('oe-sdk').enabled() ? rpath : '',
+ build_rpath: get_option('oe-sdk').allowed() ? rpath : '',
link_with: [
phosphor_regulators_library,
libi2c_dev_mock
diff --git a/power-supply/meson.build b/power-supply/meson.build
index e2f1a37..d2251bf 100644
--- a/power-supply/meson.build
+++ b/power-supply/meson.build
@@ -21,6 +21,6 @@
record_manager = psu_monitor.extract_objects('record_manager.cpp')
-if get_option('tests').enabled()
+if get_option('tests').allowed()
subdir('test')
endif
diff --git a/power-supply/test/meson.build b/power-supply/test/meson.build
index f7523a0..39aec2a 100644
--- a/power-supply/test/meson.build
+++ b/power-supply/test/meson.build
@@ -12,7 +12,7 @@
implicit_include_directories: false,
include_directories: '../..',
link_args: dynamic_linker,
- build_rpath: get_option('oe-sdk').enabled() ? rpath : '',
+ build_rpath: get_option('oe-sdk').allowed() ? rpath : '',
link_with: [
libpower,
],
diff --git a/test/meson.build b/test/meson.build
index ca71994..92225b4 100644
--- a/test/meson.build
+++ b/test/meson.build
@@ -7,7 +7,7 @@
gtest,
],
link_args: dynamic_linker,
- build_rpath: get_option('oe-sdk').enabled() ? rpath : '',
+ build_rpath: get_option('oe-sdk').allowed() ? rpath : '',
implicit_include_directories: false,
include_directories: '..',
)
@@ -21,7 +21,7 @@
gtest,
],
link_args: dynamic_linker,
- build_rpath: get_option('oe-sdk').enabled() ? rpath : '',
+ build_rpath: get_option('oe-sdk').allowed() ? rpath : '',
implicit_include_directories: false,
include_directories: '..',
)
diff --git a/tools/i2c/meson.build b/tools/i2c/meson.build
index 76261b3..fe23704 100644
--- a/tools/i2c/meson.build
+++ b/tools/i2c/meson.build
@@ -10,6 +10,6 @@
include_directories : libi2c_inc,
link_args : '-li2c')
-if get_option('tests').enabled()
+if get_option('tests').allowed()
subdir('test')
endif
diff --git a/tools/i2c/test/meson.build b/tools/i2c/test/meson.build
index 1401914..57fc7e4 100644
--- a/tools/i2c/test/meson.build
+++ b/tools/i2c/test/meson.build
@@ -7,7 +7,7 @@
gmock
],
link_args: dynamic_linker,
- build_rpath: get_option('oe-sdk').enabled() ? rpath : '',
+ build_rpath: get_option('oe-sdk').allowed() ? rpath : '',
include_directories: [
libi2c_inc,
libi2c_dev_mock_inc
diff --git a/tools/power-utils/meson.build b/tools/power-utils/meson.build
index d9e8a37..e329393 100644
--- a/tools/power-utils/meson.build
+++ b/tools/power-utils/meson.build
@@ -17,6 +17,6 @@
]
)
-if get_option('tests').enabled()
+if get_option('tests').allowed()
subdir('test')
endif
diff --git a/tools/power-utils/test/meson.build b/tools/power-utils/test/meson.build
index d5a134f..40b2ca6 100644
--- a/tools/power-utils/test/meson.build
+++ b/tools/power-utils/test/meson.build
@@ -12,7 +12,7 @@
implicit_include_directories: false,
include_directories: libpower_inc,
link_args: dynamic_linker,
- build_rpath: get_option('oe-sdk').enabled() ? rpath : '',
+ build_rpath: get_option('oe-sdk').allowed() ? rpath : '',
link_with: [
libpower,
],
@@ -39,7 +39,7 @@
libi2c_dev_mock_inc
],
link_args: dynamic_linker,
- build_rpath: get_option('oe-sdk').enabled() ? rpath : '',
+ build_rpath: get_option('oe-sdk').allowed() ? rpath : '',
link_with: [
libpower,
libi2c_dev_mock