From 273894d9897dc60e524506e5dbefc550184aa2cf Mon Sep 17 00:00:00 2001 From: Nick <0xb000@gmail.com> Date: Mon, 4 Nov 2024 17:58:54 +0200 Subject: [PATCH] Xcode backend: only use found appleframeworksn Add a check before using an `appleframeworks` to make sure it was found. This fixes an exception in meson while encountering an optional dep for the target. --- mesonbuild/backend/xcodebackend.py | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/mesonbuild/backend/xcodebackend.py b/mesonbuild/backend/xcodebackend.py index fc490c1b5d35..31fd272b3f0b 100644 --- a/mesonbuild/backend/xcodebackend.py +++ b/mesonbuild/backend/xcodebackend.py @@ -526,7 +526,7 @@ def generate_native_frameworks_map(self) -> None: self.native_frameworks_fileref = {} for t in self.build_targets.values(): for dep in t.get_external_deps(): - if dep.name == 'appleframeworks': + if dep.name == 'appleframeworks' and dep.found(): for f in dep.frameworks: self.native_frameworks[f] = self.gen_id() self.native_frameworks_fileref[f] = self.gen_id() @@ -691,7 +691,7 @@ def generate_pbx_aggregate_target(self, objects_dict: PbxDict) -> None: def generate_pbx_build_file(self, objects_dict: PbxDict) -> None: for tname, t in self.build_targets.items(): for dep in t.get_external_deps(): - if dep.name == 'appleframeworks': + if dep.name == 'appleframeworks' and dep.found(): for f in dep.frameworks: fw_dict = PbxDict() fwkey = self.native_frameworks[f] @@ -848,7 +848,7 @@ def generate_pbx_container_item_proxy(self, objects_dict: PbxDict) -> None: def generate_pbx_file_reference(self, objects_dict: PbxDict) -> None: for tname, t in self.build_targets.items(): for dep in t.get_external_deps(): - if dep.name == 'appleframeworks': + if dep.name == 'appleframeworks' and dep.found(): for f in dep.frameworks: fw_dict = PbxDict() framework_fileref = self.native_frameworks_fileref[f] @@ -1023,7 +1023,7 @@ def generate_pbx_frameworks_buildphase(self, objects_dict: PbxDict) -> None: file_list = PbxArray() bt_dict.add_item('files', file_list) for dep in t.get_external_deps(): - if dep.name == 'appleframeworks': + if dep.name == 'appleframeworks' and dep.found(): for f in dep.frameworks: file_list.add_item(self.native_frameworks[f], f'{f}.framework in Frameworks') bt_dict.add_item('runOnlyForDeploymentPostprocessing', 0) @@ -1071,7 +1071,7 @@ def generate_pbx_group(self, objects_dict: PbxDict) -> None: for t in self.build_targets.values(): for dep in t.get_external_deps(): - if dep.name == 'appleframeworks': + if dep.name == 'appleframeworks' and dep.found(): for f in dep.frameworks: frameworks_children.add_item(self.native_frameworks_fileref[f], f)