|
2 | 2 |
|
3 | 3 | project('cdba', |
4 | 4 | 'c', |
| 5 | + license : [ 'BSD-3-Clause'], |
| 6 | + meson_version : '>= 0.43.0', # for compiler.get_supported_arguments() |
5 | 7 | default_options: [ |
6 | 8 | 'warning_level=2', # sets -Wextra |
7 | 9 | 'buildtype=release', |
8 | 10 | ]) |
9 | 11 |
|
| 12 | +# Set advanced compiler flags |
10 | 13 | compiler = meson.get_compiler('c') |
11 | 14 |
|
12 | | -# If compiler variables are detectable, add some selected ones |
13 | | -if meson.version().version_compare('>=0.43.0') |
14 | | - base_cflags = ['-Wno-unused-parameter', |
15 | | - '-Wno-unused-result', |
16 | | - '-Wno-missing-field-initializers', |
17 | | - '-Wno-sign-compare', |
18 | | - '-Wundef', |
19 | | - '-Wnull-dereference', |
20 | | - '-Wdouble-promotion', |
21 | | - '-Wshadow', |
22 | | - '-Wpointer-arith', |
23 | | - '-Wwrite-strings', |
24 | | - '-Wstrict-overflow=4'] |
| 15 | +compiler_cflags = ['-Wno-unused-parameter', |
| 16 | + '-Wno-unused-result', |
| 17 | + '-Wno-missing-field-initializers', |
| 18 | + '-Wno-sign-compare', |
| 19 | + '-Wundef', |
| 20 | + '-Wnull-dereference', |
| 21 | + '-Wdouble-promotion', |
| 22 | + '-Wshadow', |
| 23 | + '-Wpointer-arith', |
| 24 | + '-Wwrite-strings', |
| 25 | + '-Wstrict-overflow=4'] |
25 | 26 |
|
26 | | - if compiler.get_id() == 'gcc' |
27 | | - compiler_cflags = ['-Werror', # Only set it on GCC |
28 | | - '-Wformat-signedness', |
29 | | - '-Wduplicated-cond', |
30 | | - '-Wduplicated-branches', |
31 | | - '-Wvla-larger-than=1', |
32 | | - '-Walloc-zero', |
33 | | - '-Wunsafe-loop-optimizations', |
34 | | - '-Wcast-align', |
35 | | - '-Wlogical-op', |
36 | | - '-Wjump-misses-init'] |
37 | | - elif compiler.get_id() == 'clang' |
38 | | - # TODO add clang specific options |
39 | | - compiler_cflags = [] |
40 | | - endif |
41 | | - |
42 | | - add_global_arguments(compiler.get_supported_arguments(base_cflags), |
43 | | - compiler.get_supported_arguments(compiler_cflags), |
44 | | - language: 'c') |
| 27 | +# TODO add clang specific options |
| 28 | +if compiler.get_id() == 'gcc' |
| 29 | + compiler_cflags += ['-Werror', # Only set it on GCC |
| 30 | + '-Wformat-signedness', |
| 31 | + '-Wduplicated-cond', |
| 32 | + '-Wduplicated-branches', |
| 33 | + '-Wvla-larger-than=1', |
| 34 | + '-Walloc-zero', |
| 35 | + '-Wunsafe-loop-optimizations', |
| 36 | + '-Wcast-align', |
| 37 | + '-Wlogical-op', |
| 38 | + '-Wjump-misses-init'] |
45 | 39 | endif |
46 | 40 |
|
| 41 | +add_global_arguments(compiler.get_supported_arguments(compiler_cflags), |
| 42 | + language: 'c') |
| 43 | + |
47 | 44 | client_srcs = ['cdba.c', |
48 | 45 | 'circ_buf.c'] |
49 | 46 | executable('cdba', |
|
0 commit comments