Skip to content

Commit 6fa5876

Browse files
committed
Add numpy specific extensions for iOS builds.
1 parent 18f7958 commit 6fa5876

File tree

2 files changed

+21
-5
lines changed

2 files changed

+21
-5
lines changed

docs/markdown/Dependencies.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -462,10 +462,11 @@ TODO
462462

463463
Supports the BLAS and LAPACK components of macOS Accelerate, also referred to
464464
as the vecLib framework. ILP64 support is only available on macOS 13.3 and up.
465-
From macOS 13.3, Accelerate ships with two different builds of 32-bit (LP64)
466-
BLAS and LAPACK. Meson will default to the newer of those builds, by defining
467-
`ACCELERATE_NEW_LAPACK`, unless `MACOS_DEPLOYMENT_TARGET` is set to a version
468-
lower than 13.3.
465+
From macOS 13.3 and iOS 16.4, Accelerate ships with two different builds of
466+
32-bit (LP64) BLAS and LAPACK. Meson will default to the newer of those builds,
467+
by defining `ACCELERATE_NEW_LAPACK`, unless `MACOS_DEPLOYMENT_TARGET` is set to
468+
a version lower than 13.3, or `IPHONEOS_DEPLOYMENT_TARGET` is set to a version
469+
lower than 16.4.
469470

470471
```meson
471472
accelerate_dep = dependency('accelerate',

mesonbuild/dependencies/blas_lapack.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -738,7 +738,10 @@ def __init__(self, name: str, environment: 'Environment', kwargs: T.Dict[str, T.
738738
self.parse_modules(kwargs)
739739

740740
for_machine = MachineChoice.BUILD if kwargs.get('native', False) else MachineChoice.HOST
741-
if environment.machines[for_machine].is_darwin() and self.check_macOS_recent_enough():
741+
if (
742+
(environment.machines[for_machine].system == 'darwin' and self.check_macOS_recent_enough())
743+
or (environment.machines[for_machine].system == 'ios' and self.check_iOS_recent_enough())
744+
):
742745
self.detect(kwargs)
743746

744747
def check_macOS_recent_enough(self) -> bool:
@@ -752,6 +755,18 @@ def check_macOS_recent_enough(self) -> bool:
752755
sdk_version = subprocess.run(cmd, capture_output=True, check=True, text=True).stdout.strip()
753756
return mesonlib.version_compare(sdk_version, '>=13.3')
754757

758+
def check_iOS_recent_enough(self) -> bool:
759+
ios_version = platform.ios_ver().system
760+
deploy_target = os.environ.get('IPHONEOS_DEPLOYMENT_TARGET', ios_version)
761+
if not mesonlib.version_compare(deploy_target, '>=16.4'):
762+
return False
763+
764+
# We also need the SDK to be >=16.4
765+
sdk = "iphonesimulator" if platform.ios_ver().is_simulator else "iphoneos"
766+
cmd = ['xcrun', '-sdk', sdk, '--show-sdk-version']
767+
sdk_version = subprocess.run(cmd, capture_output=True, check=True, text=True).stdout.strip()
768+
return mesonlib.version_compare(sdk_version, '>=16.4')
769+
755770
def detect(self, kwargs: T.Dict[str, T.Any]) -> None:
756771
from .framework import ExtraFrameworkDependency
757772
dep = ExtraFrameworkDependency('Accelerate', self.env, kwargs)

0 commit comments

Comments
 (0)