Skip to content

Commit 1259db6

Browse files
authored
Fix Pybind11Extension on mingw64 (#2921)
* Pybind11Extension add the "/EHsc /bigobj /std:c++14" flags on Windows. This is good for Visual C++ but not for Mingw. * According https://github.com/msys2/MINGW-packages/blob/master/mingw-w64-python2/0410-MINGW-build-extensions-with-GCC.patch sysconfig.get_platform() is the way to check for a Mingw64
1 parent c2db53d commit 1259db6

File tree

1 file changed

+2
-1
lines changed

1 file changed

+2
-1
lines changed

pybind11/setup_helpers.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@
4747
import threading
4848
import platform
4949
import warnings
50+
import sysconfig
5051

5152
try:
5253
from setuptools.command.build_ext import build_ext as _build_ext
@@ -59,7 +60,7 @@
5960
import distutils.ccompiler
6061

6162

62-
WIN = sys.platform.startswith("win32")
63+
WIN = sys.platform.startswith("win32") and sysconfig.get_platform() != "mingw"
6364
PY2 = sys.version_info[0] < 3
6465
MACOS = sys.platform.startswith("darwin")
6566
STD_TMPL = "/std:c++{}" if WIN else "-std=c++{}"

0 commit comments

Comments
 (0)