blob: 19d783ed94b659c26f31efc670affc0ae5c11bd1 [file] [log] [blame]
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +02001project(
2 'Telemetry',
3 'cpp',
Patrick Williams359b7662023-07-12 11:15:49 -05004 meson_version: '>=1.1.1',
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +02005 default_options: [
6 'buildtype=debugoptimized',
Patrick Williams359b7662023-07-12 11:15:49 -05007 'cpp_std=c++23',
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',
Patrick Williams4444a132023-12-08 06:35:17 -060032 version: boost_version,
Szymon Dompke1b03c8d2022-10-13 18:06:17 +020033 modules: boost_modules)
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020034
Patrick Williams4444a132023-12-08 06:35:17 -060035nlohmann_json_dep = dependency('nlohmann_json', include_type: 'system')
Patrick Williamsf8ae65c2022-03-21 10:21:36 -050036phosphor_logging = dependency('phosphor-logging')
37sdbusplus = dependency('sdbusplus')
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020038systemd = dependency('systemd')
39
Wludzik, Jozef503c1582020-12-11 14:48:01 +010040add_project_arguments(
41 '-DTELEMETRY_MAX_REPORTS=' + get_option('max-reports').to_string(),
Wludzik, Jozef596a9942021-01-27 12:28:59 +010042 '-DTELEMETRY_MAX_READING_PARAMS=' +
43 get_option('max-reading-parameters').to_string(),
Wludzik, Jozef503c1582020-12-11 14:48:01 +010044 '-DTELEMETRY_MIN_INTERVAL=' + get_option('min-interval').to_string(),
Wludzik, Jozef76833cb2020-12-21 14:42:41 +010045 '-DTELEMETRY_MAX_TRIGGERS=' + get_option('max-triggers').to_string(),
Szymon Dompkee28aa532021-10-27 12:33:12 +020046 '-DTELEMETRY_MAX_DBUS_PATH_LENGTH=' +
47 get_option('max-dbus-path-length').to_string(),
Ankita Vilas Gawadecd5b0b72022-01-20 20:55:04 +000048 '-DTELEMETRY_MAX_APPEND_LIMIT=' +
49 get_option('max-append-limit').to_string(),
Szymon Dompke32305f12022-07-05 15:37:21 +020050 '-DTELEMETRY_MAX_ID_NAME_LENGTH=' + get_option('max-id-name-length').to_string(),
51 '-DTELEMETRY_MAX_PREFIX_LENGTH=' + get_option('max-prefix-length').to_string(),
Wludzik, Jozef503c1582020-12-11 14:48:01 +010052 language: 'cpp'
53)
54
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020055executable(
56 'telemetry',
57 [
Szymon Dompkef763c9e2021-03-12 09:19:22 +010058 'src/discrete_threshold.cpp',
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020059 'src/main.cpp',
Krzysztof Grobelnyc8e3a642020-10-23 12:29:16 +020060 'src/metric.cpp',
Krzysztof Grobelny62c08e92022-09-16 10:28:53 +020061 'src/errors.cpp',
Krzysztof Grobelnyf7ea2992022-01-27 11:04:58 +010062 'src/metrics/collection_data.cpp',
63 'src/metrics/collection_function.cpp',
Wludzik, Jozef1477fe62021-01-02 11:56:10 +010064 'src/numeric_threshold.cpp',
Szymon Dompkef763c9e2021-03-12 09:19:22 +010065 'src/on_change_threshold.cpp',
Krzysztof Grobelny7f06f612020-09-24 13:42:10 +020066 'src/persistent_json_storage.cpp',
Wludzik, Jozefcb88cfd2020-09-28 16:38:57 +020067 'src/report.cpp',
Wludzik, Jozef2f9f9b82020-10-13 09:07:45 +020068 'src/report_factory.cpp',
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020069 'src/report_manager.cpp',
Krzysztof Grobelnyb5645942020-09-29 11:52:45 +020070 'src/sensor.cpp',
Krzysztof Grobelny7f06f612020-09-24 13:42:10 +020071 'src/sensor_cache.cpp',
Wludzik, Jozef76833cb2020-12-21 14:42:41 +010072 'src/trigger.cpp',
Wludzik, Jozefd960e1f2021-01-08 09:25:59 +010073 'src/trigger_actions.cpp',
Wludzik, Jozef76833cb2020-12-21 14:42:41 +010074 'src/trigger_factory.cpp',
75 'src/trigger_manager.cpp',
Krzysztof Grobelny493e62e2022-02-14 10:55:50 +010076 'src/types/readings.cpp',
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +000077 'src/types/report_types.cpp',
Cezary Zwolak4416fce2021-03-17 03:21:06 +010078 'src/utils/conversion_trigger.cpp',
Szymon Dompke1cdd7e42022-06-08 14:43:13 +020079 'src/utils/dbus_path_utils.cpp',
Szymon Dompke32305f12022-07-05 15:37:21 +020080 'src/utils/make_id_name.cpp',
Krzysztof Grobelnye6d48872022-02-08 13:41:30 +010081 'src/utils/messanger_service.cpp',
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020082 ],
83 dependencies: [
84 boost,
Patrick Williams4444a132023-12-08 06:35:17 -060085 nlohmann_json_dep,
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020086 sdbusplus,
87 phosphor_logging,
88 ],
89 include_directories: 'src',
90 install: true,
91 install_dir: get_option('prefix') / get_option('bindir'),
92 pie: true,
93)
94
Szymon Dompke458a37d2022-08-05 10:16:39 +020095service_wants = ''
96if get_option('service-wants').length() > 0
97 service_wants = '\nWants=' + ' '.join(get_option('service-wants'))
98endif
99
100service_requires = ''
101if get_option('service-requires').length() > 0
102 service_requires = '\nRequires=' + ' '.join(get_option('service-requires'))
103endif
104
105service_before = ''
106if get_option('service-before').length() > 0
107 service_before = '\nBefore=' + ' '.join(get_option('service-before'))
108endif
109
110service_after = ''
111if get_option('service-after').length() > 0
112 service_after = ' ' + ' '.join(get_option('service-after'))
113endif
114
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +0200115configure_file(
116 input: 'xyz.openbmc_project.Telemetry.service.in',
117 output: 'xyz.openbmc_project.Telemetry.service',
118 configuration: {
119 'bindir': get_option('prefix') / get_option('bindir'),
Szymon Dompke458a37d2022-08-05 10:16:39 +0200120 'wants': service_wants,
121 'requires': service_requires,
122 'before': service_before,
123 'after': service_after
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +0200124 },
125 install: true,
Patrick Williams97c20e22023-04-12 08:01:22 -0500126 install_dir: systemd.get_variable('systemdsystemunitdir'),
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +0200127)
Krzysztof Grobelny73da6902020-09-24 13:42:04 +0200128
129if get_option('buildtest')
130 subdir('tests')
131endif