Vijay Khemka | abcc94f | 2020-08-11 15:27:44 -0700 | [diff] [blame] | 1 | project( |
| 2 | 'phosphor-virtual-sensor', |
| 3 | 'cpp', |
| 4 | version: '1.0', |
| 5 | default_options: [ |
Patrick Williams | ff2df99 | 2021-08-26 10:23:08 -0500 | [diff] [blame] | 6 | 'buildtype=debugoptimized', |
Patrick Williams | ce4241c | 2023-07-12 11:15:56 -0500 | [diff] [blame] | 7 | 'cpp_std=c++23', |
Patrick Williams | ff2df99 | 2021-08-26 10:23:08 -0500 | [diff] [blame] | 8 | 'warning_level=3', |
| 9 | 'werror=true', |
Vijay Khemka | abcc94f | 2020-08-11 15:27:44 -0700 | [diff] [blame] | 10 | ], |
Patrick Williams | ce4241c | 2023-07-12 11:15:56 -0500 | [diff] [blame] | 11 | meson_version: '>=1.1.1', |
Vijay Khemka | abcc94f | 2020-08-11 15:27:44 -0700 | [diff] [blame] | 12 | ) |
| 13 | |
Vijay Khemka | 3ed9a51 | 2020-08-21 16:13:05 -0700 | [diff] [blame] | 14 | cpp = meson.get_compiler('cpp') |
| 15 | if cpp.has_header('exprtk.hpp') |
| 16 | exprtk = declare_dependency() |
| 17 | else |
| 18 | subproject('exprtk', required: false) |
| 19 | exprtk = declare_dependency( |
| 20 | include_directories: 'subprojects/exprtk' |
| 21 | ) |
| 22 | endif |
| 23 | |
Vijay Khemka | abcc94f | 2020-08-11 15:27:44 -0700 | [diff] [blame] | 24 | executable( |
| 25 | 'virtual-sensor', |
| 26 | [ |
George Liu | 7f41a0d | 2024-08-28 16:49:06 +0800 | [diff] [blame] | 27 | 'calculate.cpp', |
Vijay Khemka | abcc94f | 2020-08-11 15:27:44 -0700 | [diff] [blame] | 28 | 'virtualSensor.cpp', |
Tao Lin | f2e9422 | 2023-10-31 17:38:17 +0800 | [diff] [blame] | 29 | 'dbusSensor.cpp', |
| 30 | 'dbusUtils.cpp', |
Vijay Khemka | abcc94f | 2020-08-11 15:27:44 -0700 | [diff] [blame] | 31 | ], |
| 32 | dependencies: [ |
Patrick Williams | 96439f1 | 2023-12-07 12:16:44 -0600 | [diff] [blame] | 33 | dependency('nlohmann_json', include_type: 'system'), |
Patrick Williams | b729eac | 2022-03-21 10:14:47 -0500 | [diff] [blame] | 34 | dependency('phosphor-dbus-interfaces'), |
| 35 | dependency('phosphor-logging'), |
| 36 | dependency('sdbusplus'), |
Vijay Khemka | 3ed9a51 | 2020-08-21 16:13:05 -0700 | [diff] [blame] | 37 | exprtk, |
Vijay Khemka | abcc94f | 2020-08-11 15:27:44 -0700 | [diff] [blame] | 38 | ], |
| 39 | install: true, |
| 40 | install_dir: get_option('bindir') |
| 41 | ) |
| 42 | |
| 43 | packagedir = join_paths( |
| 44 | get_option('prefix'), |
| 45 | get_option('datadir'), |
| 46 | meson.project_name(), |
| 47 | ) |
| 48 | |
Patrick Williams | 32dff21 | 2023-02-09 13:54:18 -0600 | [diff] [blame] | 49 | install_data(sources : 'virtual_sensor_config.json', install_dir : packagedir) |
Vijay Khemka | abcc94f | 2020-08-11 15:27:44 -0700 | [diff] [blame] | 50 | |
| 51 | systemd = dependency('systemd') |
| 52 | conf_data = configuration_data() |
| 53 | conf_data.set('bindir', get_option('prefix') / get_option('bindir')) |
| 54 | configure_file( |
| 55 | input: 'phosphor-virtual-sensor.service.in', |
| 56 | output: 'phosphor-virtual-sensor.service', |
| 57 | configuration: conf_data, |
| 58 | install: true, |
Patrick Williams | 209a880 | 2023-04-12 08:01:25 -0500 | [diff] [blame] | 59 | install_dir: systemd.get_variable('systemdsystemunitdir')) |
Lei YU | 14ef874 | 2023-10-07 17:50:28 +0800 | [diff] [blame] | 60 | |
| 61 | build_tests = get_option('tests') |
| 62 | if not build_tests.disabled() |
| 63 | subdir('test') |
| 64 | endif |