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