diff options
author | xoviat <xoviat@users.noreply.github.com> | 2017-10-11 15:43:40 -0500 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-10-11 15:43:40 -0500 |
commit | ea083bdbd39d37023f7ab7b366d5a9cd0d9707b2 (patch) | |
tree | 42a03203075929f64d0ddfb676d927535862da40 | |
parent | 1f4ed32fdf0cf2f197d9a8da5698580ed6ec7683 (diff) | |
download | numpy-ea083bdbd39d37023f7ab7b366d5a9cd0d9707b2.tar.gz |
BLD: distutils: auto-find vcpkg include and library directories
-rw-r--r-- | numpy/distutils/system_info.py | 18 |
1 files changed, 18 insertions, 0 deletions
diff --git a/numpy/distutils/system_info.py b/numpy/distutils/system_info.py index 683b15daa..1548d8e20 100644 --- a/numpy/distutils/system_info.py +++ b/numpy/distutils/system_info.py @@ -211,6 +211,24 @@ if sys.platform == 'win32': default_src_dirs = ['.'] default_x11_lib_dirs = [] default_x11_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. + # 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.append(os.path.join(vcpkg_root, 'lib')) + default_include_dirs.append(os.path.join(vcpkg_root, 'include')) else: default_lib_dirs = libpaths(['/usr/local/lib', '/opt/lib', '/usr/lib', '/opt/local/lib', '/sw/lib'], platform_bits) |