1
1
project (
2
2
' tomlplusplus' ,
3
3
' cpp' ,
4
- version : ' 0.4.4 ' ,
4
+ version : ' 0.5.0 ' ,
5
5
license : ' MIT' ,
6
6
default_options : [
7
7
' cpp_std=c++17' ,
@@ -11,67 +11,6 @@ project(
11
11
]
12
12
)
13
13
14
- compiler = meson .get_compiler(' cpp' )
15
- message ([' compiler ID: ' , compiler.get_id()])
16
-
17
- if compiler.get_id() == ' gcc'
18
- add_project_arguments ([
19
- ' -g0' ,
20
- ' -fmax-errors=5' ,
21
- ' -Wno-init-list-lifetime'
22
- ],
23
- language : ' cpp'
24
- )
25
- endif
26
-
27
- if compiler.get_id() == ' clang'
28
- add_project_arguments ([
29
- ' -g0' ,
30
- ' -ferror-limit=5' ,
31
- ' -fchar8_t' ,
32
- # '-Weverything',
33
- ' -Wno-c++98-compat' ,
34
- ' -Wno-c++98-compat-pedantic' ,
35
- ' -Wno-float-equal' ,
36
- ' -Wno-switch-enum' ,
37
- ' -Wno-documentation-unknown-command' ,
38
- ' -Wno-padded' ,
39
- ' -Wno-weak-vtables' ,
40
- ' -Wno-double-promotion'
41
- #, '-ftime-trace'
42
- ],
43
- language : ' cpp'
44
- )
45
- endif
46
-
47
- if compiler.get_id() == ' intel-cl'
48
- add_project_arguments ([
49
- ' /Qoption,cpp,--unicode_source_kind,UTF-8' ,
50
- ' /std=c++latest' ,
51
- ' /wd82' , # storage class is not first
52
- ' /wd280' , # selector expression is constant (why the fuck is that a warning?)
53
- ' /wd411' , # class provides no constructor (duh, it's an aggregate)
54
- ' /wd1011' , # missing return statement (false negative)
55
- ' /wd1628' , # function marked [[noreturn]] returns (false positive)
56
- ' /wd3280' # declaration hides member (triggered in Catch2)
57
- ],
58
- language : ' cpp'
59
- )
60
- endif
61
-
62
- compiler_supports_char8_strings = compiler.compiles('''
63
- #include <string_view>
64
- #include <string>
65
- using namespace std::string_view_literals;
66
- std::u8string func()
67
- {
68
- return std::u8string{ u8"this is a test."sv };
69
- }
70
- ''' ,
71
- name : ' char8 string check' ,
72
- args : [ ' -std=c++2a' ]
73
- )
74
-
75
14
tomlplusplus_dep = declare_dependency (
76
15
include_directories : include_directories (' include' ),
77
16
version : meson .project_version(),
84
23
build_tests = get_option (' BUILD_TESTS' ).enabled()
85
24
endif
86
25
87
- if build_tests
88
- inc = include_directories ( ' include ' , ' extern ' )
89
- subdir ( ' tests ' )
26
+ build_examples = false
27
+ if get_option ( ' BUILD_EXAMPLES ' ).auto( )
28
+ build_examples = ( not meson .is_subproject() )
90
29
else
91
- message (' Not building tests' )
30
+ build_examples = get_option (' BUILD_EXAMPLES' ).enabled()
31
+ endif
32
+
33
+ if build_tests or build_examples
34
+
35
+ compiler = meson .get_compiler(' cpp' )
36
+ message ([' compiler ID: ' , compiler.get_id()])
37
+ message ([' compiler version: ' , compiler.version()])
38
+
39
+ if compiler.get_id() == ' gcc'
40
+ add_project_arguments ([
41
+ ' -g0' ,
42
+ ' -fmax-errors=5' ,
43
+ ' -Wno-init-list-lifetime'
44
+ ],
45
+ language : ' cpp'
46
+ )
47
+ endif
48
+
49
+ if compiler.get_id() == ' clang'
50
+ add_project_arguments ([
51
+ ' -g0' ,
52
+ ' -ferror-limit=5' ,
53
+ ' -fchar8_t' ,
54
+ # '-Weverything',
55
+ ' -Wno-c++98-compat' ,
56
+ ' -Wno-c++98-compat-pedantic' ,
57
+ ' -Wno-float-equal' ,
58
+ ' -Wno-switch-enum' ,
59
+ ' -Wno-documentation-unknown-command' ,
60
+ ' -Wno-padded' ,
61
+ ' -Wno-weak-vtables' ,
62
+ ' -Wno-double-promotion'
63
+ #, '-ftime-trace'
64
+ ],
65
+ language : ' cpp'
66
+ )
67
+ endif
68
+
69
+ if compiler.get_id() == ' intel-cl'
70
+ add_project_arguments ([
71
+ ' /Qoption,cpp,--unicode_source_kind,UTF-8' ,
72
+ ' /std=c++latest' ,
73
+ ' /wd82' , # storage class is not first
74
+ ' /wd280' , # selector expression is constant (why the fuck is that a warning?)
75
+ ' /wd411' , # class provides no constructor (duh, it's an aggregate)
76
+ ' /wd1011' , # missing return statement (false negative)
77
+ ' /wd1628' , # function marked [[noreturn]] returns (false positive)
78
+ ' /wd3280' # declaration hides member (triggered in Catch2)
79
+ ],
80
+ language : ' cpp'
81
+ )
82
+ endif
83
+
84
+ inc = include_directories (' include' , ' extern' )
85
+
86
+ if build_tests
87
+ subdir (' tests' )
88
+ else
89
+ message (' Not building tests' )
90
+ endif
91
+
92
+ if build_examples
93
+ subdir (' examples' )
94
+ else
95
+ message (' Not building examples' )
96
+ endif
97
+
92
98
endif
93
99
94
- # subdir('examples')
0 commit comments