Enable using CMD when building cpp extensions on Windows

Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/17706

Differential Revision: D14346482

Pulled By: ezyang

fbshipit-source-id: 7c85e51c701f6c0947ad324ef19fafda40ae1cb9
This commit is contained in:
peter 2019-03-06 14:40:05 -08:00 committed by Facebook Github Bot
parent a87d475c2f
commit c78da0c6ed
3 changed files with 3 additions and 6 deletions

View file

@ -113,9 +113,7 @@ This type of extension has better support compared with
the previous one. However, it still needs some manual
configuration. First, you should open the
**x86_x64 Cross Tools Command Prompt for VS 2017**.
And then, you can open the Git-Bash in it. It is
usually located in ``C:\Program Files\Git\git-bash.exe``.
Finally, you can start your compiling process.
And then, you can start your compiling process.
Installation
------------

View file

@ -404,9 +404,8 @@ def get_selected_tests(options):
selected_tests = exclude_tests(options.exclude, selected_tests)
if sys.platform == 'win32' and not options.ignore_win_blacklist:
ostype = os.environ.get('MSYSTEM')
target_arch = os.environ.get('VSCMD_ARG_TGT_ARCH')
if ostype != 'MINGW64' or target_arch != 'x64':
if target_arch != 'x64':
WINDOWS_BLACKLIST.append('cpp_extensions')
selected_tests = exclude_tests(WINDOWS_BLACKLIST, selected_tests, 'on Windows')

View file

@ -318,7 +318,7 @@ class BuildExtension(build_ext, object):
'/wd4819', '-Xcompiler', '/MD'
] + include_list + cflags
elif isinstance(self.cflags, dict):
cflags = self.cflags['cxx']
cflags = self.cflags['cxx'] + ['/MD']
cmd += cflags
elif isinstance(self.cflags, list):
cflags = self.cflags