Vijay Khemka | e279530 | 2020-07-15 17:28:45 -0700 | [diff] [blame] | 1 | project( |
| 2 | 'phosphor-health-monitor', |
| 3 | 'cpp', |
| 4 | version: '1.0', |
| 5 | default_options: [ |
Patrick Williams | 5669015 | 2021-09-02 16:06:20 -0500 | [diff] [blame] | 6 | 'cpp_std=c++20', |
Vijay Khemka | e279530 | 2020-07-15 17:28:45 -0700 | [diff] [blame] | 7 | ], |
Patrick Williams | 5669015 | 2021-09-02 16:06:20 -0500 | [diff] [blame] | 8 | meson_version: '>=0.57.0', |
Vijay Khemka | e279530 | 2020-07-15 17:28:45 -0700 | [diff] [blame] | 9 | ) |
| 10 | |
Patrick Williams | 19527c7 | 2021-09-02 16:05:11 -0500 | [diff] [blame] | 11 | cpp = meson.get_compiler('cpp') |
| 12 | |
| 13 | if cpp.has_header('nlohmann/json.hpp') |
| 14 | nlohmann_json = declare_dependency() |
| 15 | else |
| 16 | subproject('nlohmann-json') |
| 17 | nlohmann_json = declare_dependency( |
| 18 | include_directories: [ |
| 19 | 'subprojects/nlohmann-json/single_include', |
| 20 | 'subprojects/nlohmann-json/single_include/nlohmann', |
| 21 | ] |
| 22 | ) |
| 23 | endif |
| 24 | |
Vijay Khemka | e279530 | 2020-07-15 17:28:45 -0700 | [diff] [blame] | 25 | executable( |
| 26 | 'health-monitor', |
| 27 | [ |
| 28 | 'healthMonitor.cpp', |
| 29 | ], |
| 30 | dependencies: [ |
Patrick Williams | 19527c7 | 2021-09-02 16:05:11 -0500 | [diff] [blame] | 31 | dependency( |
| 32 | 'phosphor-dbus-interfaces', |
| 33 | fallback: [ |
| 34 | 'phosphor-dbus-interfaces', |
| 35 | 'phosphor_dbus_interfaces_dep', |
| 36 | ], |
| 37 | ), |
| 38 | dependency( |
| 39 | 'phosphor-logging', |
| 40 | fallback: [ 'phosphor-logging', 'phosphor_logging_dep' ], |
| 41 | ), |
| 42 | dependency( |
| 43 | 'sdbusplus', |
| 44 | fallback: [ 'sdbusplus', 'sdbusplus_dep' ], |
| 45 | ), |
| 46 | dependency( |
| 47 | 'sdeventplus', |
| 48 | fallback: [ 'sdeventplus', 'sdeventplus_dep' ], |
| 49 | ), |
| 50 | nlohmann_json, |
Vijay Khemka | e279530 | 2020-07-15 17:28:45 -0700 | [diff] [blame] | 51 | ], |
| 52 | install: true, |
| 53 | install_dir: get_option('bindir') |
| 54 | ) |
| 55 | |
| 56 | install_data(sources : 'bmc_health_config.json', install_dir : '/etc/healthMon') |
| 57 | |
| 58 | conf_data = configuration_data() |
| 59 | conf_data.set('HEALTH_CONFIG_FILE', '"/etc/healthMon/bmc_health_config.json"') |
| 60 | conf_data.set('HEALTH_BUS_NAME', '"xyz.openbmc_project.HealthMon"') |
| 61 | conf_data.set('HEALTH_SENSOR_PATH', '"/xyz/openbmc_project/sensors/utilization/"') |
Vijay Khemka | 1d0d012 | 2020-09-29 12:17:43 -0700 | [diff] [blame] | 62 | conf_data.set('SENSOR_OBJPATH', '"/xyz/openbmc_project/sensors"') |
Vijay Khemka | e279530 | 2020-07-15 17:28:45 -0700 | [diff] [blame] | 63 | |
| 64 | configure_file(output : 'config.h', |
| 65 | configuration : conf_data) |
| 66 | |
| 67 | systemd = dependency('systemd') |
| 68 | conf_data = configuration_data() |
| 69 | conf_data.set('bindir', get_option('prefix') / get_option('bindir')) |
| 70 | configure_file( |
| 71 | input: 'phosphor-health-monitor.service.in', |
| 72 | output: 'phosphor-health-monitor.service', |
| 73 | configuration: conf_data, |
| 74 | install: true, |
| 75 | install_dir: systemd.get_pkgconfig_variable('systemdsystemunitdir')) |