forked from davidsd/sdpb
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcxx17.py
More file actions
30 lines (26 loc) · 1 KB
/
cxx17.py
File metadata and controls
30 lines (26 loc) · 1 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
#! /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 <string>\n#include <optional>\nint main() {std::optional<int> i;\nusing namespace std::literals;\"hello\"s; }"
flags=['','-std=c++17','-std=c++1z']
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')