Skip to content

Commit 606a242

Browse files
committed
Introduce meson.build
Introduce meson.build to be used with the Meson build system, which handles the dependency and advanced compiler options for when used on various linux distributions. The libftdi .so for example has different names on different distribution, using meson makes sure we can handle those easily, and easily integrate with other package build systems like Yocto or Buildroot. Signed-off-by: Neil Armstrong <[email protected]>
1 parent 3e8e3bb commit 606a242

File tree

2 files changed

+86
-2
lines changed

2 files changed

+86
-2
lines changed

README

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,13 +3,21 @@ The CDBA control tool is used for remotely booting images on development boards
33
attached using a CDB Assist [https://github.com/sonyxperiadev/CDB-Assist] or Conmux.
44

55
= Dependencies
6-
sudo apt-get install libudev-dev libyaml-dev for debian systems
7-
dnf install systemd-devel libyaml-devel for fedora systems
6+
sudo apt-get install libudev-dev libyaml-dev libftdi1-dev for debian systems
7+
dnf install systemd-devel libyaml-devel libftdi1-devel for fedora systems
88

99
= Device side
1010
On the host with the CDB Assist or Conmux attached the "cdba-server" executable is run
1111
from sandbox/cdba/cdba-server. Available devices are read from $HOME/.cdba
1212

13+
= Build instructions
14+
15+
Either use make directly:
16+
# make
17+
or use the Meson build system:
18+
# meson . build
19+
# ninja -C build
20+
1321
= Client side
1422
The client is invoked as:
1523

meson.build

Lines changed: 76 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,76 @@
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

Comments
 (0)