crelay: update to 0.14.1
[feed/packages.git] / utils / crelay / patches / 010-meson.patch
1 From 5e122c8adabb3305dd7524a24ec296bb8d1b7cac Mon Sep 17 00:00:00 2001
2 From: Rosen Penev <rosenp@gmail.com>
3 Date: Tue, 19 Jul 2022 01:07:57 -0700
4 Subject: [PATCH] add meson
5
6 Signed-off-by: Rosen Penev <rosenp@gmail.com>
7 ---
8 meson.build | 34 ++++++++++++++++++++++++++++++++++
9 meson_options.txt | 11 +++++++++++
10 2 files changed, 45 insertions(+)
11 create mode 100644 meson.build
12 create mode 100644 meson_options.txt
13
14 --- /dev/null
15 +++ b/meson.build
16 @@ -0,0 +1,34 @@
17 +project('crelay', 'c', version : '0.14.1')
18 +
19 +hidapi_dep = dependency('hidapi-libusb', required: get_option('hidapi'))
20 +ftdi_dep = dependency('libftdi1', required: get_option('sainsmart'))
21 +libusb_dep = dependency('libusb-1.0', required: get_option('conrad'))
22 +
23 +sources = files(
24 + 'src/config.c',
25 + 'src/crelay.c',
26 + 'src/relay_drv.c',
27 + 'src/relay_drv_gpio.c',
28 +)
29 +
30 +if hidapi_dep.found()
31 + add_project_arguments('-DDRV_HIDAPI', language: 'c')
32 + add_project_arguments('-DDRV_SAINSMART16', language: 'c')
33 + sources += files('src/relay_drv_hidapi.c', 'src/relay_drv_sainsmart16.c',)
34 +endif
35 +
36 +if ftdi_dep.found()
37 + add_project_arguments('-DDRV_SAINSMART', language: 'c')
38 + sources += files('src/relay_drv_sainsmart.c')
39 +endif
40 +
41 +if libusb_dep.found()
42 + add_project_arguments('-DDRV_CONRAD', language: 'c')
43 + sources += files('src/relay_drv_conrad.c')
44 +endif
45 +
46 +executable('crelay',
47 + sources,
48 + dependencies: [ hidapi_dep, ftdi_dep, libusb_dep ],
49 + install: true,
50 +)
51 --- /dev/null
52 +++ b/meson_options.txt
53 @@ -0,0 +1,11 @@
54 +option('hidapi', type : 'feature',
55 + description: 'Enable HIDAPI driver',
56 +)
57 +
58 +option('sainsmart', type : 'feature',
59 + description: 'Enable SAINSMART driver',
60 +)
61 +
62 +option('conrad', type : 'feature',
63 + description: 'Enable CONRAD driver',
64 +)