diff options
author | Lawrence D'Anna <lawrence_danna@apple.com> | 2020-07-09 18:39:23 -0700 |
---|---|---|
committer | Lawrence D'Anna <lawrence_danna@apple.com> | 2020-07-09 18:39:23 -0700 |
commit | fc9349e8aa5a533ff51f5ec6c592e8024f2d727e (patch) | |
tree | 910cf744cf7d7fb6cf4b2349dce140d8b65b0199 /setup.py | |
parent | c5d0cc50b6cded01068108f6f2a87ab363cdee74 (diff) | |
download | cffi-fc9349e8aa5a533ff51f5ec6c592e8024f2d727e.tar.gz |
MacOS 11, arm64, use system libffi
Use the system libffi if deployment target is at least 10.15
Diffstat (limited to 'setup.py')
-rw-r--r-- | setup.py | 12 |
1 files changed, 11 insertions, 1 deletions
@@ -71,6 +71,10 @@ def get_config(): config = Distribution().get_command_obj('config') return config +def macosx_deployment_target(): + from distutils.sysconfig import get_config_var + return tuple(map(int, get_config_var("MACOSX_DEPLOYMENT_TARGET").split('.'))) + def ask_supports_thread(): config = get_config() ok = (sys.platform != 'win32' and @@ -145,7 +149,13 @@ if COMPILE_LIBFFI: sources.extend(os.path.join(COMPILE_LIBFFI, filename) for filename in _filenames) else: - use_pkg_config() + if 'darwin' in sys.platform and macosx_deployment_target() >= (10, 15): + # use libffi from Mac OS SDK + extra_compile_args += ['-iwithsysroot/usr/include/ffi'] + define_macros += [('CFFI_TRUST_LIBFFI', '1')] + libraries += ['ffi'] + else: + use_pkg_config() ask_supports_thread() ask_supports_sync_synchronize() |