From ab6278be023d370b0d52f3994edcb5ea4f2d5352 Mon Sep 17 00:00:00 2001 From: Russell Keith-Magee Date: Thu, 1 May 2025 09:36:39 +0800 Subject: [PATCH] Add framework linking for iOS builds. --- mesonbuild/dependencies/python.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/mesonbuild/dependencies/python.py b/mesonbuild/dependencies/python.py index 34945cb82b6d..0ca9cef6a0e1 100644 --- a/mesonbuild/dependencies/python.py +++ b/mesonbuild/dependencies/python.py @@ -349,8 +349,14 @@ def __init__(self, name: str, environment: 'Environment', SystemDependency.__init__(self, name, environment, kwargs) _PythonDependencyBase.__init__(self, installation, kwargs.get('embed', False)) - # match pkg-config behavior - if self.link_libpython: + # For most platforms, match pkg-config behavior. iOS is a special case; + # check for that first, so that check takes priority over + # `link_libpython` (which *shouldn't* be set, but just in case) + if self.platform.startswith('ios-'): + # iOS doesn't use link_libpython - it links with the *framework*. + self.link_args = ['-framework', 'Python', '-F', self.variables.get('prefix')] + self.is_found = True + elif self.link_libpython: # link args if mesonlib.is_windows(): self.find_libpy_windows(environment, limited_api=False)