aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/build.py
diff options
context:
space:
mode:
authorPaolo Bonzini <pbonzini@redhat.com>2022-05-23 16:21:39 +0200
committerDylan Baker <dylan@pnwbakers.com>2022-06-14 10:11:22 -0700
commitdae986073d5ab3a6241cecaf3362065256400772 (patch)
tree3b842cc17520a2c723e16238a3ddeedf2d9250e3 /mesonbuild/build.py
parentf3ba24f2892fa4ccf1c6c198190f43d4da44a761 (diff)
downloadmeson-dae986073d5ab3a6241cecaf3362065256400772.zip
meson-dae986073d5ab3a6241cecaf3362065256400772.tar.gz
meson-dae986073d5ab3a6241cecaf3362065256400772.tar.bz2
take override_option('unity=...') into account when allowing extract_objects()
A single target could be picked for unity build, and in that case extract_objects() should not be allowed. Likewise for the opposite case, where extract_objects() should be allowed if unity build is disabled for a single target. A test that covers that case is added later.
Diffstat (limited to 'mesonbuild/build.py')
-rw-r--r--mesonbuild/build.py7
1 files changed, 5 insertions, 2 deletions
diff --git a/mesonbuild/build.py b/mesonbuild/build.py
index ceff296..d312abd 100644
--- a/mesonbuild/build.py
+++ b/mesonbuild/build.py
@@ -753,8 +753,6 @@ class BuildTarget(Target):
sources: T.List['SourceOutputs'], structured_sources: T.Optional[StructuredSources],
objects, environment: environment.Environment, compilers: T.Dict[str, 'Compiler'], kwargs):
super().__init__(name, subdir, subproject, True, for_machine, environment)
- unity_opt = environment.coredata.get_option(OptionKey('unity'))
- self.is_unity = unity_opt == 'on' or (unity_opt == 'subprojects' and subproject != '')
self.all_compilers = compilers
self.compilers = OrderedDict() # type: OrderedDict[str, Compiler]
self.objects: T.List[T.Union[str, 'File', 'ExtractedObjects']] = []
@@ -810,6 +808,11 @@ class BuildTarget(Target):
def __str__(self):
return f"{self.name}"
+ @property
+ def is_unity(self) -> bool:
+ unity_opt = self.get_option(OptionKey('unity'))
+ return unity_opt == 'on' or (unity_opt == 'subprojects' and self.subproject != '')
+
def validate_install(self):
if self.for_machine is MachineChoice.BUILD and self.need_install:
if self.environment.is_cross_build():