1project( 2 'phosphor-virtual-sensor', 3 'cpp', 4 version: '1.0', 5 default_options: [ 6 'buildtype=debugoptimized', 7 'cpp_std=c++23', 8 'warning_level=3', 9 'werror=true', 10 ], 11 meson_version: '>=1.1.1', 12) 13 14cpp = meson.get_compiler('cpp') 15if cpp.has_header('exprtk.hpp') 16 exprtk = declare_dependency() 17else 18 subproject('exprtk', required: false) 19 exprtk = declare_dependency( 20 include_directories: 'subprojects/exprtk' 21 ) 22endif 23 24if cpp.has_header('nlohmann/json.hpp') 25 nlohmann_json = declare_dependency() 26else 27 subproject('nlohmann-json') 28 nlohmann_json = declare_dependency( 29 include_directories: [ 30 'subprojects/nlohmann-json/single_include', 31 'subprojects/nlohmann-json/single_include/nlohmann', 32 ] 33 ) 34endif 35 36executable( 37 'virtual-sensor', 38 [ 39 'virtualSensor.cpp', 40 ], 41 dependencies: [ 42 dependency('phosphor-dbus-interfaces'), 43 dependency('phosphor-logging'), 44 dependency('sdbusplus'), 45 exprtk, 46 nlohmann_json, 47 ], 48 install: true, 49 install_dir: get_option('bindir') 50) 51 52packagedir = join_paths( 53 get_option('prefix'), 54 get_option('datadir'), 55 meson.project_name(), 56) 57 58install_data(sources : 'virtual_sensor_config.json', install_dir : packagedir) 59 60systemd = dependency('systemd') 61conf_data = configuration_data() 62conf_data.set('bindir', get_option('prefix') / get_option('bindir')) 63configure_file( 64 input: 'phosphor-virtual-sensor.service.in', 65 output: 'phosphor-virtual-sensor.service', 66 configuration: conf_data, 67 install: true, 68 install_dir: systemd.get_variable('systemdsystemunitdir')) 69