blob: e66248e4f60645e5267787e0ee34d3e1e9910a12 [file] [log] [blame]
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +02001project(
2 'Telemetry',
3 'cpp',
Patrick Williams934201f2021-10-06 15:41:36 -05004 meson_version: '>=0.57.0',
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +02005 default_options: [
6 'buildtype=debugoptimized',
Patrick Williams934201f2021-10-06 15:41:36 -05007 'cpp_std=c++20',
Wludzik, Jozefa4bf7402020-10-21 15:08:58 +02008 # TODO: Without RTTI telemetry does not build using Boost 1.74.0
9 # https://github.com/chriskohlhoff/asio/issues/533
10 #'cpp_rtti=false',
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020011 'warning_level=3',
12 'werror=true',
13 'b_lto=true',
14 ],
15 license: 'Apache-2.0',
16)
17
Lukasz Kazmierczaka74e44f2021-07-23 15:02:20 +020018summary({'Fast build with link-time optimizer disabled':
19 not get_option('b_lto')}, section: 'General')
20
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020021cpp = meson.get_compiler('cpp')
22add_project_arguments(
23 cpp.get_supported_arguments([
24 '-DBOOST_ASIO_DISABLE_THREADS',
25 '-DBOOST_ALL_NO_LIB',
26 '-DBOOST_SYSTEM_NO_DEPRECATED',
27 '-DBOOST_ASIO_NO_DEPRECATED',
28 '-DBOOST_NO_RTTI',
29 '-DBOOST_NO_TYPEID',
Wludzik, Jozef596a9942021-01-27 12:28:59 +010030 # TODO: Removed below arg after upgrade to Boost 1.75
31 '-DBOOST_ALLOW_DEPRECATED_HEADERS',
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020032 '-Wno-unused-parameter',
33 ]),
34 language: 'cpp'
35)
36
Krzysztof Grobelnyb5645942020-09-29 11:52:45 +020037boost = dependency(
Wludzik, Jozef596a9942021-01-27 12:28:59 +010038 'boost',
39 version: '>=1.74.0',
40 required: false,
41 modules: ['coroutine'])
42assert(boost.found(),
43 'Missing Boost 1.74.0 or higher, as WA you can set BOOST_ROOT ' +
44 'environemt to point at boost build. To build a boost you can use ' +
45 'script ./scripts/boost_build_1.74.0.sh')
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020046
Patrick Williamsf8ae65c2022-03-21 10:21:36 -050047phosphor_logging = dependency('phosphor-logging')
48sdbusplus = dependency('sdbusplus')
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020049systemd = dependency('systemd')
50
Krzysztof Grobelny73da6902020-09-24 13:42:04 +020051if cpp.has_header('nlohmann/json.hpp')
52 nlohmann_json = declare_dependency()
53else
Patrick Williamsf8ae65c2022-03-21 10:21:36 -050054 nlohmann_json = dependency('nlohmann_json')
Krzysztof Grobelny73da6902020-09-24 13:42:04 +020055endif
56
Wludzik, Jozef503c1582020-12-11 14:48:01 +010057add_project_arguments(
58 '-DTELEMETRY_MAX_REPORTS=' + get_option('max-reports').to_string(),
Wludzik, Jozef596a9942021-01-27 12:28:59 +010059 '-DTELEMETRY_MAX_READING_PARAMS=' +
60 get_option('max-reading-parameters').to_string(),
Wludzik, Jozef503c1582020-12-11 14:48:01 +010061 '-DTELEMETRY_MIN_INTERVAL=' + get_option('min-interval').to_string(),
Wludzik, Jozef76833cb2020-12-21 14:42:41 +010062 '-DTELEMETRY_MAX_TRIGGERS=' + get_option('max-triggers').to_string(),
Szymon Dompkee28aa532021-10-27 12:33:12 +020063 '-DTELEMETRY_MAX_DBUS_PATH_LENGTH=' +
64 get_option('max-dbus-path-length').to_string(),
Ankita Vilas Gawadecd5b0b72022-01-20 20:55:04 +000065 '-DTELEMETRY_MAX_APPEND_LIMIT=' +
66 get_option('max-append-limit').to_string(),
Wludzik, Jozef503c1582020-12-11 14:48:01 +010067 language: 'cpp'
68)
69
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020070executable(
71 'telemetry',
72 [
Szymon Dompkef763c9e2021-03-12 09:19:22 +010073 'src/discrete_threshold.cpp',
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020074 'src/main.cpp',
Krzysztof Grobelnyc8e3a642020-10-23 12:29:16 +020075 'src/metric.cpp',
Krzysztof Grobelnyf7ea2992022-01-27 11:04:58 +010076 'src/metrics/collection_data.cpp',
77 'src/metrics/collection_function.cpp',
Wludzik, Jozef1477fe62021-01-02 11:56:10 +010078 'src/numeric_threshold.cpp',
Szymon Dompkef763c9e2021-03-12 09:19:22 +010079 'src/on_change_threshold.cpp',
Krzysztof Grobelny7f06f612020-09-24 13:42:10 +020080 'src/persistent_json_storage.cpp',
Wludzik, Jozefcb88cfd2020-09-28 16:38:57 +020081 'src/report.cpp',
Wludzik, Jozef2f9f9b82020-10-13 09:07:45 +020082 'src/report_factory.cpp',
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020083 'src/report_manager.cpp',
Krzysztof Grobelnyb5645942020-09-29 11:52:45 +020084 'src/sensor.cpp',
Krzysztof Grobelny7f06f612020-09-24 13:42:10 +020085 'src/sensor_cache.cpp',
Wludzik, Jozef76833cb2020-12-21 14:42:41 +010086 'src/trigger.cpp',
Wludzik, Jozefd960e1f2021-01-08 09:25:59 +010087 'src/trigger_actions.cpp',
Wludzik, Jozef76833cb2020-12-21 14:42:41 +010088 'src/trigger_factory.cpp',
89 'src/trigger_manager.cpp',
Krzysztof Grobelny493e62e2022-02-14 10:55:50 +010090 'src/types/readings.cpp',
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +000091 'src/types/report_types.cpp',
Cezary Zwolak4416fce2021-03-17 03:21:06 +010092 'src/utils/conversion_trigger.cpp',
Szymon Dompke1cdd7e42022-06-08 14:43:13 +020093 'src/utils/dbus_path_utils.cpp',
Krzysztof Grobelnyb8cc78d2021-11-29 15:54:53 +010094 'src/utils/generate_id.cpp',
Krzysztof Grobelnye6d48872022-02-08 13:41:30 +010095 'src/utils/messanger_service.cpp',
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020096 ],
97 dependencies: [
98 boost,
Krzysztof Grobelny73da6902020-09-24 13:42:04 +020099 nlohmann_json,
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +0200100 sdbusplus,
101 phosphor_logging,
102 ],
103 include_directories: 'src',
104 install: true,
105 install_dir: get_option('prefix') / get_option('bindir'),
106 pie: true,
107)
108
109configure_file(
110 input: 'xyz.openbmc_project.Telemetry.service.in',
111 output: 'xyz.openbmc_project.Telemetry.service',
112 configuration: {
113 'bindir': get_option('prefix') / get_option('bindir'),
114 },
115 install: true,
Patrick Williamsbdf87192021-12-03 10:08:57 -0600116 install_dir: systemd.get_variable(pkgconfig: 'systemdsystemunitdir'),
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +0200117)
Krzysztof Grobelny73da6902020-09-24 13:42:04 +0200118
119if get_option('buildtest')
120 subdir('tests')
121endif