@@ -23,11 +23,49 @@ project(
23
23
meson_version : ' >=0.51' ,
24
24
default_options : [
25
25
' default_library=both' ,
26
+ ' warning_level=3' ,
26
27
],
27
28
)
28
29
29
30
cxx = meson .get_compiler(' cpp' )
30
31
32
+
33
+ if get_option (' buildtype' ) == ' debug'
34
+ add_project_arguments (
35
+ [
36
+ ' -Wzero-as-null-pointer-constant' ,
37
+ ' -Wlogical-not-parentheses' ,
38
+ ' -Db_sanitize=address,undefined'
39
+ ],
40
+ language : ' cpp'
41
+ )
42
+
43
+ add_project_arguments (' -fno-omit-frame-pointer' , language : ' cpp' )
44
+ add_project_link_arguments (' -fno-omit-frame-pointer' , language : ' cpp' )
45
+
46
+ sanitizer = get_option (' sanitizer' )
47
+ if sanitizer == ' asan'
48
+ message (' Enabling ASan + UBSan + LSan' )
49
+ add_project_arguments (' -Db_sanitize=address,undefined' , language : ' cpp' )
50
+
51
+ message (' Adding "-fsanitize-address-use-after-scope" argument (ignore the subsequent warnings).' )
52
+ add_project_arguments (' -fsanitize-address-use-after-scope' , language : ' cpp' )
53
+ add_project_link_arguments (' -fsanitize-address-use-after-scope' , ' -fno-omit-frame-pointer' , language : ' cpp' )
54
+
55
+ elif sanitizer == ' msan'
56
+ message (' Enabling Memory Sanitizer (MSan)' )
57
+ add_project_arguments (' -Db_sanitize=memory' , language : ' cpp' )
58
+
59
+ elif sanitizer == ' tsan'
60
+ message (' Enabling Thread Sanitizer (TSan)' )
61
+ add_project_arguments (' -Db_sanitize=thread' , language : ' cpp' )
62
+
63
+ else
64
+ message (' No sanitizers enabled' )
65
+ endif
66
+ endif
67
+
68
+
31
69
deps = []
32
70
foreach lib : [' cblas' , ' lapacke' ]
33
71
this_dep = dependency (lib, required : false )
0 commit comments