xref: /openbmc/phosphor-watchdog/src/meson.build (revision 42506393)
1watchdog_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.
5cli11_dep = dependency('cli11', required: false)
6has_cli11 = meson.get_compiler('cpp').has_header_symbol(
7  'CLI/CLI.hpp',
8  'CLI::App',
9  dependencies: cli11_dep,
10  required: false)
11if 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')
15endif
16
17watchdog_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
25watchdog_lib = static_library(
26  'watchdog',
27  'watchdog.cpp',
28  implicit_include_directories: false,
29  include_directories: watchdog_headers,
30  dependencies: watchdog_deps)
31
32watchdog_dep = declare_dependency(
33  dependencies: watchdog_deps,
34  include_directories: watchdog_headers,
35  link_with: watchdog_lib)
36
37executable(
38  'phosphor-watchdog',
39  'mainapp.cpp',
40  implicit_include_directories: false,
41  dependencies: watchdog_dep,
42  install: true,
43  install_dir: get_option('bindir'))
44