diff --git a/.github/workflows/cibuildwheel.yml b/.github/workflows/cibuildwheel.yml index 5dd2d0dea942..f484793f1450 100644 --- a/.github/workflows/cibuildwheel.yml +++ b/.github/workflows/cibuildwheel.yml @@ -39,6 +39,7 @@ jobs: CIBW_MANYLINUX_X86_64_IMAGE: manylinux1 CIBW_MANYLINUX_I686_IMAGE: manylinux1 CIBW_BEFORE_BUILD: pip install numpy==1.15 + MPL_DISABLE_FH4: "yes" - name: Build wheels for CPython 3.6 run: | @@ -48,6 +49,7 @@ jobs: CIBW_MANYLINUX_X86_64_IMAGE: manylinux1 CIBW_MANYLINUX_I686_IMAGE: manylinux1 CIBW_BEFORE_BUILD: pip install numpy==1.15 + MPL_DISABLE_FH4: "yes" if: > startsWith(github.ref, 'refs/heads/v3.3') || startsWith(github.ref, 'refs/tags/v3.3') diff --git a/setup.py b/setup.py index 5d8486dc9a20..5fef78641607 100644 --- a/setup.py +++ b/setup.py @@ -169,6 +169,14 @@ def build_extensions(self): self.compiler.compiler_so.remove('-Wstrict-prototypes') except (ValueError, AttributeError): pass + if (self.compiler.compiler_type == 'msvc' and + os.environ.get('MPL_DISABLE_FH4')): + # Disable FH4 Exception Handling implementation so that we don't + # require VCRUNTIME140_1.dll. For more details, see: + # https://devblogs.microsoft.com/cppblog/making-cpp-exception-handling-smaller-x64/ + # https://github.com/joerick/cibuildwheel/issues/423#issuecomment-677763904 + for ext in self.extensions: + ext.extra_compile_args.append('/d2FH4-') env = self.add_optimization_flags() for package in good_packages: