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
This commit is contained in:
Jerome Robert 2021-04-02 19:26:17 +02:00 committed by GitHub
parent c2db53da56
commit 1259db6fd9
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 2 additions and 1 deletions

View File

@ -47,6 +47,7 @@ import tempfile
import threading import threading
import platform import platform
import warnings import warnings
import sysconfig
try: try:
from setuptools.command.build_ext import build_ext as _build_ext from setuptools.command.build_ext import build_ext as _build_ext
@ -59,7 +60,7 @@ import distutils.errors
import distutils.ccompiler import distutils.ccompiler
WIN = sys.platform.startswith("win32") WIN = sys.platform.startswith("win32") and sysconfig.get_platform() != "mingw"
PY2 = sys.version_info[0] < 3 PY2 = sys.version_info[0] < 3
MACOS = sys.platform.startswith("darwin") MACOS = sys.platform.startswith("darwin")
STD_TMPL = "/std:c++{}" if WIN else "-std=c++{}" STD_TMPL = "/std:c++{}" if WIN else "-std=c++{}"