blob: bffa7c8a1a5bcc8285936b9a2dfa38d5953df210 [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(
Patrick Williams7d24aa22025-02-01 08:37:37 -050017 cxx.get_supported_arguments(
18 [
19 '-DBOOST_ASIO_DISABLE_THREADS',
20 '-DBOOST_ALL_NO_LIB',
21 '-DBOOST_SYSTEM_NO_DEPRECATED',
22 '-DBOOST_ASIO_NO_DEPRECATED',
23 '-DBOOST_NO_RTTI',
24 '-DBOOST_NO_TYPEID',
25 '-Wno-unused-parameter',
26 ],
27 ),
28 language: 'cpp',
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020029)
30
Szymon Dompke1b03c8d2022-10-13 18:06:17 +020031boost_version = '>=1.79.0'
32boost_modules = ['coroutine', 'context']
Patrick Williams7d24aa22025-02-01 08:37:37 -050033boost = dependency('boost', version: boost_version, 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(),
Patrick Williams7d24aa22025-02-01 08:37:37 -050042 '-DTELEMETRY_MAX_READING_PARAMS=' + get_option('max-reading-parameters').to_string(),
Wludzik, Jozef503c1582020-12-11 14:48:01 +010043 '-DTELEMETRY_MIN_INTERVAL=' + get_option('min-interval').to_string(),
Wludzik, Jozef76833cb2020-12-21 14:42:41 +010044 '-DTELEMETRY_MAX_TRIGGERS=' + get_option('max-triggers').to_string(),
Patrick Williams7d24aa22025-02-01 08:37:37 -050045 '-DTELEMETRY_MAX_DBUS_PATH_LENGTH=' + get_option('max-dbus-path-length').to_string(),
46 '-DTELEMETRY_MAX_APPEND_LIMIT=' + get_option('max-append-limit').to_string(),
Szymon Dompke32305f12022-07-05 15:37:21 +020047 '-DTELEMETRY_MAX_ID_NAME_LENGTH=' + get_option('max-id-name-length').to_string(),
48 '-DTELEMETRY_MAX_PREFIX_LENGTH=' + get_option('max-prefix-length').to_string(),
Patrick Williams7d24aa22025-02-01 08:37:37 -050049 language: 'cpp',
Wludzik, Jozef503c1582020-12-11 14:48:01 +010050)
51
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020052executable(
53 'telemetry',
54 [
Szymon Dompkef763c9e2021-03-12 09:19:22 +010055 'src/discrete_threshold.cpp',
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020056 'src/main.cpp',
Krzysztof Grobelnyc8e3a642020-10-23 12:29:16 +020057 'src/metric.cpp',
Krzysztof Grobelny62c08e92022-09-16 10:28:53 +020058 'src/errors.cpp',
Krzysztof Grobelnyf7ea2992022-01-27 11:04:58 +010059 'src/metrics/collection_data.cpp',
60 'src/metrics/collection_function.cpp',
Wludzik, Jozef1477fe62021-01-02 11:56:10 +010061 'src/numeric_threshold.cpp',
Szymon Dompkef763c9e2021-03-12 09:19:22 +010062 'src/on_change_threshold.cpp',
Krzysztof Grobelny7f06f612020-09-24 13:42:10 +020063 'src/persistent_json_storage.cpp',
Wludzik, Jozefcb88cfd2020-09-28 16:38:57 +020064 'src/report.cpp',
Wludzik, Jozef2f9f9b82020-10-13 09:07:45 +020065 'src/report_factory.cpp',
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020066 'src/report_manager.cpp',
Krzysztof Grobelnyb5645942020-09-29 11:52:45 +020067 'src/sensor.cpp',
Krzysztof Grobelny7f06f612020-09-24 13:42:10 +020068 'src/sensor_cache.cpp',
Wludzik, Jozef76833cb2020-12-21 14:42:41 +010069 'src/trigger.cpp',
Wludzik, Jozefd960e1f2021-01-08 09:25:59 +010070 'src/trigger_actions.cpp',
Wludzik, Jozef76833cb2020-12-21 14:42:41 +010071 'src/trigger_factory.cpp',
72 'src/trigger_manager.cpp',
Krzysztof Grobelny493e62e2022-02-14 10:55:50 +010073 'src/types/readings.cpp',
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +000074 'src/types/report_types.cpp',
Cezary Zwolak4416fce2021-03-17 03:21:06 +010075 'src/utils/conversion_trigger.cpp',
Szymon Dompke1cdd7e42022-06-08 14:43:13 +020076 'src/utils/dbus_path_utils.cpp',
Szymon Dompke32305f12022-07-05 15:37:21 +020077 'src/utils/make_id_name.cpp',
Krzysztof Grobelnye6d48872022-02-08 13:41:30 +010078 'src/utils/messanger_service.cpp',
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020079 ],
Patrick Williams7d24aa22025-02-01 08:37:37 -050080 dependencies: [boost, nlohmann_json_dep, sdbusplus, phosphor_logging],
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020081 include_directories: 'src',
82 install: true,
83 install_dir: get_option('prefix') / get_option('bindir'),
84 pie: true,
85)
86
Szymon Dompke458a37d2022-08-05 10:16:39 +020087service_wants = ''
88if get_option('service-wants').length() > 0
89 service_wants = '\nWants=' + ' '.join(get_option('service-wants'))
90endif
91
92service_requires = ''
93if get_option('service-requires').length() > 0
94 service_requires = '\nRequires=' + ' '.join(get_option('service-requires'))
95endif
96
97service_before = ''
98if get_option('service-before').length() > 0
99 service_before = '\nBefore=' + ' '.join(get_option('service-before'))
100endif
101
102service_after = ''
103if get_option('service-after').length() > 0
104 service_after = ' ' + ' '.join(get_option('service-after'))
105endif
106
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +0200107configure_file(
108 input: 'xyz.openbmc_project.Telemetry.service.in',
109 output: 'xyz.openbmc_project.Telemetry.service',
110 configuration: {
111 'bindir': get_option('prefix') / get_option('bindir'),
Szymon Dompke458a37d2022-08-05 10:16:39 +0200112 'wants': service_wants,
113 'requires': service_requires,
114 'before': service_before,
Patrick Williams7d24aa22025-02-01 08:37:37 -0500115 'after': service_after,
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +0200116 },
117 install: true,
Patrick Williams97c20e22023-04-12 08:01:22 -0500118 install_dir: systemd.get_variable('systemdsystemunitdir'),
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +0200119)
Krzysztof Grobelny73da6902020-09-24 13:42:04 +0200120
121if get_option('buildtest')
122 subdir('tests')
123endif