aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/dependencies
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2020-12-04 17:01:45 -0800
committerDylan Baker <dylan@pnwbakers.com>2021-01-04 12:20:58 -0800
commite81acbd6069e8c1ae8e3be7bb83ddc239009d42d (patch)
treeb08545b2844650ed95e42ade00ecb1cd3fb85b88 /mesonbuild/dependencies
parent71db6b04a31707674ad776be1cf22f667056d56b (diff)
downloadmeson-e81acbd6069e8c1ae8e3be7bb83ddc239009d42d.zip
meson-e81acbd6069e8c1ae8e3be7bb83ddc239009d42d.tar.gz
meson-e81acbd6069e8c1ae8e3be7bb83ddc239009d42d.tar.bz2
Use a single coredata dictionary for options
This patches takes the options work to it's logical conclusion: A single flat dictionary of OptionKey: UserOptions. This allows us to simplify a large number of cases, as we don't need to check if an option is in this dict or that one (or any of 5 or 6, actually).
Diffstat (limited to 'mesonbuild/dependencies')
-rw-r--r--mesonbuild/dependencies/base.py10
-rw-r--r--mesonbuild/dependencies/boost.py6
-rw-r--r--mesonbuild/dependencies/ui.py6
3 files changed, 11 insertions, 11 deletions
diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py
index 7b8045d..e359219 100644
--- a/mesonbuild/dependencies/base.py
+++ b/mesonbuild/dependencies/base.py
@@ -658,7 +658,7 @@ class PkgConfigDependency(ExternalDependency):
@staticmethod
def setup_env(env: T.MutableMapping[str, str], environment: 'Environment', for_machine: MachineChoice,
extra_path: T.Optional[str] = None) -> None:
- extra_paths: T.List[str] = environment.coredata.builtins[OptionKey('pkg_config_path', machine=for_machine)].value
+ extra_paths: T.List[str] = environment.coredata.options[OptionKey('pkg_config_path', machine=for_machine)].value
if extra_path:
extra_paths.append(extra_path)
sysroot = environment.properties[for_machine].get_sys_root()
@@ -1485,12 +1485,12 @@ class CMakeDependency(ExternalDependency):
cfgs = [x for x in tgt.properties['IMPORTED_CONFIGURATIONS'] if x]
cfg = cfgs[0]
- if OptionKey('b_vscrt') in self.env.coredata.base_options:
- is_debug = self.env.coredata.get_builtin_option('buildtype') == 'debug'
- if self.env.coredata.base_options[OptionKey('b_vscrt')].value in {'mdd', 'mtd'}:
+ if OptionKey('b_vscrt') in self.env.coredata.options:
+ is_debug = self.env.coredata.get_option(OptionKey('buildtype')) == 'debug'
+ if self.env.coredata.options[OptionKey('b_vscrt')].value in {'mdd', 'mtd'}:
is_debug = True
else:
- is_debug = self.env.coredata.get_builtin_option('debug')
+ is_debug = self.env.coredata.get_option(OptionKey('debug'))
if is_debug:
if 'DEBUG' in cfgs:
cfg = 'DEBUG'
diff --git a/mesonbuild/dependencies/boost.py b/mesonbuild/dependencies/boost.py
index e2e4789..622ee37 100644
--- a/mesonbuild/dependencies/boost.py
+++ b/mesonbuild/dependencies/boost.py
@@ -341,7 +341,7 @@ class BoostLibraryFile():
class BoostDependency(ExternalDependency):
def __init__(self, environment: Environment, kwargs: T.Dict[str, T.Any]) -> None:
super().__init__('boost', environment, kwargs, language='cpp')
- buildtype = environment.coredata.get_builtin_option('buildtype')
+ buildtype = environment.coredata.get_option(mesonlib.OptionKey('buildtype'))
assert isinstance(buildtype, str)
self.debug = buildtype.startswith('debug')
self.multithreading = kwargs.get('threading', 'multi') == 'multi'
@@ -616,8 +616,8 @@ class BoostDependency(ExternalDependency):
# MSVC is very picky with the library tags
vscrt = ''
try:
- crt_val = self.env.coredata.base_options[mesonlib.OptionKey('b_vscrt')].value
- buildtype = self.env.coredata.builtins[mesonlib.OptionKey('buildtype')].value
+ crt_val = self.env.coredata.options[mesonlib.OptionKey('b_vscrt')].value
+ buildtype = self.env.coredata.options[mesonlib.OptionKey('buildtype')].value
vscrt = self.clib_compiler.get_crt_compile_args(crt_val, buildtype)[0]
except (KeyError, IndexError, AttributeError):
pass
diff --git a/mesonbuild/dependencies/ui.py b/mesonbuild/dependencies/ui.py
index 942f69a..0b0d96d 100644
--- a/mesonbuild/dependencies/ui.py
+++ b/mesonbuild/dependencies/ui.py
@@ -382,9 +382,9 @@ class QtBaseDependency(ExternalDependency):
# Use the buildtype by default, but look at the b_vscrt option if the
# compiler supports it.
- is_debug = self.env.coredata.get_builtin_option('buildtype') == 'debug'
- if mesonlib.OptionKey('b_vscrt') in self.env.coredata.base_options:
- if self.env.coredata.base_options[mesonlib.OptionKey('b_vscrt')].value in {'mdd', 'mtd'}:
+ is_debug = self.env.coredata.get_option(mesonlib.OptionKey('buildtype')) == 'debug'
+ if mesonlib.OptionKey('b_vscrt') in self.env.coredata.options:
+ if self.env.coredata.options[mesonlib.OptionKey('b_vscrt')].value in {'mdd', 'mtd'}:
is_debug = True
modules_lib_suffix = self._get_modules_lib_suffix(is_debug)