Skip to content

Commit

Permalink
use CFLAGS envvar instead of extra_compile_args
Browse files Browse the repository at this point in the history
  • Loading branch information
methane committed May 4, 2024
1 parent 4206af8 commit 8e813d5
Showing 1 changed file with 7 additions and 3 deletions.
10 changes: 7 additions & 3 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,12 +51,17 @@ def __init__(self, *args, **kwargs):

libraries = []
macros = []
extra_compile_args = []

if sys.platform == "win32":
libraries.append("ws2_32")
macros = [("__LITTLE_ENDIAN__", "1")]
extra_compile_args = ["/std:c++20"]
cflags = os.environ.get("CFLAGS")
cxx20flag = "/std:c++20"
if cflags is None:
cflags = cxx20flag
elif cxx20flag not in cflags:
cflags += " " + cxx20flag
os.environ["CFLAGS"] = cflags

ext_modules = []
if not PYPY and not os.environ.get("MSGPACK_PUREPYTHON"):
Expand All @@ -67,7 +72,6 @@ def __init__(self, *args, **kwargs):
libraries=libraries,
include_dirs=["."],
define_macros=macros,
extra_compile_args=extra_compile_args,
)
)
del libraries, macros
Expand Down

0 comments on commit 8e813d5

Please sign in to comment.