Enable using CMD when building cpp extensions on Windows
authorpeter <peterghost86@gmail.com>
Wed, 6 Mar 2019 22:40:05 +0000 (14:40 -0800)
committerFacebook Github Bot <facebook-github-bot@users.noreply.github.com>
Wed, 6 Mar 2019 22:45:31 +0000 (14:45 -0800)
Summary: Pull Request resolved: https://github.com/pytorch/pytorch/pull/17706

Differential Revision: D14346482

Pulled By: ezyang

fbshipit-source-id: 7c85e51c701f6c0947ad324ef19fafda40ae1cb9

docs/source/notes/windows.rst
test/run_test.py
torch/utils/cpp_extension.py

index d8648b3..428932b 100644 (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
 ------------
index 6e91b38..c82fa31 100644 (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')
index 86175b6..801c3c0 100644 (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