blob: 2c5b23b63e1908846603300327a55c1c98143fd8 [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 Grobelny62c08e92022-09-16 10:28:53 +020066 'src/errors.cpp',
Krzysztof Grobelnyf7ea2992022-01-27 11:04:58 +010067 'src/metrics/collection_data.cpp',
68 'src/metrics/collection_function.cpp',
Wludzik, Jozef1477fe62021-01-02 11:56:10 +010069 'src/numeric_threshold.cpp',
Szymon Dompkef763c9e2021-03-12 09:19:22 +010070 'src/on_change_threshold.cpp',
Krzysztof Grobelny7f06f612020-09-24 13:42:10 +020071 'src/persistent_json_storage.cpp',
Wludzik, Jozefcb88cfd2020-09-28 16:38:57 +020072 'src/report.cpp',
Wludzik, Jozef2f9f9b82020-10-13 09:07:45 +020073 'src/report_factory.cpp',
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020074 'src/report_manager.cpp',
Krzysztof Grobelnyb5645942020-09-29 11:52:45 +020075 'src/sensor.cpp',
Krzysztof Grobelny7f06f612020-09-24 13:42:10 +020076 'src/sensor_cache.cpp',
Wludzik, Jozef76833cb2020-12-21 14:42:41 +010077 'src/trigger.cpp',
Wludzik, Jozefd960e1f2021-01-08 09:25:59 +010078 'src/trigger_actions.cpp',
Wludzik, Jozef76833cb2020-12-21 14:42:41 +010079 'src/trigger_factory.cpp',
80 'src/trigger_manager.cpp',
Krzysztof Grobelny493e62e2022-02-14 10:55:50 +010081 'src/types/readings.cpp',
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +000082 'src/types/report_types.cpp',
Cezary Zwolak4416fce2021-03-17 03:21:06 +010083 'src/utils/conversion_trigger.cpp',
Szymon Dompke1cdd7e42022-06-08 14:43:13 +020084 'src/utils/dbus_path_utils.cpp',
Szymon Dompke32305f12022-07-05 15:37:21 +020085 'src/utils/make_id_name.cpp',
Krzysztof Grobelnye6d48872022-02-08 13:41:30 +010086 'src/utils/messanger_service.cpp',
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020087 ],
88 dependencies: [
89 boost,
Krzysztof Grobelny73da6902020-09-24 13:42:04 +020090 nlohmann_json,
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020091 sdbusplus,
92 phosphor_logging,
93 ],
94 include_directories: 'src',
95 install: true,
96 install_dir: get_option('prefix') / get_option('bindir'),
97 pie: true,
98)
99
Szymon Dompke458a37d2022-08-05 10:16:39 +0200100service_wants = ''
101if get_option('service-wants').length() > 0
102 service_wants = '\nWants=' + ' '.join(get_option('service-wants'))
103endif
104
105service_requires = ''
106if get_option('service-requires').length() > 0
107 service_requires = '\nRequires=' + ' '.join(get_option('service-requires'))
108endif
109
110service_before = ''
111if get_option('service-before').length() > 0
112 service_before = '\nBefore=' + ' '.join(get_option('service-before'))
113endif
114
115service_after = ''
116if get_option('service-after').length() > 0
117 service_after = ' ' + ' '.join(get_option('service-after'))
118endif
119
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +0200120configure_file(
121 input: 'xyz.openbmc_project.Telemetry.service.in',
122 output: 'xyz.openbmc_project.Telemetry.service',
123 configuration: {
124 'bindir': get_option('prefix') / get_option('bindir'),
Szymon Dompke458a37d2022-08-05 10:16:39 +0200125 'wants': service_wants,
126 'requires': service_requires,
127 'before': service_before,
128 'after': service_after
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +0200129 },
130 install: true,
Patrick Williamsbdf87192021-12-03 10:08:57 -0600131 install_dir: systemd.get_variable(pkgconfig: 'systemdsystemunitdir'),
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +0200132)
Krzysztof Grobelny73da6902020-09-24 13:42:04 +0200133
134if get_option('buildtest')
135 subdir('tests')
136endif