xref: /openbmc/phosphor-watchdog/src/meson.build (revision 86e09d74)
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(
20    'phosphor-dbus-interfaces',
21    fallback: ['phosphor-dbus-interfaces', 'phosphor_dbus_interfaces_dep']),
22  dependency(
23    'phosphor-logging',
24    fallback: ['phosphor-logging', 'phosphor_logging_dep']),
25  dependency('sdbusplus', fallback: ['sdbusplus', 'sdbusplus_dep']),
26  dependency('sdeventplus', fallback: ['sdeventplus', 'sdeventplus_dep']),
27]
28
29watchdog_lib = static_library(
30  'watchdog',
31  'watchdog.cpp',
32  implicit_include_directories: false,
33  include_directories: watchdog_headers,
34  dependencies: watchdog_deps)
35
36watchdog_dep = declare_dependency(
37  dependencies: watchdog_deps,
38  include_directories: watchdog_headers,
39  link_with: watchdog_lib)
40
41executable(
42  'phosphor-watchdog',
43  'mainapp.cpp',
44  implicit_include_directories: false,
45  dependencies: watchdog_dep,
46  install: true,
47  install_dir: get_option('bindir'))
48