Debian Codegraph @

src/c-rbtree/subprojects/libcstdaux-1/meson.build

raw
1 #
2 # Global Project Setup
3 #
4
5 project(
6 'c-stdaux',
7 'c',
8 default_options: [
9 'c_std=c11'
10 ],
11 license: 'Apache',
12 meson_version: '>=0.60.0',
13 version: '1.4.0',
14 )
15 major = meson.project_version().split('.')[0]
16 project_description = 'Auxiliary macros and functions for the C standard library'
17
18 mod_pkgconfig = import('pkgconfig')
19
20 #
21 # CFLAGS
22 #
23 # We have a set of compiler flags for GCC and CLANG which adjust their warnings
24 # and behavior to our coding-style.
25 #
26 # This variable is exported to dependent projects via meson for them to use as
27 # well. Since these exports are limited to strings, we need to be careful that
28 # the individual entries do not contain spaces (see the assertion below).
29 #
30
31 cflags = meson.get_compiler('c').get_supported_arguments(
32 # Enable GNU features of our dependencies. See feature_test_macros(7).
33 '-D_GNU_SOURCE',
34
35 # Prevent CLANG from complaining that alignof-expressions are GNU-only.
36 '-Wno-gnu-alignof-expression',
37 # Never complain about *MAYBE* uninit variables. This is very flaky and
38 # produces bogus results with LTO.
39 '-Wno-maybe-uninitialized',
40 # Do not complain about unknown GCC/CLANG warnings.
41 '-Wno-unknown-warning-option',
42 # There is no standardized way to mark unused arguments, so never
43 # complain about them.
44 '-Wno-unused-parameter',
45
46 # Preprocessor evaluations often lead to warnings about comparisons
47 # that are always true/false. Make sure they do not break a build but
48 # keep them on for diagnostics.
49 '-Wno-error=type-limits',
50 # As we use designated field-initializers, this warning should never
51 # trigger, but still does on GCC in combination with some other
52 # preprocessor checks. Lets just make sure it does not break builds.
53 '-Wno-error=missing-field-initializers',
54
55 # Warn if we ever use `__DATE__` and similar in our build. We want
56 # reproducible builds.
57 '-Wdate-time',
58 # We strictly follow decl-before-statements, so check it.
59 '-Wdeclaration-after-statement',
60 # More strict logical-op sanity checks.
61 '-Wlogical-op',
62 # Loudly complain about missing include-directories.
63 '-Wmissing-include-dirs',
64 # We want hints about noreturn functions, so warn about them.
65 '-Wmissing-noreturn',
66 # Warn if an extern-decl is inside a function. We want imports as
67 # global attributes, never as local ones.
68 '-Wnested-externs',
69 # Warn about redundant declarations. We want declarations in headers
70 # and want them to be unique.
71 '-Wredundant-decls',
72 # Warn about shadowed variables so we do not accidentally override
73 # variables of parent scopes and thus confuse macros.
74 '-Wshadow',
75 # Warn about aliasing violations. Level-3 produces the least false
76 # positives, but is the slowest. Force it to avoid breaking -Werror
77 # builds.
78 '-Wstrict-aliasing=3',
79 # Suggest 'noreturn' attributes. They are useful, we want them!
80 '-Wsuggest-attribute=noreturn',
81 # Warn about undefined identifiers in preprocessor conditionals.
82 '-Wundef',
83 # Make sure literal strings are considered 'const'.
84 '-Wwrite-strings',
85 )
86 assert(not ''.join(cflags).contains(' '), 'Malformed compiler flags.')
87 add_project_arguments(cflags, language: 'c')
88
89 #
90 # Version Scripts
91 #
92
93 use_version_scripts = get_option('version-scripts')
94 if use_version_scripts == 'auto'
95 use_version_scripts = meson.get_compiler('c').has_link_argument(
96 '-Wl,--version-script=' + (meson.current_source_dir() / 'src/libcstdaux.sym')
97 ) ? 'yes' : 'no'
98 endif
99
100 #
101 # Subdir Delegation
102 #
103
104 subdir('src')
105
106 #
107 # Meson Subproject Configuration
108 #
109
110 meson.override_dependency('libcstdaux-'+major, libcstdaux_dep, static: true)