From 8a3105e9c45f916516c6d66a17592de7db4c46fb Mon Sep 17 00:00:00 2001 From: Jerome Robert Date: Thu, 25 Mar 2021 22:24:45 +0100 Subject: [PATCH] Fix Pybind11Extension on mingw64 * 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 c69064ca50..84a4584c5d 100644 --- a/pybind11/setup_helpers.py +++ b/pybind11/setup_helpers.py @@ -47,6 +47,7 @@ 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.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++{}"