MCPcopy Create free account
hub / github.com/pybind/pybind11 / auto_cpp_level

Function auto_cpp_level

pybind11/setup_helpers.py:253–268  ·  view source on GitHub ↗

Return the max supported C++ std level (17, 14, or 11). Returns latest on Windows.

(compiler: Any)

Source from the content-addressed store, hash-verified

251
252@lru_cache
253def auto_cpp_level(compiler: Any) -> str | int:
254 """
255 Return the max supported C++ std level (17, 14, or 11). Returns latest on Windows.
256 """
257
258 if WIN:
259 return "latest"
260
261 levels = [17, 14, 11]
262
263 for level in levels:
264 if has_flag(compiler, STD_TMPL.format(level)):
265 return level
266
267 msg = "Unsupported compiler -- at least C++11 support is needed!"
268 raise RuntimeError(msg)
269
270
271class build_ext(_build_ext): # noqa: N801

Callers 1

build_extensionsMethod · 0.85

Calls 2

has_flagFunction · 0.85
formatMethod · 0.45

Tested by

no test coverage detected