-
Notifications
You must be signed in to change notification settings - Fork 16
/
meson.build
120 lines (103 loc) · 2.8 KB
/
meson.build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
# SPDX-License-Identifier: GPL-2.0
project('cdba',
'c',
license : [ 'BSD-3-Clause'],
meson_version : '>= 0.47.0', # for feature user options
default_options: [
'warning_level=2', # sets -Wextra
'buildtype=release',
])
# Set advanced compiler flags
compiler = meson.get_compiler('c')
compiler_cflags = ['-Wno-unused-parameter',
'-Wno-unused-result',
'-Wno-missing-field-initializers',
'-Wno-sign-compare',
'-Wundef',
'-Wnull-dereference',
'-Wdouble-promotion',
'-Wshadow',
'-Wpointer-arith',
'-Wwrite-strings',
'-Wstrict-overflow=4']
# TODO add clang specific options
if compiler.get_id() == 'gcc'
compiler_cflags += ['-Wformat-signedness',
'-Wduplicated-cond',
'-Wduplicated-branches',
'-Wvla-larger-than=1',
'-Walloc-zero',
'-Wunsafe-loop-optimizations',
'-Wcast-align',
'-Wlogical-op',
'-Wjump-misses-init']
endif
add_global_arguments(compiler.get_supported_arguments(compiler_cflags),
language: 'c')
client_srcs = ['cdba.c',
'circ_buf.c']
executable('cdba',
client_srcs,
install : true)
server_opt = get_option('server')
ftdi_dep = dependency('libftdi1', required: false)
if not ftdi_dep.found()
ftdi_dep = dependency('libftdi', required: server_opt)
endif
gpiod_dep = dependency('libgpiod', required: server_opt)
cdbalib_deps = [dependency('libudev', required: server_opt),
dependency('yaml-0.1', required: server_opt),
gpiod_dep,
ftdi_dep]
# E.g. Debian reuires -lutil for forkpty
if not compiler.has_function('forkpty')
util_dep = compiler.find_library('util')
cdbalib_deps += util_dep
endif
drivers_srcs = ['drivers/alpaca.c',
'drivers/cdb_assist.c',
'drivers/conmux.c',
'drivers/external.c',
'drivers/ftdi-gpio.c',
'drivers/laurent.c',
'drivers/local-gpio.c',
'drivers/qcomlt_dbg.c',
]
if gpiod_dep.version().version_compare('>=2.0')
drivers_srcs += ['drivers/local-gpio-v2.c']
else
drivers_srcs += ['drivers/local-gpio-v1.c']
endif
cdbalib_srcs = ['circ_buf.c',
'device.c',
'device_parser.c',
'fastboot.c',
'console.c',
'ppps.c',
'status.c',
'status-cmd.c',
'watch.c',
'tty.c']
server_srcs = ['cdba-server.c']
build_server = true
foreach d: cdbalib_deps
if not d.found()
build_server = false
endif
endforeach
if build_server
libcdba = static_library('cdba',
cdbalib_srcs + drivers_srcs,
dependencies : cdbalib_deps,
)
executable('cdba-server',
server_srcs,
link_with : libcdba,
install : true)
executable('cdba-power',
['cdba-power.c'],
link_with : libcdba,
install : true)
elif not server_opt.disabled()
message('Skipping CDBA server build')
endif