William A. Kennington III | 4250639 | 2021-04-22 15:19:54 -0700 | [diff] [blame^] | 1 | watchdog_headers = include_directories('.') |
| 2 | |
| 3 | # CLI11 might not have a pkg-config. It is header only so just make |
| 4 | # sure we can access the needed symbols from the header. |
| 5 | cli11_dep = dependency('cli11', required: false) |
| 6 | has_cli11 = meson.get_compiler('cpp').has_header_symbol( |
| 7 | 'CLI/CLI.hpp', |
| 8 | 'CLI::App', |
| 9 | dependencies: cli11_dep, |
| 10 | required: false) |
| 11 | if not has_cli11 |
| 12 | cli11_proj = subproject('cli11', required: false) |
| 13 | assert(cli11_proj.found(), 'CLI11 is required') |
| 14 | cli11_dep = cli11_proj.get_variable('CLI11_dep') |
| 15 | endif |
| 16 | |
| 17 | watchdog_deps = [ |
| 18 | cli11_dep, |
| 19 | dependency('phosphor-dbus-interfaces'), |
| 20 | dependency('phosphor-logging'), |
| 21 | dependency('sdbusplus', fallback: ['sdbusplus', 'sdbusplus_dep']), |
| 22 | dependency('sdeventplus', fallback: ['sdeventplus', 'sdeventplus_dep']), |
| 23 | ] |
| 24 | |
| 25 | watchdog_lib = static_library( |
| 26 | 'watchdog', |
| 27 | 'watchdog.cpp', |
| 28 | implicit_include_directories: false, |
| 29 | include_directories: watchdog_headers, |
| 30 | dependencies: watchdog_deps) |
| 31 | |
| 32 | watchdog_dep = declare_dependency( |
| 33 | dependencies: watchdog_deps, |
| 34 | include_directories: watchdog_headers, |
| 35 | link_with: watchdog_lib) |
| 36 | |
| 37 | executable( |
| 38 | 'phosphor-watchdog', |
| 39 | 'mainapp.cpp', |
| 40 | implicit_include_directories: false, |
| 41 | dependencies: watchdog_dep, |
| 42 | install: true, |
| 43 | install_dir: get_option('bindir')) |