Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 1 | project( |
| 2 | 'Telemetry', |
| 3 | 'cpp', |
Patrick Williams | 934201f | 2021-10-06 15:41:36 -0500 | [diff] [blame] | 4 | meson_version: '>=0.57.0', |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 5 | default_options: [ |
| 6 | 'buildtype=debugoptimized', |
Patrick Williams | 934201f | 2021-10-06 15:41:36 -0500 | [diff] [blame] | 7 | 'cpp_std=c++20', |
Wludzik, Jozef | a4bf740 | 2020-10-21 15:08:58 +0200 | [diff] [blame] | 8 | # 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 Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 11 | 'warning_level=3', |
| 12 | 'werror=true', |
| 13 | 'b_lto=true', |
| 14 | ], |
| 15 | license: 'Apache-2.0', |
| 16 | ) |
| 17 | |
Lukasz Kazmierczak | a74e44f | 2021-07-23 15:02:20 +0200 | [diff] [blame] | 18 | summary({'Fast build with link-time optimizer disabled': |
| 19 | not get_option('b_lto')}, section: 'General') |
| 20 | |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 21 | cpp = meson.get_compiler('cpp') |
| 22 | add_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, Jozef | 596a994 | 2021-01-27 12:28:59 +0100 | [diff] [blame] | 30 | # TODO: Removed below arg after upgrade to Boost 1.75 |
| 31 | '-DBOOST_ALLOW_DEPRECATED_HEADERS', |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 32 | '-Wno-unused-parameter', |
| 33 | ]), |
| 34 | language: 'cpp' |
| 35 | ) |
| 36 | |
Krzysztof Grobelny | b564594 | 2020-09-29 11:52:45 +0200 | [diff] [blame] | 37 | boost = dependency( |
Wludzik, Jozef | 596a994 | 2021-01-27 12:28:59 +0100 | [diff] [blame] | 38 | 'boost', |
| 39 | version: '>=1.74.0', |
| 40 | required: false, |
| 41 | modules: ['coroutine']) |
| 42 | assert(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 Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 46 | |
Patrick Williams | f8ae65c | 2022-03-21 10:21:36 -0500 | [diff] [blame] | 47 | phosphor_logging = dependency('phosphor-logging') |
| 48 | sdbusplus = dependency('sdbusplus') |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 49 | systemd = dependency('systemd') |
| 50 | |
Krzysztof Grobelny | 73da690 | 2020-09-24 13:42:04 +0200 | [diff] [blame] | 51 | if cpp.has_header('nlohmann/json.hpp') |
| 52 | nlohmann_json = declare_dependency() |
| 53 | else |
Patrick Williams | f8ae65c | 2022-03-21 10:21:36 -0500 | [diff] [blame] | 54 | nlohmann_json = dependency('nlohmann_json') |
Krzysztof Grobelny | 73da690 | 2020-09-24 13:42:04 +0200 | [diff] [blame] | 55 | endif |
| 56 | |
Wludzik, Jozef | 503c158 | 2020-12-11 14:48:01 +0100 | [diff] [blame] | 57 | add_project_arguments( |
| 58 | '-DTELEMETRY_MAX_REPORTS=' + get_option('max-reports').to_string(), |
Wludzik, Jozef | 596a994 | 2021-01-27 12:28:59 +0100 | [diff] [blame] | 59 | '-DTELEMETRY_MAX_READING_PARAMS=' + |
| 60 | get_option('max-reading-parameters').to_string(), |
Wludzik, Jozef | 503c158 | 2020-12-11 14:48:01 +0100 | [diff] [blame] | 61 | '-DTELEMETRY_MIN_INTERVAL=' + get_option('min-interval').to_string(), |
Wludzik, Jozef | 76833cb | 2020-12-21 14:42:41 +0100 | [diff] [blame] | 62 | '-DTELEMETRY_MAX_TRIGGERS=' + get_option('max-triggers').to_string(), |
Szymon Dompke | e28aa53 | 2021-10-27 12:33:12 +0200 | [diff] [blame] | 63 | '-DTELEMETRY_MAX_DBUS_PATH_LENGTH=' + |
| 64 | get_option('max-dbus-path-length').to_string(), |
Ankita Vilas Gawade | cd5b0b7 | 2022-01-20 20:55:04 +0000 | [diff] [blame] | 65 | '-DTELEMETRY_MAX_APPEND_LIMIT=' + |
| 66 | get_option('max-append-limit').to_string(), |
Szymon Dompke | 32305f1 | 2022-07-05 15:37:21 +0200 | [diff] [blame] | 67 | '-DTELEMETRY_MAX_ID_NAME_LENGTH=' + get_option('max-id-name-length').to_string(), |
| 68 | '-DTELEMETRY_MAX_PREFIX_LENGTH=' + get_option('max-prefix-length').to_string(), |
Wludzik, Jozef | 503c158 | 2020-12-11 14:48:01 +0100 | [diff] [blame] | 69 | language: 'cpp' |
| 70 | ) |
| 71 | |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 72 | executable( |
| 73 | 'telemetry', |
| 74 | [ |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 75 | 'src/discrete_threshold.cpp', |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 76 | 'src/main.cpp', |
Krzysztof Grobelny | c8e3a64 | 2020-10-23 12:29:16 +0200 | [diff] [blame] | 77 | 'src/metric.cpp', |
Krzysztof Grobelny | f7ea299 | 2022-01-27 11:04:58 +0100 | [diff] [blame] | 78 | 'src/metrics/collection_data.cpp', |
| 79 | 'src/metrics/collection_function.cpp', |
Wludzik, Jozef | 1477fe6 | 2021-01-02 11:56:10 +0100 | [diff] [blame] | 80 | 'src/numeric_threshold.cpp', |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 81 | 'src/on_change_threshold.cpp', |
Krzysztof Grobelny | 7f06f61 | 2020-09-24 13:42:10 +0200 | [diff] [blame] | 82 | 'src/persistent_json_storage.cpp', |
Wludzik, Jozef | cb88cfd | 2020-09-28 16:38:57 +0200 | [diff] [blame] | 83 | 'src/report.cpp', |
Wludzik, Jozef | 2f9f9b8 | 2020-10-13 09:07:45 +0200 | [diff] [blame] | 84 | 'src/report_factory.cpp', |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 85 | 'src/report_manager.cpp', |
Krzysztof Grobelny | b564594 | 2020-09-29 11:52:45 +0200 | [diff] [blame] | 86 | 'src/sensor.cpp', |
Krzysztof Grobelny | 7f06f61 | 2020-09-24 13:42:10 +0200 | [diff] [blame] | 87 | 'src/sensor_cache.cpp', |
Wludzik, Jozef | 76833cb | 2020-12-21 14:42:41 +0100 | [diff] [blame] | 88 | 'src/trigger.cpp', |
Wludzik, Jozef | d960e1f | 2021-01-08 09:25:59 +0100 | [diff] [blame] | 89 | 'src/trigger_actions.cpp', |
Wludzik, Jozef | 76833cb | 2020-12-21 14:42:41 +0100 | [diff] [blame] | 90 | 'src/trigger_factory.cpp', |
| 91 | 'src/trigger_manager.cpp', |
Krzysztof Grobelny | 493e62e | 2022-02-14 10:55:50 +0100 | [diff] [blame] | 92 | 'src/types/readings.cpp', |
Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame] | 93 | 'src/types/report_types.cpp', |
Cezary Zwolak | 4416fce | 2021-03-17 03:21:06 +0100 | [diff] [blame] | 94 | 'src/utils/conversion_trigger.cpp', |
Szymon Dompke | 1cdd7e4 | 2022-06-08 14:43:13 +0200 | [diff] [blame] | 95 | 'src/utils/dbus_path_utils.cpp', |
Szymon Dompke | 32305f1 | 2022-07-05 15:37:21 +0200 | [diff] [blame] | 96 | 'src/utils/make_id_name.cpp', |
Krzysztof Grobelny | e6d4887 | 2022-02-08 13:41:30 +0100 | [diff] [blame] | 97 | 'src/utils/messanger_service.cpp', |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 98 | ], |
| 99 | dependencies: [ |
| 100 | boost, |
Krzysztof Grobelny | 73da690 | 2020-09-24 13:42:04 +0200 | [diff] [blame] | 101 | nlohmann_json, |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 102 | sdbusplus, |
| 103 | phosphor_logging, |
| 104 | ], |
| 105 | include_directories: 'src', |
| 106 | install: true, |
| 107 | install_dir: get_option('prefix') / get_option('bindir'), |
| 108 | pie: true, |
| 109 | ) |
| 110 | |
Szymon Dompke | 458a37d | 2022-08-05 10:16:39 +0200 | [diff] [blame] | 111 | service_wants = '' |
| 112 | if get_option('service-wants').length() > 0 |
| 113 | service_wants = '\nWants=' + ' '.join(get_option('service-wants')) |
| 114 | endif |
| 115 | |
| 116 | service_requires = '' |
| 117 | if get_option('service-requires').length() > 0 |
| 118 | service_requires = '\nRequires=' + ' '.join(get_option('service-requires')) |
| 119 | endif |
| 120 | |
| 121 | service_before = '' |
| 122 | if get_option('service-before').length() > 0 |
| 123 | service_before = '\nBefore=' + ' '.join(get_option('service-before')) |
| 124 | endif |
| 125 | |
| 126 | service_after = '' |
| 127 | if get_option('service-after').length() > 0 |
| 128 | service_after = ' ' + ' '.join(get_option('service-after')) |
| 129 | endif |
| 130 | |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 131 | configure_file( |
| 132 | input: 'xyz.openbmc_project.Telemetry.service.in', |
| 133 | output: 'xyz.openbmc_project.Telemetry.service', |
| 134 | configuration: { |
| 135 | 'bindir': get_option('prefix') / get_option('bindir'), |
Szymon Dompke | 458a37d | 2022-08-05 10:16:39 +0200 | [diff] [blame] | 136 | 'wants': service_wants, |
| 137 | 'requires': service_requires, |
| 138 | 'before': service_before, |
| 139 | 'after': service_after |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 140 | }, |
| 141 | install: true, |
Patrick Williams | bdf8719 | 2021-12-03 10:08:57 -0600 | [diff] [blame] | 142 | install_dir: systemd.get_variable(pkgconfig: 'systemdsystemunitdir'), |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 143 | ) |
Krzysztof Grobelny | 73da690 | 2020-09-24 13:42:04 +0200 | [diff] [blame] | 144 | |
| 145 | if get_option('buildtest') |
| 146 | subdir('tests') |
| 147 | endif |