diff options
author | Charles Harris <charlesr.harris@gmail.com> | 2018-03-08 18:31:30 -0700 |
---|---|---|
committer | GitHub <noreply@github.com> | 2018-03-08 18:31:30 -0700 |
commit | c486d8d0d496f6b366dc827a3d41ed1e9d593ec8 (patch) | |
tree | 82852b635848f530c349708f071333d164ef9c4a /numpy | |
parent | 876c8525acddd1852238acd432616167d3d14560 (diff) | |
parent | ca3ff7a1b1e988ea11bd5d4f3cd9c3cab2069581 (diff) | |
download | numpy-c486d8d0d496f6b366dc827a3d41ed1e9d593ec8.tar.gz |
Merge pull request #10689 from freakboy3742/iOS-compat
BLD: Add configuration changes to allow cross platform builds for iOS.
Diffstat (limited to 'numpy')
-rw-r--r-- | numpy/_build_utils/apple_accelerate.py | 5 | ||||
-rw-r--r-- | numpy/core/src/multiarray/strfuncs.c | 4 | ||||
-rw-r--r-- | numpy/distutils/system_info.py | 20 | ||||
-rw-r--r-- | numpy/linalg/lapack_lite/f2c.h | 2 |
4 files changed, 21 insertions, 10 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: diff --git a/numpy/core/src/multiarray/strfuncs.c b/numpy/core/src/multiarray/strfuncs.c index 646d15cdb..495d897b2 100644 --- a/numpy/core/src/multiarray/strfuncs.c +++ b/numpy/core/src/multiarray/strfuncs.c @@ -41,7 +41,7 @@ PyArray_SetStringFunction(PyObject *op, int repr) * XXX we do this in multiple places; time for a string library? */ static char * -extend(char **strp, Py_ssize_t n, Py_ssize_t *maxp) +extend_str(char **strp, Py_ssize_t n, Py_ssize_t *maxp) { char *str = *strp; Py_ssize_t new_cap; @@ -71,7 +71,7 @@ dump_data(char **string, Py_ssize_t *n, Py_ssize_t *max_n, char *data, int nd, npy_intp i, N, ret = 0; #define CHECK_MEMORY do { \ - if (extend(string, *n, max_n) == NULL) { \ + if (extend_str(string, *n, max_n) == NULL) { \ ret = -1; \ goto end; \ } \ diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py index 5bda213e7..d12381028 100644 --- a/numpy/distutils/system_info.py +++ b/numpy/distutils/system_info.py @@ -219,21 +219,21 @@ if sys.platform == 'win32': _lib_dirs = [ 'lib', ] - + _include_dirs = [d.replace('/', os.sep) for d in _include_dirs] _lib_dirs = [d.replace('/', os.sep) for d in _lib_dirs] def add_system_root(library_root): """Add a package manager root to the include directories""" global default_lib_dirs global default_include_dirs - + library_root = os.path.normpath(library_root) - + default_lib_dirs.extend( os.path.join(library_root, d) for d in _lib_dirs) default_include_dirs.extend( os.path.join(library_root, d) for d in _include_dirs) - + if sys.version_info >= (3, 3): # VCpkg is the de-facto package manager on windows for C/C++ # libraries. If it is on the PATH, then we append its paths here. @@ -247,7 +247,7 @@ if sys.platform == 'win32': else: specifier = 'x64' - vcpkg_installed = os.path.join(vcpkg_dir, 'installed') + vcpkg_installed = os.path.join(vcpkg_dir, 'installed') for vcpkg_root in [ os.path.join(vcpkg_installed, specifier + '-windows'), os.path.join(vcpkg_installed, specifier + '-windows-static'), @@ -260,7 +260,7 @@ if sys.platform == 'win32': conda_dir = os.path.dirname(conda) add_system_root(os.path.join(conda_dir, '..', 'Library')) add_system_root(os.path.join(conda_dir, 'Library')) - + else: default_lib_dirs = libpaths(['/usr/local/lib', '/opt/lib', '/usr/lib', '/opt/local/lib', '/sw/lib'], platform_bits) @@ -1551,7 +1551,9 @@ class lapack_opt_info(system_info): if not atlas_info: atlas_info = get_info('atlas') - if sys.platform == 'darwin' and not (atlas_info or openblas_info or + if sys.platform == 'darwin' \ + and not os.getenv('_PYTHON_HOST_PLATFORM', None) \ + and not (atlas_info or openblas_info or lapack_mkl_info): # Use the system lapack from Accelerate or vecLib under OSX args = [] @@ -1657,7 +1659,9 @@ class blas_opt_info(system_info): if not atlas_info: atlas_info = get_info('atlas_blas') - if sys.platform == 'darwin' and not (atlas_info or openblas_info or + if sys.platform == 'darwin' \ + and not os.getenv('_PYTHON_HOST_PLATFORM', None) \ + and not (atlas_info or openblas_info or blas_mkl_info or blis_info): # Use the system BLAS from Accelerate or vecLib under OSX args = [] diff --git a/numpy/linalg/lapack_lite/f2c.h b/numpy/linalg/lapack_lite/f2c.h index f5b90cd67..80f1a12b1 100644 --- a/numpy/linalg/lapack_lite/f2c.h +++ b/numpy/linalg/lapack_lite/f2c.h @@ -7,6 +7,8 @@ #ifndef F2C_INCLUDE #define F2C_INCLUDE +#include <math.h> + typedef int integer; typedef char *address; typedef short int shortint; |