From 1259db6fd99bc60228ef0e4af2e379f8e86abc1d Mon Sep 17 00:00:00 2001 From: Jerome Robert Date: Fri, 2 Apr 2021 19:26:17 +0200 Subject: [PATCH] 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 --- pybind11/setup_helpers.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/pybind11/setup_helpers.py b/pybind11/setup_helpers.py index c69064ca..84a4584c 100644 --- a/pybind11/setup_helpers.py +++ b/pybind11/setup_helpers.py @@ -47,6 +47,7 @@ import tempfile import threading import platform import warnings +import sysconfig try: from setuptools.command.build_ext import build_ext as _build_ext @@ -59,7 +60,7 @@ import distutils.errors import distutils.ccompiler -WIN = sys.platform.startswith("win32") +WIN = sys.platform.startswith("win32") and sysconfig.get_platform() != "mingw" PY2 = sys.version_info[0] < 3 MACOS = sys.platform.startswith("darwin") STD_TMPL = "/std:c++{}" if WIN else "-std=c++{}"