Skip to content

Commit 7b73465

Browse files
committed
meson: support client-only builds
It is expected that the majority of CDBA users do not need the server binary. Allow users to disable the cdba-server binary and build just the client. Fixes: #48 Signed-off-by: Dmitry Baryshkov <[email protected]>
1 parent b9f7f93 commit 7b73465

File tree

2 files changed

+23
-9
lines changed

2 files changed

+23
-9
lines changed

meson.build

Lines changed: 22 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
project('cdba',
44
'c',
55
license : [ 'BSD-3-Clause'],
6-
meson_version : '>= 0.43.0', # for compiler.get_supported_arguments()
6+
meson_version : '>= 0.47.0', # for feature user options
77
default_options: [
88
'warning_level=2', # sets -Wextra
99
'buildtype=release',
@@ -47,14 +47,16 @@ executable('cdba',
4747
client_srcs,
4848
install : true)
4949

50+
server_opt = get_option('server')
51+
5052
ftdi_dep = dependency('libftdi1', required: false)
5153
if not ftdi_dep.found()
52-
ftdi_dep = dependency('libftdi')
54+
ftdi_dep = dependency('libftdi', required: server_opt)
5355
endif
5456

55-
gpiod_dep = dependency('libgpiod')
56-
server_deps = [dependency('libudev'),
57-
dependency('yaml-0.1'),
57+
gpiod_dep = dependency('libgpiod', required: server_opt)
58+
server_deps = [dependency('libudev', required: server_opt),
59+
dependency('yaml-0.1', required: server_opt),
5860
gpiod_dep,
5961
ftdi_dep]
6062
server_srcs = ['cdba-server.c',
@@ -78,7 +80,18 @@ else
7880
server_srcs += ['local-gpio-v1.c']
7981
endif
8082

81-
executable('cdba-server',
82-
server_srcs,
83-
dependencies : server_deps,
84-
install : true)
83+
build_server = true
84+
foreach d: server_deps
85+
if not d.found()
86+
build_server = false
87+
endif
88+
endforeach
89+
90+
if build_server
91+
executable('cdba-server',
92+
server_srcs,
93+
dependencies : server_deps,
94+
install : true)
95+
elif not server_opt.disabled()
96+
message('Skipping CDBA server build')
97+
endif

meson_options.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
option('server', type: 'feature', description: 'Controls whether the CDBA server is built. By default it will be built of all dependencies are present.')

0 commit comments

Comments
 (0)