@@ -771,6 +771,10 @@ def __init__(self, name: str, environment: 'Environment', kwargs: 'DependencyObj
771771 super ().__init__ (name , environment , kwargs )
772772 self .feature_since = ('1.3.0' , '' )
773773 self .parse_modules (kwargs )
774+ # In addition to checking the LP64/ILP64 interface, we need to
775+ # differentiate between the original Accelerate, and the
776+ # ACCELERATE_NEW_LAPACK variant.
777+ self .use_new_lapack = True
774778
775779 for_machine = MachineChoice .BUILD if kwargs .get ('native' , False ) else MachineChoice .HOST
776780 if (
@@ -791,21 +795,33 @@ def check_macOS_recent_enough(self) -> bool:
791795 return mesonlib .version_compare (sdk_version , '>=13.3' )
792796
793797 def check_iOS_recent_enough (self ) -> bool :
798+ # The ILP64 interface is only available as part of
799+ # ACCELERATE_NEW_LAPACK, which requires iOS 16.4 and later.
800+ if self .interface == "ilp64" :
801+ required_version = ">=16.4"
802+ else :
803+ required_version = ">=13.0"
804+
794805 # platform.ios_ver() is only available since Python 3.13; use getattr
795806 # so this type-checks across Python versions.
796807 ios_ver = getattr (platform , 'ios_ver' , None )
797808 if ios_ver is None :
798809 return False
799- ios_version = ios_ver ().system
800- deploy_target = os .environ .get ('IPHONEOS_DEPLOYMENT_TARGET' , ios_version )
801- if not mesonlib .version_compare (deploy_target , '>=16.4' ):
810+
811+ deploy_target = os .environ .get ('IPHONEOS_DEPLOYMENT_TARGET' , ios_ver ().release )
812+
813+ if not mesonlib .version_compare (deploy_target , required_version ):
802814 return False
803815
804- # We also need the SDK to be >=16.4
816+ # If we're targeting iOS < 16.4, we can't use ACCELERATE_NEW_LAPACK
817+ if mesonlib .version_compare (deploy_target , "<16.4" ):
818+ self .use_new_lapack = False
819+
820+ # We also need the SDK to be the right version
805821 sdk = "iphonesimulator" if ios_ver ().is_simulator else "iphoneos"
806822 cmd = ['xcrun' , '-sdk' , sdk , '--show-sdk-version' ]
807823 sdk_version = subprocess .run (cmd , capture_output = True , check = True , encoding = 'utf-8' ).stdout .strip ()
808- return mesonlib .version_compare (sdk_version , '>=16.4' )
824+ return mesonlib .version_compare (sdk_version , required_version )
809825
810826 def detect (self , kwargs : 'DependencyObjectKWs' ) -> None :
811827 from .framework import ExtraFrameworkDependency
@@ -814,15 +830,19 @@ def detect(self, kwargs: 'DependencyObjectKWs') -> None:
814830 if self .is_found :
815831 self .compile_args = dep .compile_args
816832 self .link_args = dep .link_args
817- self .compile_args += ['-DACCELERATE_NEW_LAPACK' ]
833+ if self .use_new_lapack :
834+ self .compile_args += ['-DACCELERATE_NEW_LAPACK' ]
818835 if self .interface == 'ilp64' :
819836 self .compile_args += ['-DACCELERATE_LAPACK_ILP64' ]
820837
821838 # We won't check symbols here, because Accelerate is built in a consistent fashion
822839 # with known symbol mangling, unlike OpenBLAS or Netlib BLAS/LAPACK.
823840
824841 def get_symbol_suffix (self ) -> str :
825- return '$NEWLAPACK' if self .interface == 'lp64' else '$NEWLAPACK$ILP64'
842+ if self .use_new_lapack :
843+ return '$NEWLAPACK' if self .interface == 'lp64' else '$NEWLAPACK$ILP64'
844+ else :
845+ return ''
826846
827847
828848class MKLMixin (_BLASLAPACKMixinBase ):
0 commit comments