William A. Kennington III | 0b3c389 | 2021-04-20 16:00:55 -0700 | [diff] [blame] | 1 | project( |
| 2 | 'phosphor-watchdog', |
| 3 | 'cpp', |
| 4 | version: '0.1', |
William A. Kennington III | 0d7e3d7 | 2021-04-20 16:22:14 -0700 | [diff] [blame] | 5 | meson_version: '>=0.57.0', |
William A. Kennington III | 0b3c389 | 2021-04-20 16:00:55 -0700 | [diff] [blame] | 6 | default_options: [ |
| 7 | 'warning_level=3', |
William A. Kennington III | 0d7e3d7 | 2021-04-20 16:22:14 -0700 | [diff] [blame] | 8 | 'cpp_std=c++20', |
William A. Kennington III | 0b3c389 | 2021-04-20 16:00:55 -0700 | [diff] [blame] | 9 | ]) |
William A. Kennington III | b933771 | 2019-01-15 18:27:13 -0800 | [diff] [blame] | 10 | |
William A. Kennington III | 080ffd7 | 2021-04-20 16:45:24 -0700 | [diff] [blame] | 11 | watchdog_headers = include_directories('.') |
William A. Kennington III | b933771 | 2019-01-15 18:27:13 -0800 | [diff] [blame] | 12 | |
William A. Kennington III | b76d5e2 | 2021-04-20 16:40:38 -0700 | [diff] [blame] | 13 | # CLI11 might not have a pkg-config. It is header only so just make |
| 14 | # sure we can access the needed symbols from the header. |
| 15 | cli11_dep = dependency('cli11', required: false) |
| 16 | has_cli11 = meson.get_compiler('cpp').has_header_symbol( |
| 17 | 'CLI/CLI.hpp', |
| 18 | 'CLI::App', |
| 19 | dependencies: cli11_dep, |
| 20 | required: false) |
| 21 | if not has_cli11 |
| 22 | cli11_proj = subproject('cli11', required: false) |
| 23 | assert(cli11_proj.found(), 'CLI11 is required') |
| 24 | cli11_dep = cli11_proj.get_variable('CLI11_dep') |
| 25 | endif |
| 26 | |
William A. Kennington III | 080ffd7 | 2021-04-20 16:45:24 -0700 | [diff] [blame] | 27 | watchdog_deps = [ |
William A. Kennington III | b76d5e2 | 2021-04-20 16:40:38 -0700 | [diff] [blame] | 28 | cli11_dep, |
William A. Kennington III | 080ffd7 | 2021-04-20 16:45:24 -0700 | [diff] [blame] | 29 | dependency('phosphor-dbus-interfaces'), |
| 30 | dependency('phosphor-logging'), |
William A. Kennington III | a8f5911 | 2021-04-20 16:21:25 -0700 | [diff] [blame] | 31 | dependency('sdbusplus', fallback: ['sdbusplus', 'sdbusplus_dep']), |
| 32 | dependency('sdeventplus', fallback: ['sdeventplus', 'sdeventplus_dep']), |
William A. Kennington III | 080ffd7 | 2021-04-20 16:45:24 -0700 | [diff] [blame] | 33 | ] |
| 34 | |
| 35 | watchdog_lib = static_library( |
William A. Kennington III | b933771 | 2019-01-15 18:27:13 -0800 | [diff] [blame] | 36 | 'watchdog', |
| 37 | 'watchdog.cpp', |
| 38 | implicit_include_directories: false, |
William A. Kennington III | 080ffd7 | 2021-04-20 16:45:24 -0700 | [diff] [blame] | 39 | include_directories: watchdog_headers, |
| 40 | dependencies: watchdog_deps) |
| 41 | |
| 42 | watchdog_dep = declare_dependency( |
| 43 | dependencies: watchdog_deps, |
| 44 | include_directories: watchdog_headers, |
| 45 | link_with: watchdog_lib) |
William A. Kennington III | b933771 | 2019-01-15 18:27:13 -0800 | [diff] [blame] | 46 | |
| 47 | executable( |
| 48 | 'phosphor-watchdog', |
| 49 | 'mainapp.cpp', |
| 50 | implicit_include_directories: false, |
William A. Kennington III | 080ffd7 | 2021-04-20 16:45:24 -0700 | [diff] [blame] | 51 | dependencies: watchdog_dep, |
William A. Kennington III | b933771 | 2019-01-15 18:27:13 -0800 | [diff] [blame] | 52 | install: true, |
Patrick Venture | 8c8072a | 2019-03-28 10:50:21 -0700 | [diff] [blame] | 53 | install_dir: get_option('bindir')) |
William A. Kennington III | b933771 | 2019-01-15 18:27:13 -0800 | [diff] [blame] | 54 | |
William A. Kennington III | 0b3c389 | 2021-04-20 16:00:55 -0700 | [diff] [blame] | 55 | if not get_option('tests').disabled() |
William A. Kennington III | b933771 | 2019-01-15 18:27:13 -0800 | [diff] [blame] | 56 | subdir('test') |
| 57 | endif |