summaryrefslogtreecommitdiff
path: root/numpy/_build_utils
diff options
context:
space:
mode:
authorRussell Keith-Magee <russell@keith-magee.com>2018-03-04 15:45:09 +0800
committerRussell Keith-Magee <russell@keith-magee.com>2018-03-04 15:45:09 +0800
commit13b3b3e9a1e920cf343db52b769624c241dbbe92 (patch)
tree73fa99602c810ada2a4dfb9e033c320b6621fc34 /numpy/_build_utils
parent2d44de214d63c5fc610392d1e18fa93615b12c1a (diff)
downloadnumpy-13b3b3e9a1e920cf343db52b769624c241dbbe92.tar.gz
BLD: Add configuration to allow cross platform builds for iOS.
When building NumPy for iOS, you build on macOS, with compiler flags to target iOS or the iOS simulator. However, setup.py runs on macOS, so sys.platform == 'darwin', regardless of the platform being targetted. distutils provides an environment variable - _PYTHON_HOST_PLATFORM - to indicate when you are building for a different platform. This patches uses that variable to identify cross-platform builds and disable macOS specific features. The patch also renames an internal method in strfuncs to avoid a collision with a symbol in iOS's standard library, and includes math.h to avoid errors about undefined symbols.
Diffstat (limited to 'numpy/_build_utils')
-rw-r--r--numpy/_build_utils/apple_accelerate.py5
1 files changed, 5 insertions, 0 deletions
diff --git a/numpy/_build_utils/apple_accelerate.py b/numpy/_build_utils/apple_accelerate.py
index 2d5bbab5e..36dd7584a 100644
--- a/numpy/_build_utils/apple_accelerate.py
+++ b/numpy/_build_utils/apple_accelerate.py
@@ -8,8 +8,13 @@ __all__ = ['uses_accelerate_framework', 'get_sgemv_fix']
def uses_accelerate_framework(info):
""" Returns True if Accelerate framework is used for BLAS/LAPACK """
+ # If we're not building on Darwin (macOS), don't use Accelerate
if sys.platform != "darwin":
return False
+ # If we're building on macOS, but targeting a different platform,
+ # don't use Accelerate.
+ if os.getenv('_PYTHON_HOST_PLATFORM', None):
+ return False
r_accelerate = re.compile("Accelerate")
extra_link_args = info.get('extra_link_args', '')
for arg in extra_link_args: