blob: 92459368e89b6407e747c67e724545d00c1cd076 [file] [log] [blame]
William A. Kennington III0b3c3892021-04-20 16:00:55 -07001project(
2 'phosphor-watchdog',
3 'cpp',
4 version: '0.1',
William A. Kennington III0d7e3d72021-04-20 16:22:14 -07005 meson_version: '>=0.57.0',
William A. Kennington III0b3c3892021-04-20 16:00:55 -07006 default_options: [
7 'warning_level=3',
William A. Kennington III0d7e3d72021-04-20 16:22:14 -07008 'cpp_std=c++20',
William A. Kennington III0b3c3892021-04-20 16:00:55 -07009 ])
William A. Kennington IIIb9337712019-01-15 18:27:13 -080010
William A. Kennington III080ffd72021-04-20 16:45:24 -070011watchdog_headers = include_directories('.')
William A. Kennington IIIb9337712019-01-15 18:27:13 -080012
William A. Kennington IIIb76d5e22021-04-20 16:40:38 -070013# 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.
15cli11_dep = dependency('cli11', required: false)
16has_cli11 = meson.get_compiler('cpp').has_header_symbol(
17 'CLI/CLI.hpp',
18 'CLI::App',
19 dependencies: cli11_dep,
20 required: false)
21if 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')
25endif
26
William A. Kennington III080ffd72021-04-20 16:45:24 -070027watchdog_deps = [
William A. Kennington IIIb76d5e22021-04-20 16:40:38 -070028 cli11_dep,
William A. Kennington III080ffd72021-04-20 16:45:24 -070029 dependency('phosphor-dbus-interfaces'),
30 dependency('phosphor-logging'),
William A. Kennington IIIa8f59112021-04-20 16:21:25 -070031 dependency('sdbusplus', fallback: ['sdbusplus', 'sdbusplus_dep']),
32 dependency('sdeventplus', fallback: ['sdeventplus', 'sdeventplus_dep']),
William A. Kennington III080ffd72021-04-20 16:45:24 -070033]
34
35watchdog_lib = static_library(
William A. Kennington IIIb9337712019-01-15 18:27:13 -080036 'watchdog',
37 'watchdog.cpp',
38 implicit_include_directories: false,
William A. Kennington III080ffd72021-04-20 16:45:24 -070039 include_directories: watchdog_headers,
40 dependencies: watchdog_deps)
41
42watchdog_dep = declare_dependency(
43 dependencies: watchdog_deps,
44 include_directories: watchdog_headers,
45 link_with: watchdog_lib)
William A. Kennington IIIb9337712019-01-15 18:27:13 -080046
47executable(
48 'phosphor-watchdog',
49 'mainapp.cpp',
50 implicit_include_directories: false,
William A. Kennington III080ffd72021-04-20 16:45:24 -070051 dependencies: watchdog_dep,
William A. Kennington IIIb9337712019-01-15 18:27:13 -080052 install: true,
Patrick Venture8c8072a2019-03-28 10:50:21 -070053 install_dir: get_option('bindir'))
William A. Kennington IIIb9337712019-01-15 18:27:13 -080054
William A. Kennington III0b3c3892021-04-20 16:00:55 -070055if not get_option('tests').disabled()
William A. Kennington IIIb9337712019-01-15 18:27:13 -080056 subdir('test')
57endif