Skip to content
This repository was archived by the owner on Nov 5, 2023. It is now read-only.

Unconditionally specify C++17 #95

Merged
merged 2 commits into from
Jan 2, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 2 additions & 14 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,24 +125,13 @@ def has_flag(compiler, flagname):
return True


def cpp_flag(compiler):
"""Return the -std=c++[11/14/17] compiler flag.

The highest version available is preferred.
"""
if has_flag(compiler, "-std=c++17"):
return "-std=c++17"
else:
raise RuntimeError("Unsupported compiler -- at least C++17 support is needed!")


class BuildExt(build_ext):
"""A custom build extension for adding compiler-specific options."""

c_opts = {"msvc": ["/EHsc", "/DNOMINMAX"], "unix": []}
c_opts = {"msvc": ["/EHsc", "/DNOMINMAX", "/std:c++17"], "unix": ["-std=c++17"]}

if sys.platform == "darwin":
c_opts["unix"] += ["-stdlib=libc++", "-mmacosx-version-min=10.7"]
c_opts["unix"] += ["-stdlib=libc++", "-mmacosx-version-min=10.14"]

def build_extensions(self):
ct = self.compiler.compiler_type
Expand All @@ -155,7 +144,6 @@ def build_extensions(self):
opts.append("-g0") # remove debug symbols
else:
opts.append("-O0")
opts.append(cpp_flag(self.compiler))
if has_flag(self.compiler, "-fvisibility=hidden"):
opts.append("-fvisibility=hidden")
if sys.platform != "darwin":
Expand Down