1project(
2    'phosphor-health-monitor',
3    'cpp',
4    version: '1.0',
5    default_options: [
6        'cpp_std=c++20',
7    ],
8    meson_version: '>=0.58.0',
9)
10
11cpp = meson.get_compiler('cpp')
12
13if cpp.has_header('nlohmann/json.hpp')
14    nlohmann_json = declare_dependency()
15else
16    subproject('nlohmann-json')
17    nlohmann_json = dependency('nlohmann_json')
18endif
19
20executable(
21    'health-monitor',
22    [
23        'healthMonitor.cpp',
24    ],
25    dependencies: [
26        dependency('phosphor-dbus-interfaces'),
27        dependency('phosphor-logging'),
28        dependency('sdbusplus'),
29        dependency('sdeventplus'),
30        nlohmann_json,
31    ],
32    install: true,
33    install_dir: get_option('bindir')
34)
35
36install_data(sources : 'bmc_health_config.json', install_dir : '/etc/healthMon')
37
38conf_data = configuration_data()
39conf_data.set('HEALTH_CONFIG_FILE', '"/etc/healthMon/bmc_health_config.json"')
40conf_data.set('HEALTH_BUS_NAME', '"xyz.openbmc_project.HealthMon"')
41conf_data.set('HEALTH_SENSOR_PATH', '"/xyz/openbmc_project/sensors/utilization/"')
42conf_data.set('SENSOR_OBJPATH', '"/xyz/openbmc_project/sensors"')
43conf_data.set('INVENTORY_OBJPATH', '"/xyz/openbmc_project/inventory"')
44
45configure_file(output : 'config.h',
46               configuration : conf_data)
47
48systemd = dependency('systemd')
49conf_data = configuration_data()
50conf_data.set('bindir', get_option('prefix') / get_option('bindir'))
51configure_file(
52  input: 'phosphor-health-monitor.service.in',
53  output: 'phosphor-health-monitor.service',
54  configuration: conf_data,
55  install: true,
56  install_dir: systemd.get_variable('systemdsystemunitdir'))
57