blob: 1f047284c5be7d273cef83480c86b80e08856e16 [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)
Patrick Williams4b98de52025-02-03 14:14:17 -050019 exprtk = declare_dependency(include_directories: 'subprojects/exprtk')
Vijay Khemka3ed9a512020-08-21 16:13:05 -070020endif
21
Vijay Khemkaabcc94f2020-08-11 15:27:44 -070022executable(
23 'virtual-sensor',
24 [
George Liu7f41a0d2024-08-28 16:49:06 +080025 'calculate.cpp',
Tao Linf2e94222023-10-31 17:38:17 +080026 'dbusSensor.cpp',
27 'dbusUtils.cpp',
George Liud98174e2024-10-25 15:48:16 +080028 'main.cpp',
29 'virtualSensor.cpp',
Vijay Khemkaabcc94f2020-08-11 15:27:44 -070030 ],
31 dependencies: [
Patrick Williams96439f12023-12-07 12:16:44 -060032 dependency('nlohmann_json', include_type: 'system'),
Patrick Williamsb729eac2022-03-21 10:14:47 -050033 dependency('phosphor-dbus-interfaces'),
34 dependency('phosphor-logging'),
35 dependency('sdbusplus'),
Vijay Khemka3ed9a512020-08-21 16:13:05 -070036 exprtk,
Vijay Khemkaabcc94f2020-08-11 15:27:44 -070037 ],
38 install: true,
Patrick Williams4b98de52025-02-03 14:14:17 -050039 install_dir: get_option('bindir'),
Vijay Khemkaabcc94f2020-08-11 15:27:44 -070040)
41
42packagedir = join_paths(
43 get_option('prefix'),
44 get_option('datadir'),
45 meson.project_name(),
46)
47
Patrick Williams4b98de52025-02-03 14:14:17 -050048install_data(sources: 'virtual_sensor_config.json', install_dir: packagedir)
Vijay Khemkaabcc94f2020-08-11 15:27:44 -070049
50systemd = dependency('systemd')
51conf_data = configuration_data()
52conf_data.set('bindir', get_option('prefix') / get_option('bindir'))
53configure_file(
Patrick Williams4b98de52025-02-03 14:14:17 -050054 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)
Lei YU14ef8742023-10-07 17:50:28 +080060
61build_tests = get_option('tests')
Patrick Williams76e6c5a2025-01-30 17:48:07 -050062if build_tests.allowed()
Patrick Williams4b98de52025-02-03 14:14:17 -050063 subdir('test')
Lei YU14ef8742023-10-07 17:50:28 +080064endif