|
| 1 | +# SPDX-License-Identifier: GPL-2.0 |
| 2 | + |
| 3 | +project('cdba', |
| 4 | + 'c', |
| 5 | + default_options: [ |
| 6 | + 'warning_level=2', # sets -Wextra |
| 7 | + 'buildtype=release', |
| 8 | + ]) |
| 9 | + |
| 10 | +compiler = meson.get_compiler('c') |
| 11 | + |
| 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'] |
| 25 | + |
| 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') |
| 45 | +endif |
| 46 | + |
| 47 | +client_srcs = ['cdba.c', |
| 48 | + 'circ_buf.c'] |
| 49 | +executable('cdba', |
| 50 | + client_srcs, |
| 51 | + install : true) |
| 52 | + |
| 53 | +ftdi_dep = dependency('libftdi1', required: false) |
| 54 | +if not ftdi_dep.found() |
| 55 | + ftdi_dep = dependency('libftdi') |
| 56 | +endif |
| 57 | + |
| 58 | +server_deps = [dependency('libudev'), |
| 59 | + dependency('yaml-0.1'), |
| 60 | + ftdi_dep] |
| 61 | +server_srcs = ['cdba-server.c', |
| 62 | + 'cdb_assist.c', |
| 63 | + 'circ_buf.c', |
| 64 | + 'conmux.c', |
| 65 | + 'device.c', |
| 66 | + 'device_parser.c', |
| 67 | + 'fastboot.c', |
| 68 | + 'alpaca.c', |
| 69 | + 'ftdi-gpio.c', |
| 70 | + 'console.c', |
| 71 | + 'qcomlt_dbg.c', |
| 72 | + 'ppps.c'] |
| 73 | +executable('cdba-server', |
| 74 | + server_srcs, |
| 75 | + dependencies : server_deps, |
| 76 | + install : true) |
0 commit comments