-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcxx17.py
More file actions
35 lines (29 loc) · 1.01 KB
/
Copy pathcxx17.py
File metadata and controls
35 lines (29 loc) · 1.01 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#! /usr/bin/env python
# encoding: utf-8
def configure(conf):
def get_param(varname, default):
return getattr(Options.options, varname, "") or default
cxx17_fragment = "#include <memory>\nint main() { std::make_unique<int>(); enum class color {red, blue}; }"
flags = ["-std=c++17", "-std=c++1y"]
if conf.options.cxx17_flag:
flags = [conf.options.cxx17_flag]
found_cxx17 = False
for flag in flags:
try:
conf.check_cxx(
msg="Checking C++ 17 flag " + flag,
fragment=cxx17_fragment,
cxxflags=flag,
linkflags=flag,
uselib_store="cxx17",
)
except conf.errors.ConfigurationError:
continue
else:
found_cxx17 = True
break
if not found_cxx17:
conf.fatal("Could not find C++ 17 flag")
def options(opt):
cxx17 = opt.add_option_group("C++ 17 Options")
cxx17.add_option("--cxx17-flag", help="Flag to enable C++ 17")