build,meson: Allow plugins to depend on build options

At the moment plugins might depend only on shared plugins. However,
plugins may depend also in different build options. For example,
`qcom-soc` plugin needs `qmi` option to be enabled.

Plugins build check has been changed to allow to depend on different
build options.

Fixes #447
This commit is contained in:
Iñigo Martínez
2021-10-18 09:26:59 +02:00
committed by Aleksander Morgado
parent d6aa727366
commit 7663a2e6c3

View File

@@ -278,45 +278,45 @@ plugins_shared_reqs = {
} }
plugins_options_reqs = { plugins_options_reqs = {
'altair-lte': [], 'altair-lte': {'available': true, 'shared': []},
'anydata': [], 'anydata': {'available': true, 'shared': []},
'broadmobi': [], 'broadmobi': {'available': true, 'shared': []},
'cinterion': [], 'cinterion': {'available': true, 'shared': []},
'dell': ['foxconn', 'novatel', 'sierra', 'telit', 'xmm'], 'dell': {'available': true, 'shared': ['foxconn', 'novatel', 'sierra', 'telit', 'xmm']},
'dlink': [], 'dlink': {'available': true, 'shared': []},
'fibocom': ['xmm'], 'fibocom': {'available': true, 'shared': ['xmm']},
'foxconn': ['foxconn'], 'foxconn': {'available': true, 'shared': ['foxconn']},
'generic': [], 'generic': {'available': true, 'shared': []},
'gosuncn': [], 'gosuncn': {'available': true, 'shared': []},
'haier': [], 'haier': {'available': true, 'shared': []},
'huawei': [], 'huawei': {'available': true, 'shared': []},
'iridium': [], 'iridium': {'available': true, 'shared': []},
'linktop': [], 'linktop': {'available': true, 'shared': []},
'longcheer': [], 'longcheer': {'available': true, 'shared': []},
'mbm': [], 'mbm': {'available': true, 'shared': []},
'motorola': [], 'motorola': {'available': true, 'shared': []},
'mtk': [], 'mtk': {'available': true, 'shared': []},
'nokia': [], 'nokia': {'available': true, 'shared': []},
'nokia-icera': ['icera'], 'nokia-icera': {'available': true, 'shared': ['icera']},
'novatel': ['novatel'], 'novatel': {'available': true, 'shared': ['novatel']},
'novatel-lte': [], 'novatel-lte': {'available': true, 'shared': []},
'option': ['option'], 'option': {'available': true, 'shared': ['option']},
'option-hso': ['option'], 'option-hso': {'available': true, 'shared': ['option']},
'pantech': [], 'pantech': {'available': true, 'shared': []},
'qcom-soc': [], 'qcom-soc': {'available': enable_qmi, 'shared': []},
'quectel': [], 'quectel': {'available': true, 'shared': []},
'samsung': ['icera'], 'samsung': {'available': true, 'shared': ['icera']},
'sierra-legacy': ['icera', 'sierra'], 'sierra-legacy': {'available': true, 'shared': ['icera', 'sierra']},
'sierra': ['xmm'], 'sierra': {'available': true, 'shared': ['xmm']},
'simtech': [], 'simtech': {'available': true, 'shared': []},
'telit': ['telit'], 'telit': {'available': true, 'shared': ['telit']},
'thuraya': [], 'thuraya': {'available': true, 'shared': []},
'tplink': [], 'tplink': {'available': true, 'shared': []},
'ublox': [], 'ublox': {'available': true, 'shared': []},
'via': [], 'via': {'available': true, 'shared': []},
'wavecom': [], 'wavecom': {'available': true, 'shared': []},
'x22x': [], 'x22x': {'available': true, 'shared': []},
'zte': ['icera'], 'zte': {'available': true, 'shared': ['icera']},
} }
plugins_shared = {} plugins_shared = {}
@@ -327,9 +327,10 @@ endforeach
plugins_options = {} plugins_options = {}
foreach plugin_name, plugin_reqs: plugins_options_reqs foreach plugin_name, plugin_reqs: plugins_options_reqs
plugin_opt = get_option('plugin_' + plugin_name.underscorify()) plugin_opt = get_option('plugin_' + plugin_name.underscorify())
plugin_enabled = not plugin_opt.disabled() assert(plugin_reqs['available'] or not plugin_opt.enabled(), '@0@ is not available'.format(plugin_name))
plugin_enabled = not plugin_opt.disabled() and plugin_reqs['available']
if plugin_enabled if plugin_enabled
foreach plugin_req: plugin_reqs foreach plugin_req: plugin_reqs['shared']
if plugins_shared_reqs[plugin_req] if plugins_shared_reqs[plugin_req]
plugins_shared += {plugin_req: true} plugins_shared += {plugin_req: true}
else else