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(include_directories: 'subprojects/exprtk') 20endif 21 22executable( 23 'virtual-sensor', 24 [ 25 'calculate.cpp', 26 'dbusSensor.cpp', 27 'dbusUtils.cpp', 28 'main.cpp', 29 'virtualSensor.cpp', 30 ], 31 dependencies: [ 32 dependency('nlohmann_json', include_type: 'system'), 33 dependency('phosphor-dbus-interfaces'), 34 dependency('phosphor-logging'), 35 dependency('sdbusplus'), 36 exprtk, 37 ], 38 install: true, 39 install_dir: get_option('bindir'), 40) 41 42packagedir = join_paths( 43 get_option('prefix'), 44 get_option('datadir'), 45 meson.project_name(), 46) 47 48install_data(sources: 'virtual_sensor_config.json', install_dir: packagedir) 49 50systemd = dependency('systemd') 51conf_data = configuration_data() 52conf_data.set('bindir', get_option('prefix') / get_option('bindir')) 53configure_file( 54 input: 'phosphor-virtual-sensor.service.in', 55 output: 'phosphor-virtual-sensor.service', 56 configuration: conf_data, 57 install: true, 58 install_dir: systemd.get_variable('systemdsystemunitdir'), 59) 60 61build_tests = get_option('tests') 62if build_tests.allowed() 63 subdir('test') 64endif 65