summaryrefslogtreecommitdiff
path: root/mesonbuild/compilers/compilers.py
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2025-07-09 19:07:49 +0200
committerDylan Baker <dylan@pnwbakers.com>2025-07-10 09:47:49 -0700
commitc674f5310549215069fc6be08a29702f646d04a9 (patch)
tree8ea3aaf44df816ceccbfc0513593b2e9c251434c /mesonbuild/compilers/compilers.py
parent2dc4ddeccbb01b8e35bf378b1c447799124d188a (diff)
downloadmeson-c674f5310549215069fc6be08a29702f646d04a9.tar.gz
compilers: move CFLAGS/CXXFLAGS handling to Environment
That is where env_opts are stored, so make the compiler call back directly into the environment. Suggested-by: Dylan Baker <dylan@pnwbakers.com> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
Diffstat (limited to 'mesonbuild/compilers/compilers.py')
-rw-r--r--mesonbuild/compilers/compilers.py44
1 files changed, 0 insertions, 44 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py
index 057868f7a..af6b05015 100644
--- a/mesonbuild/compilers/compilers.py
+++ b/mesonbuild/compilers/compilers.py
@@ -1417,47 +1417,3 @@ class Compiler(HoldableObject, metaclass=abc.ABCMeta):
if 'none' not in value:
value = ['none'] + value
std.choices = value
-
-
-def add_global_options(lang: str,
- comp: T.Type[Compiler],
- for_machine: MachineChoice,
- env: 'Environment'):
- """Retrieve options that apply to all compilers for a given language."""
- description = f'Extra arguments passed to the {lang}'
- argkey = OptionKey(f'{lang}_args', machine=for_machine)
- largkey = OptionKey(f'{lang}_link_args', machine=for_machine)
-
- comp_args_from_envvar = False
- comp_options = env.coredata.optstore.get_pending_value(argkey)
- if comp_options is None:
- comp_args_from_envvar = True
- comp_options = env.env_opts.get(argkey, [])
-
- link_options = env.coredata.optstore.get_pending_value(largkey)
- if link_options is None:
- link_options = env.env_opts.get(largkey, [])
-
- assert isinstance(comp_options, (str, list)), 'for mypy'
- assert isinstance(link_options, (str, list)), 'for mypy'
-
- cargs = options.UserStringArrayOption(
- argkey.name,
- description + ' compiler',
- comp_options, split_args=True, allow_dups=True)
-
- largs = options.UserStringArrayOption(
- largkey.name,
- description + ' linker',
- link_options, split_args=True, allow_dups=True)
-
- env.coredata.optstore.add_compiler_option(lang, argkey, cargs)
- env.coredata.optstore.add_compiler_option(lang, largkey, largs)
-
- if comp.INVOKES_LINKER and comp_args_from_envvar:
- # If the compiler acts as a linker driver, and we're using the
- # environment variable flags for both the compiler and linker
- # arguments, then put the compiler flags in the linker flags as well.
- # This is how autotools works, and the env vars feature is for
- # autotools compatibility.
- largs.extend_value(comp_options)