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