blob: d1e228d67812bdc451f4727c1035d1a4ae9238c6 [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 Williams937eaaf2021-12-03 10:17:59 -060047phosphor_logging = dependency(
48 'phosphor-logging',
49 fallback: ['phosphor-logging', 'phosphor_logging_dep'],
50)
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020051
Wludzik, Jozef596a9942021-01-27 12:28:59 +010052sdbusplus = dependency('sdbusplus', fallback: ['sdbusplus', 'sdbusplus_dep'])
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020053systemd = dependency('systemd')
54
Krzysztof Grobelny73da6902020-09-24 13:42:04 +020055if cpp.has_header('nlohmann/json.hpp')
56 nlohmann_json = declare_dependency()
57else
Wludzik, Jozef596a9942021-01-27 12:28:59 +010058 nlohmann_json = dependency('nlohmann_json',
59 fallback: ['nlohmann', 'nlohmann_json_dep'])
Krzysztof Grobelny73da6902020-09-24 13:42:04 +020060endif
61
Wludzik, Jozef503c1582020-12-11 14:48:01 +010062add_project_arguments(
63 '-DTELEMETRY_MAX_REPORTS=' + get_option('max-reports').to_string(),
Wludzik, Jozef596a9942021-01-27 12:28:59 +010064 '-DTELEMETRY_MAX_READING_PARAMS=' +
65 get_option('max-reading-parameters').to_string(),
Wludzik, Jozef503c1582020-12-11 14:48:01 +010066 '-DTELEMETRY_MIN_INTERVAL=' + get_option('min-interval').to_string(),
Wludzik, Jozef76833cb2020-12-21 14:42:41 +010067 '-DTELEMETRY_MAX_TRIGGERS=' + get_option('max-triggers').to_string(),
Szymon Dompkee28aa532021-10-27 12:33:12 +020068 '-DTELEMETRY_MAX_DBUS_PATH_LENGTH=' +
69 get_option('max-dbus-path-length').to_string(),
Ankita Vilas Gawadecd5b0b72022-01-20 20:55:04 +000070 '-DTELEMETRY_MAX_APPEND_LIMIT=' +
71 get_option('max-append-limit').to_string(),
Wludzik, Jozef503c1582020-12-11 14:48:01 +010072 language: 'cpp'
73)
74
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020075executable(
76 'telemetry',
77 [
Szymon Dompkef763c9e2021-03-12 09:19:22 +010078 'src/discrete_threshold.cpp',
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020079 'src/main.cpp',
Krzysztof Grobelnyc8e3a642020-10-23 12:29:16 +020080 'src/metric.cpp',
Krzysztof Grobelnyf7ea2992022-01-27 11:04:58 +010081 'src/metrics/collection_data.cpp',
82 'src/metrics/collection_function.cpp',
Wludzik, Jozef1477fe62021-01-02 11:56:10 +010083 'src/numeric_threshold.cpp',
Szymon Dompkef763c9e2021-03-12 09:19:22 +010084 'src/on_change_threshold.cpp',
Krzysztof Grobelny7f06f612020-09-24 13:42:10 +020085 'src/persistent_json_storage.cpp',
Wludzik, Jozefcb88cfd2020-09-28 16:38:57 +020086 'src/report.cpp',
Wludzik, Jozef2f9f9b82020-10-13 09:07:45 +020087 'src/report_factory.cpp',
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020088 'src/report_manager.cpp',
Krzysztof Grobelnyb5645942020-09-29 11:52:45 +020089 'src/sensor.cpp',
Krzysztof Grobelny7f06f612020-09-24 13:42:10 +020090 'src/sensor_cache.cpp',
Wludzik, Jozef76833cb2020-12-21 14:42:41 +010091 'src/trigger.cpp',
Wludzik, Jozefd960e1f2021-01-08 09:25:59 +010092 'src/trigger_actions.cpp',
Wludzik, Jozef76833cb2020-12-21 14:42:41 +010093 'src/trigger_factory.cpp',
94 'src/trigger_manager.cpp',
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +000095 'src/types/report_types.cpp',
Cezary Zwolak4416fce2021-03-17 03:21:06 +010096 'src/utils/conversion_trigger.cpp',
Krzysztof Grobelnyb8cc78d2021-11-29 15:54:53 +010097 'src/utils/generate_id.cpp',
Krzysztof Grobelnye6d48872022-02-08 13:41:30 +010098 'src/utils/messanger_service.cpp',
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020099 ],
100 dependencies: [
101 boost,
Krzysztof Grobelny73da6902020-09-24 13:42:04 +0200102 nlohmann_json,
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +0200103 sdbusplus,
104 phosphor_logging,
105 ],
106 include_directories: 'src',
107 install: true,
108 install_dir: get_option('prefix') / get_option('bindir'),
109 pie: true,
110)
111
112configure_file(
113 input: 'xyz.openbmc_project.Telemetry.service.in',
114 output: 'xyz.openbmc_project.Telemetry.service',
115 configuration: {
116 'bindir': get_option('prefix') / get_option('bindir'),
117 },
118 install: true,
Patrick Williamsbdf87192021-12-03 10:08:57 -0600119 install_dir: systemd.get_variable(pkgconfig: 'systemdsystemunitdir'),
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +0200120)
Krzysztof Grobelny73da6902020-09-24 13:42:04 +0200121
122if get_option('buildtest')
123 subdir('tests')
124endif