1project(
2    'phosphor-health-monitor',
3    'cpp',
4    version: '1.0',
5    default_options: [
6        'cpp_std=c++23',
7    ],
8    meson_version: '>=1.1.1',
9)
10
11phosphor_logging_dep = dependency('phosphor-logging')
12phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces')
13sdbusplus_dep = dependency('sdbusplus')
14sdeventplus_dep = dependency('sdeventplus')
15nlohmann_json_dep = dependency('nlohmann_json', include_type: 'system')
16base_deps = [
17    phosphor_logging_dep,
18    phosphor_dbus_interfaces_dep,
19    sdbusplus_dep,
20    sdeventplus_dep,
21    nlohmann_json_dep
22]
23
24executable(
25    'health-monitor',
26    [
27        'health_metric_config.cpp',
28        'health_metric.cpp',
29        'health_utils.cpp',
30        'health_metric_collection.cpp',
31        'health_monitor.cpp',
32    ],
33    dependencies: [
34        base_deps
35    ],
36    install: true,
37    install_dir: get_option('bindir')
38)
39
40conf_data = configuration_data()
41conf_data.set('HEALTH_CONFIG_FILE', '"/etc/healthMon/bmc_health_config.json"')
42conf_data.set('HEALTH_BUS_NAME', '"xyz.openbmc_project.HealthMon"')
43conf_data.set('HEALTH_SENSOR_PATH', '"/xyz/openbmc_project/sensors/utilization/"')
44conf_data.set('SENSOR_OBJPATH', '"/xyz/openbmc_project/sensors"')
45conf_data.set('INVENTORY_OBJPATH', '"/xyz/openbmc_project/inventory"')
46
47configure_file(output : 'config.h',
48               configuration : conf_data)
49
50systemd = dependency('systemd')
51conf_data = configuration_data()
52conf_data.set('bindir', get_option('prefix') / get_option('bindir'))
53configure_file(
54  input: 'phosphor-health-monitor.service.in',
55  output: 'phosphor-health-monitor.service',
56  configuration: conf_data,
57  install: true,
58  install_dir: systemd.get_variable('systemdsystemunitdir'))
59
60if get_option('tests').allowed()
61  subdir('test')
62endif
63