blob: 20d186b63fafeafd6dbc4e8fa214f1fa3416b01a [file] [log] [blame]
Vijay Khemkaabcc94f2020-08-11 15:27:44 -07001project(
2 'phosphor-virtual-sensor',
3 'cpp',
4 version: '1.0',
5 default_options: [
Patrick Williamsff2df992021-08-26 10:23:08 -05006 'buildtype=debugoptimized',
Patrick Williamsce4241c2023-07-12 11:15:56 -05007 'cpp_std=c++23',
Patrick Williamsff2df992021-08-26 10:23:08 -05008 'warning_level=3',
9 'werror=true',
Vijay Khemkaabcc94f2020-08-11 15:27:44 -070010 ],
Patrick Williamsce4241c2023-07-12 11:15:56 -050011 meson_version: '>=1.1.1',
Vijay Khemkaabcc94f2020-08-11 15:27:44 -070012)
13
Vijay Khemka3ed9a512020-08-21 16:13:05 -070014cpp = 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
Vijay Khemkaabcc94f2020-08-11 15:27:44 -070024executable(
25 'virtual-sensor',
26 [
George Liu7f41a0d2024-08-28 16:49:06 +080027 'calculate.cpp',
Vijay Khemkaabcc94f2020-08-11 15:27:44 -070028 'virtualSensor.cpp',
Tao Linf2e94222023-10-31 17:38:17 +080029 'dbusSensor.cpp',
30 'dbusUtils.cpp',
Vijay Khemkaabcc94f2020-08-11 15:27:44 -070031 ],
32 dependencies: [
Patrick Williams96439f12023-12-07 12:16:44 -060033 dependency('nlohmann_json', include_type: 'system'),
Patrick Williamsb729eac2022-03-21 10:14:47 -050034 dependency('phosphor-dbus-interfaces'),
35 dependency('phosphor-logging'),
36 dependency('sdbusplus'),
Vijay Khemka3ed9a512020-08-21 16:13:05 -070037 exprtk,
Vijay Khemkaabcc94f2020-08-11 15:27:44 -070038 ],
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
Patrick Williams32dff212023-02-09 13:54:18 -060049install_data(sources : 'virtual_sensor_config.json', install_dir : packagedir)
Vijay Khemkaabcc94f2020-08-11 15:27:44 -070050
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,
Patrick Williams209a8802023-04-12 08:01:25 -050059 install_dir: systemd.get_variable('systemdsystemunitdir'))
Lei YU14ef8742023-10-07 17:50:28 +080060
61build_tests = get_option('tests')
62if not build_tests.disabled()
63 subdir('test')
64endif