1if cpp.has_header('CLI/CLI.hpp')
2    CLI11_dep = declare_dependency()
3else
4    CLI11_dep = dependency(
5        'CLI11',
6        fallback: [ 'CLI11', 'CLI11_dep' ],
7    )
8endif
9
10source = [
11    'usb_manager_main.cpp',
12    'usb_manager.cpp',
13    '../utils.cpp',
14    ]
15
16sdeventplus_dep = dependency(
17    'sdeventplus',
18    fallback: [
19        'sdeventplus',
20        'sdeventplus_dep'
21    ],
22)
23
24phosphor_logging_dep = dependency(
25    'phosphor-logging',
26    fallback: ['phosphor-logging', 'phosphor_logging_dep'],
27)
28
29executable(
30    'phosphor-usb-code-update',
31    source,
32    include_directories: ['..'],
33    dependencies: [
34        CLI11_dep,
35        phosphor_logging_dep,
36        sdbusplus_dep,
37        sdeventplus_dep,
38    ],
39    install: true,
40    install_dir: get_option('bindir')
41)
42
43systemd_system_unit_dir = dependency('systemd').get_variable(
44    pkgconfig: 'systemdsystemunitdir',
45    pkgconfig_define: ['prefix', get_option('prefix')])
46udev_dir = dependency('udev').get_variable(
47    pkgconfig: 'udev_dir',
48    pkgconfig_define: ['prefix', get_option('prefix')])
49
50install_data(
51    'services/usb-code-update@.service',
52    install_dir: systemd_system_unit_dir
53)
54
55install_data(
56    '70-bmc-usb.rules',
57    install_dir: udev_dir / 'rules.d'
58)
59