summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorCharles Harris <charlesr.harris@gmail.com>2017-10-16 09:30:20 -0600
committerGitHub <noreply@github.com>2017-10-16 09:30:20 -0600
commit075b162fbbcde754bef4ce711fb118789df6e026 (patch)
treedbc48ef5bb80b10ce5f43ba7b9ab08efbc0497e7
parent30aff21bc8ed8c9467788e17e350988922574940 (diff)
parentbd502bbbc9dde146f1da25612ace7b1c196dd837 (diff)
downloadnumpy-075b162fbbcde754bef4ce711fb118789df6e026.tar.gz
Merge pull request #9854 from xoviat/distutils-vcpkg
BLD: distutils: auto-find vcpkg include and library directories
-rw-r--r--numpy/distutils/system_info.py28
1 files changed, 28 insertions, 0 deletions
diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py
index 683b15daa..01d547d8e 100644
--- a/numpy/distutils/system_info.py
+++ b/numpy/distutils/system_info.py
@@ -211,6 +211,34 @@ if sys.platform == 'win32':
default_src_dirs = ['.']
default_x11_lib_dirs = []
default_x11_include_dirs = []
+ vcpkg_include_dirs = [
+ 'include',
+ 'include/suitesparse',
+ ]
+ vcpkg_lib_dirs = [
+ 'lib',
+ ]
+ 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.
+ # We also don't re-implement shutil.which for Python 2.7 because
+ # vcpkg doesn't support MSVC 2008.
+ vcpkg = shutil.which('vcpkg')
+ if vcpkg:
+ vcpkg_dir = os.path.dirname(vcpkg)
+ if platform.architecture() == '32bit':
+ specifier = 'x86'
+ else:
+ specifier = 'x64'
+ vcpkg_root = os.path.join(
+ vcpkg_dir, 'installed', specifier + '-windows')
+
+ default_lib_dirs.extend(
+ os.path.join(
+ vcpkg_root, d.replace('/', os.sep)) for d in vcpkg_lib_dirs)
+ default_include_dirs.extend(
+ os.path.join(
+ vcpkg_root, d.replace('/', os.sep)) for d in vcpkg_include_dirs)
else:
default_lib_dirs = libpaths(['/usr/local/lib', '/opt/lib', '/usr/lib',
'/opt/local/lib', '/sw/lib'], platform_bits)