From 842c2c3225c969ffc7ae61e427c50a3484f3623a Mon Sep 17 00:00:00 2001 From: Antoine Martin Date: Tue, 16 Jan 2024 00:36:58 +0700 Subject: [PATCH] fix defaults for mingw builds * we have to set BOOST_USE_WINDOWS_H=1 because of this bug: http://stackoverflow.com/questions/18134148 * remove '/EHsc' and '/FORCE' when compiling with mingw instead of msvc --- aksetup_helper.py | 3 +++ setup.py | 7 +++++-- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/aksetup_helper.py b/aksetup_helper.py index 8c9bcec5..784ef3b7 100644 --- a/aksetup_helper.py +++ b/aksetup_helper.py @@ -643,6 +643,9 @@ def set_up_shipped_boost_if_requested(project_name, conf, source_path=None, "boost": "%sboost" % project_name, } + if os.environ.get("MINGW_CHOST"): + defines["BOOST_USE_WINDOWS_H"] = 1 + if boost_chrono is False: defines["BOOST_THREAD_DONT_USE_CHRONO"] = 1 elif boost_chrono == "header_only": diff --git a/setup.py b/setup.py index fa45fa2d..3a4c388a 100644 --- a/setup.py +++ b/setup.py @@ -54,8 +54,11 @@ def get_config_schema(): # https://github.com/inducer/pycuda/issues/113 lib64 = "lib/x64" - cxxflags_default.extend(["/EHsc"]) - ldflags_default.extend(["/FORCE"]) + import os + if not os.environ.get("MINGW_CHOST"): + cxxflags_default.extend(["/EHsc"]) + ldflags_default.extend(["/FORCE"]) + elif "darwin" in sys.platform: import glob