From c78da0c6ede91f8bb778bb566e5aca1d57fc6cf5 Mon Sep 17 00:00:00 2001 From: peter Date: Wed, 6 Mar 2019 14:40:05 -0800 Subject: [PATCH] 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 --- docs/source/notes/windows.rst | 4 +--- test/run_test.py | 3 +-- torch/utils/cpp_extension.py | 2 +- 3 files changed, 3 insertions(+), 6 deletions(-) diff --git a/docs/source/notes/windows.rst b/docs/source/notes/windows.rst index d8648b3..428932b 100644 --- a/docs/source/notes/windows.rst +++ b/docs/source/notes/windows.rst @@ -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 ------------ diff --git a/test/run_test.py b/test/run_test.py index 6e91b38..c82fa31 100644 --- a/test/run_test.py +++ b/test/run_test.py @@ -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') diff --git a/torch/utils/cpp_extension.py b/torch/utils/cpp_extension.py index 86175b6..801c3c0 100644 --- a/torch/utils/cpp_extension.py +++ b/torch/utils/cpp_extension.py @@ -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 -- 2.7.4