blob: 811749f259e6a75f22a8448cac092e09240b255e [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(),
Wludzik, Jozef503c1582020-12-11 14:48:01 +010070 language: 'cpp'
71)
72
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020073executable(
74 'telemetry',
75 [
Krzysztof Grobelny80697712021-03-04 09:49:27 +000076 'src/details/collection_function.cpp',
Szymon Dompkef763c9e2021-03-12 09:19:22 +010077 'src/discrete_threshold.cpp',
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020078 'src/main.cpp',
Krzysztof Grobelnyc8e3a642020-10-23 12:29:16 +020079 'src/metric.cpp',
Wludzik, Jozef1477fe62021-01-02 11:56:10 +010080 'src/numeric_threshold.cpp',
Szymon Dompkef763c9e2021-03-12 09:19:22 +010081 'src/on_change_threshold.cpp',
Krzysztof Grobelny7f06f612020-09-24 13:42:10 +020082 'src/persistent_json_storage.cpp',
Wludzik, Jozefcb88cfd2020-09-28 16:38:57 +020083 'src/report.cpp',
Wludzik, Jozef2f9f9b82020-10-13 09:07:45 +020084 'src/report_factory.cpp',
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020085 'src/report_manager.cpp',
Krzysztof Grobelnyb5645942020-09-29 11:52:45 +020086 'src/sensor.cpp',
Krzysztof Grobelny7f06f612020-09-24 13:42:10 +020087 'src/sensor_cache.cpp',
Wludzik, Jozef76833cb2020-12-21 14:42:41 +010088 'src/trigger.cpp',
Wludzik, Jozefd960e1f2021-01-08 09:25:59 +010089 'src/trigger_actions.cpp',
Wludzik, Jozef76833cb2020-12-21 14:42:41 +010090 'src/trigger_factory.cpp',
91 'src/trigger_manager.cpp',
Krzysztof Grobelnydcc4e192021-03-08 09:09:34 +000092 'src/types/report_types.cpp',
Cezary Zwolak4416fce2021-03-17 03:21:06 +010093 'src/utils/conversion_trigger.cpp',
Krzysztof Grobelnyb8cc78d2021-11-29 15:54:53 +010094 'src/utils/generate_id.cpp',
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020095 ],
96 dependencies: [
97 boost,
Krzysztof Grobelny73da6902020-09-24 13:42:04 +020098 nlohmann_json,
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020099 sdbusplus,
100 phosphor_logging,
101 ],
102 include_directories: 'src',
103 install: true,
104 install_dir: get_option('prefix') / get_option('bindir'),
105 pie: true,
106)
107
108configure_file(
109 input: 'xyz.openbmc_project.Telemetry.service.in',
110 output: 'xyz.openbmc_project.Telemetry.service',
111 configuration: {
112 'bindir': get_option('prefix') / get_option('bindir'),
113 },
114 install: true,
Patrick Williamsbdf87192021-12-03 10:08:57 -0600115 install_dir: systemd.get_variable(pkgconfig: 'systemdsystemunitdir'),
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +0200116)
Krzysztof Grobelny73da6902020-09-24 13:42:04 +0200117
118if get_option('buildtest')
119 subdir('tests')
120endif