Skip to content

Commit

Permalink
Unconditionally specify C++17
Browse files Browse the repository at this point in the history
  • Loading branch information
auscompgeek committed Jan 2, 2021
1 parent d5d668a commit dd4a752
Showing 1 changed file with 1 addition and 13 deletions.
14 changes: 1 addition & 13 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,21 +125,10 @@ 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"]
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

0 comments on commit dd4a752

Please sign in to comment.