blob: 5e4fa209eecc0a4fef2241689a43caa6df56ee6a [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',
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +02008 'warning_level=3',
9 'werror=true',
10 'b_lto=true',
11 ],
12 license: 'Apache-2.0',
13)
14
Szymon Dompke1b03c8d2022-10-13 18:06:17 +020015cxx = meson.get_compiler('cpp')
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020016add_project_arguments(
Szymon Dompke1b03c8d2022-10-13 18:06:17 +020017 cxx.get_supported_arguments([
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020018 '-DBOOST_ASIO_DISABLE_THREADS',
19 '-DBOOST_ALL_NO_LIB',
20 '-DBOOST_SYSTEM_NO_DEPRECATED',
21 '-DBOOST_ASIO_NO_DEPRECATED',
22 '-DBOOST_NO_RTTI',
23 '-DBOOST_NO_TYPEID',
24 '-Wno-unused-parameter',
25 ]),
26 language: 'cpp'
27)
28
Szymon Dompke1b03c8d2022-10-13 18:06:17 +020029boost_version = '>=1.79.0'
30boost_modules = ['coroutine', 'context']
31boost = dependency('boost',
32 version: boost_version,
33 modules: boost_modules)
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020034
Patrick Williamsf8ae65c2022-03-21 10:21:36 -050035phosphor_logging = dependency('phosphor-logging')
36sdbusplus = dependency('sdbusplus')
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020037systemd = dependency('systemd')
38
Szymon Dompke1b03c8d2022-10-13 18:06:17 +020039if cxx.has_header('nlohmann/json.hpp')
Krzysztof Grobelny73da6902020-09-24 13:42:04 +020040 nlohmann_json = declare_dependency()
41else
Patrick Williamsf8ae65c2022-03-21 10:21:36 -050042 nlohmann_json = dependency('nlohmann_json')
Krzysztof Grobelny73da6902020-09-24 13:42:04 +020043endif
44
Wludzik, Jozef503c1582020-12-11 14:48:01 +010045add_project_arguments(
46 '-DTELEMETRY_MAX_REPORTS=' + get_option('max-reports').to_string(),
Wludzik, Jozef596a9942021-01-27 12:28:59 +010047 '-DTELEMETRY_MAX_READING_PARAMS=' +
48 get_option('max-reading-parameters').to_string(),
Wludzik, Jozef503c1582020-12-11 14:48:01 +010049 '-DTELEMETRY_MIN_INTERVAL=' + get_option('min-interval').to_string(),
Wludzik, Jozef76833cb2020-12-21 14:42:41 +010050 '-DTELEMETRY_MAX_TRIGGERS=' + get_option('max-triggers').to_string(),
Szymon Dompkee28aa532021-10-27 12:33:12 +020051 '-DTELEMETRY_MAX_DBUS_PATH_LENGTH=' +
52 get_option('max-dbus-path-length').to_string(),
Ankita Vilas Gawadecd5b0b72022-01-20 20:55:04 +000053 '-DTELEMETRY_MAX_APPEND_LIMIT=' +
54 get_option('max-append-limit').to_string(),
Szymon Dompke32305f12022-07-05 15:37:21 +020055 '-DTELEMETRY_MAX_ID_NAME_LENGTH=' + get_option('max-id-name-length').to_string(),
56 '-DTELEMETRY_MAX_PREFIX_LENGTH=' + get_option('max-prefix-length').to_string(),
Wludzik, Jozef503c1582020-12-11 14:48:01 +010057 language: 'cpp'
58)
59
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020060executable(
61 'telemetry',
62 [
Szymon Dompkef763c9e2021-03-12 09:19:22 +010063 'src/discrete_threshold.cpp',
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020064 'src/main.cpp',
Krzysztof Grobelnyc8e3a642020-10-23 12:29:16 +020065 'src/metric.cpp',
Krzysztof Grobelnyf7ea2992022-01-27 11:04:58 +010066 'src/metrics/collection_data.cpp',
67 'src/metrics/collection_function.cpp',
Wludzik, Jozef1477fe62021-01-02 11:56:10 +010068 'src/numeric_threshold.cpp',
Szymon Dompkef763c9e2021-03-12 09:19:22 +010069 'src/on_change_threshold.cpp',
Krzysztof Grobelny7f06f612020-09-24 13:42:10 +020070 'src/persistent_json_storage.cpp',
Wludzik, Jozefcb88cfd2020-09-28 16:38:57 +020071 'src/report.cpp',
Wludzik, Jozef2f9f9b82020-10-13 09:07:45 +020072 'src/report_factory.cpp',
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020073 'src/report_manager.cpp',
Krzysztof Grobelnyb5645942020-09-29 11:52:45 +020074 'src/sensor.cpp',
Krzysztof Grobelny7f06f612020-09-24 13:42:10 +020075 'src/sensor_cache.cpp',
Wludzik, Jozef76833cb2020-12-21 14:42:41 +010076 'src/trigger.cpp',
Wludzik, Jozefd960e1f2021-01-08 09:25:59 +010077 'src/trigger_actions.cpp',
Wludzik, Jozef76833cb2020-12-21 14:42:41 +010078 'src/trigger_factory.cpp',
79 'src/trigger_manager.cpp',
Krzysztof Grobelny493e62e2022-02-14 10:55:50 +010080 'src/types/readings.cpp',
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +000081 'src/types/report_types.cpp',
Cezary Zwolak4416fce2021-03-17 03:21:06 +010082 'src/utils/conversion_trigger.cpp',
Szymon Dompke1cdd7e42022-06-08 14:43:13 +020083 'src/utils/dbus_path_utils.cpp',
Szymon Dompke32305f12022-07-05 15:37:21 +020084 'src/utils/make_id_name.cpp',
Krzysztof Grobelnye6d48872022-02-08 13:41:30 +010085 'src/utils/messanger_service.cpp',
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020086 ],
87 dependencies: [
88 boost,
Krzysztof Grobelny73da6902020-09-24 13:42:04 +020089 nlohmann_json,
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020090 sdbusplus,
91 phosphor_logging,
92 ],
93 include_directories: 'src',
94 install: true,
95 install_dir: get_option('prefix') / get_option('bindir'),
96 pie: true,
97)
98
Szymon Dompke458a37d2022-08-05 10:16:39 +020099service_wants = ''
100if get_option('service-wants').length() > 0
101 service_wants = '\nWants=' + ' '.join(get_option('service-wants'))
102endif
103
104service_requires = ''
105if get_option('service-requires').length() > 0
106 service_requires = '\nRequires=' + ' '.join(get_option('service-requires'))
107endif
108
109service_before = ''
110if get_option('service-before').length() > 0
111 service_before = '\nBefore=' + ' '.join(get_option('service-before'))
112endif
113
114service_after = ''
115if get_option('service-after').length() > 0
116 service_after = ' ' + ' '.join(get_option('service-after'))
117endif
118
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +0200119configure_file(
120 input: 'xyz.openbmc_project.Telemetry.service.in',
121 output: 'xyz.openbmc_project.Telemetry.service',
122 configuration: {
123 'bindir': get_option('prefix') / get_option('bindir'),
Szymon Dompke458a37d2022-08-05 10:16:39 +0200124 'wants': service_wants,
125 'requires': service_requires,
126 'before': service_before,
127 'after': service_after
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +0200128 },
129 install: true,
Patrick Williamsbdf87192021-12-03 10:08:57 -0600130 install_dir: systemd.get_variable(pkgconfig: 'systemdsystemunitdir'),
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +0200131)
Krzysztof Grobelny73da6902020-09-24 13:42:04 +0200132
133if get_option('buildtest')
134 subdir('tests')
135endif