diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2021-01-29 10:30:28 -0500 |
---|---|---|
committer | Xavier Claessens <xavier.claessens@collabora.com> | 2021-01-29 11:01:00 -0500 |
commit | 11cfc258fc2cebe6360322f3338741e1d6694525 (patch) | |
tree | c008d978d8e43b5329ad1be124e98576ffa8f561 /mesonbuild/modules | |
parent | 6a6323ff096db76b0cd82f13c8f369ac08180ef7 (diff) | |
download | meson-11cfc258fc2cebe6360322f3338741e1d6694525.zip meson-11cfc258fc2cebe6360322f3338741e1d6694525.tar.gz meson-11cfc258fc2cebe6360322f3338741e1d6694525.tar.bz2 |
external_project: Add default configure options
Diffstat (limited to 'mesonbuild/modules')
-rw-r--r-- | mesonbuild/modules/unstable_external_project.py | 24 |
1 files changed, 12 insertions, 12 deletions
diff --git a/mesonbuild/modules/unstable_external_project.py b/mesonbuild/modules/unstable_external_project.py index 933b064..20c1671 100644 --- a/mesonbuild/modules/unstable_external_project.py +++ b/mesonbuild/modules/unstable_external_project.py @@ -90,11 +90,11 @@ class ExternalProject(InterpreterObject): configure_prog = self.interpreter.find_program_impl(configure_path.as_posix()) configure_cmd = configure_prog.get_command() - d = {'PREFIX': self.prefix.as_posix(), - 'LIBDIR': self.libdir.as_posix(), - 'INCLUDEDIR': self.includedir.as_posix(), - } - self._validate_configure_options(d.keys()) + d = [('PREFIX', '--prefix=@PREFIX@', self.prefix.as_posix()), + ('LIBDIR', '--libdir=@PREFIX@/@LIBDIR@', self.libdir.as_posix()), + ('INCLUDEDIR', '--includedir=@PREFIX@/@INCLUDEDIR@', self.includedir.as_posix()), + ] + self._validate_configure_options(d) configure_cmd += self._format_options(self.configure_options, d) @@ -102,7 +102,7 @@ class ExternalProject(InterpreterObject): host = '{}-{}-{}'.format(self.host_machine.cpu_family, self.build_machine.system, self.host_machine.system) - d = {'HOST': host} + d = [('HOST', None, host)] configure_cmd += self._format_options(self.cross_configure_options, d) # Set common env variables like CFLAGS, CC, etc. @@ -136,23 +136,23 @@ class ExternalProject(InterpreterObject): def _quote_and_join(self, array: T.List[str]) -> str: return ' '.join([shlex.quote(i) for i in array]) - def _validate_configure_options(self, required_keys: T.List[str]): + def _validate_configure_options(self, variables: T.List[T.Tuple[str, str, str]]): # Ensure the user at least try to pass basic info to the build system, # like the prefix, libdir, etc. - for key in required_keys: + for key, default, val in variables: key_format = '@{}@'.format(key) for option in self.configure_options: if key_format in option: break else: - m = 'At least one configure option must contain "{}" key' - raise InterpreterException(m.format(key_format)) + FeatureNew('Default configure_option', '0.57.0').use(self.subproject) + self.configure_options.append(default) - def _format_options(self, options: T.List[str], variables: T.Dict[str, str]) -> T.List[str]: + def _format_options(self, options: T.List[str], variables: T.List[T.Tuple[str, str, str]]) -> T.List[str]: out = [] missing = set() regex = get_variable_regex('meson') - confdata = {k: (v, None) for k, v in variables.items()} + confdata = {k: (v, None) for k, d, v in variables} for o in options: arg, missing_vars = do_replacement(regex, o, 'meson', confdata) missing.update(missing_vars) |