aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/ast/introspection.py
diff options
context:
space:
mode:
authorXavier Claessens <xavier.claessens@collabora.com>2021-10-12 23:21:11 -0400
committerXavier Claessens <xclaesse@gmail.com>2022-03-22 17:20:48 -0400
commit8867fb7999e35c6713c46af64becfd1a08146a6a (patch)
treefb077717b3074e6d480c166d7d7fb14ae9e24b62 /mesonbuild/ast/introspection.py
parent999fb3d1e9d4affd95e3ff12039abf787b0b7acf (diff)
downloadmeson-8867fb7999e35c6713c46af64becfd1a08146a6a.zip
meson-8867fb7999e35c6713c46af64becfd1a08146a6a.tar.gz
meson-8867fb7999e35c6713c46af64becfd1a08146a6a.tar.bz2
interpreter: Make compiler options per-subproject
Diffstat (limited to 'mesonbuild/ast/introspection.py')
-rw-r--r--mesonbuild/ast/introspection.py11
1 files changed, 10 insertions, 1 deletions
diff --git a/mesonbuild/ast/introspection.py b/mesonbuild/ast/introspection.py
index af29542..55c3bcc 100644
--- a/mesonbuild/ast/introspection.py
+++ b/mesonbuild/ast/introspection.py
@@ -27,6 +27,7 @@ from ..compilers import detect_compiler_for
import typing as T
import os
import argparse
+import copy
build_target_functions = ['executable', 'jar', 'library', 'shared_library', 'shared_module', 'static_library', 'both_libraries']
@@ -163,7 +164,15 @@ class IntrospectionInterpreter(AstInterpreter):
for lang in sorted(langs, key=compilers.sort_clink):
lang = lang.lower()
if lang not in self.coredata.compilers[for_machine]:
- detect_compiler_for(self.environment, lang, for_machine)
+ comp = detect_compiler_for(self.environment, lang, for_machine)
+ if self.subproject:
+ options = {}
+ for k in comp.get_options():
+ v = copy.copy(self.coredata.options[k])
+ k = k.evolve(subproject=self.subproject)
+ options[k] = v
+ self.coredata.add_compiler_options(options, lang, for_machine, self.environment)
+
def func_dependency(self, node: BaseNode, args: T.List[TYPE_nvar], kwargs: T.Dict[str, TYPE_nvar]) -> None:
args = self.flatten_args(args)