Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 1 | project( |
| 2 | 'Telemetry', |
| 3 | 'cpp', |
Patrick Williams | 359b766 | 2023-07-12 11:15:49 -0500 | [diff] [blame] | 4 | meson_version: '>=1.1.1', |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 5 | default_options: [ |
| 6 | 'buildtype=debugoptimized', |
Patrick Williams | 359b766 | 2023-07-12 11:15:49 -0500 | [diff] [blame] | 7 | 'cpp_std=c++23', |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 8 | 'warning_level=3', |
| 9 | 'werror=true', |
| 10 | 'b_lto=true', |
| 11 | ], |
| 12 | license: 'Apache-2.0', |
| 13 | ) |
| 14 | |
Szymon Dompke | 1b03c8d | 2022-10-13 18:06:17 +0200 | [diff] [blame] | 15 | cxx = meson.get_compiler('cpp') |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 16 | add_project_arguments( |
Szymon Dompke | 1b03c8d | 2022-10-13 18:06:17 +0200 | [diff] [blame] | 17 | cxx.get_supported_arguments([ |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 18 | '-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 Dompke | 1b03c8d | 2022-10-13 18:06:17 +0200 | [diff] [blame] | 29 | boost_version = '>=1.79.0' |
| 30 | boost_modules = ['coroutine', 'context'] |
| 31 | boost = dependency('boost', |
Patrick Williams | 4444a13 | 2023-12-08 06:35:17 -0600 | [diff] [blame] | 32 | version: boost_version, |
Szymon Dompke | 1b03c8d | 2022-10-13 18:06:17 +0200 | [diff] [blame] | 33 | modules: boost_modules) |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 34 | |
Patrick Williams | 4444a13 | 2023-12-08 06:35:17 -0600 | [diff] [blame] | 35 | nlohmann_json_dep = dependency('nlohmann_json', include_type: 'system') |
Patrick Williams | f8ae65c | 2022-03-21 10:21:36 -0500 | [diff] [blame] | 36 | phosphor_logging = dependency('phosphor-logging') |
| 37 | sdbusplus = dependency('sdbusplus') |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 38 | systemd = dependency('systemd') |
| 39 | |
Wludzik, Jozef | 503c158 | 2020-12-11 14:48:01 +0100 | [diff] [blame] | 40 | add_project_arguments( |
| 41 | '-DTELEMETRY_MAX_REPORTS=' + get_option('max-reports').to_string(), |
Wludzik, Jozef | 596a994 | 2021-01-27 12:28:59 +0100 | [diff] [blame] | 42 | '-DTELEMETRY_MAX_READING_PARAMS=' + |
| 43 | get_option('max-reading-parameters').to_string(), |
Wludzik, Jozef | 503c158 | 2020-12-11 14:48:01 +0100 | [diff] [blame] | 44 | '-DTELEMETRY_MIN_INTERVAL=' + get_option('min-interval').to_string(), |
Wludzik, Jozef | 76833cb | 2020-12-21 14:42:41 +0100 | [diff] [blame] | 45 | '-DTELEMETRY_MAX_TRIGGERS=' + get_option('max-triggers').to_string(), |
Szymon Dompke | e28aa53 | 2021-10-27 12:33:12 +0200 | [diff] [blame] | 46 | '-DTELEMETRY_MAX_DBUS_PATH_LENGTH=' + |
| 47 | get_option('max-dbus-path-length').to_string(), |
Ankita Vilas Gawade | cd5b0b7 | 2022-01-20 20:55:04 +0000 | [diff] [blame] | 48 | '-DTELEMETRY_MAX_APPEND_LIMIT=' + |
| 49 | get_option('max-append-limit').to_string(), |
Szymon Dompke | 32305f1 | 2022-07-05 15:37:21 +0200 | [diff] [blame] | 50 | '-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, Jozef | 503c158 | 2020-12-11 14:48:01 +0100 | [diff] [blame] | 52 | language: 'cpp' |
| 53 | ) |
| 54 | |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 55 | executable( |
| 56 | 'telemetry', |
| 57 | [ |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 58 | 'src/discrete_threshold.cpp', |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 59 | 'src/main.cpp', |
Krzysztof Grobelny | c8e3a64 | 2020-10-23 12:29:16 +0200 | [diff] [blame] | 60 | 'src/metric.cpp', |
Krzysztof Grobelny | 62c08e9 | 2022-09-16 10:28:53 +0200 | [diff] [blame] | 61 | 'src/errors.cpp', |
Krzysztof Grobelny | f7ea299 | 2022-01-27 11:04:58 +0100 | [diff] [blame] | 62 | 'src/metrics/collection_data.cpp', |
| 63 | 'src/metrics/collection_function.cpp', |
Wludzik, Jozef | 1477fe6 | 2021-01-02 11:56:10 +0100 | [diff] [blame] | 64 | 'src/numeric_threshold.cpp', |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 65 | 'src/on_change_threshold.cpp', |
Krzysztof Grobelny | 7f06f61 | 2020-09-24 13:42:10 +0200 | [diff] [blame] | 66 | 'src/persistent_json_storage.cpp', |
Wludzik, Jozef | cb88cfd | 2020-09-28 16:38:57 +0200 | [diff] [blame] | 67 | 'src/report.cpp', |
Wludzik, Jozef | 2f9f9b8 | 2020-10-13 09:07:45 +0200 | [diff] [blame] | 68 | 'src/report_factory.cpp', |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 69 | 'src/report_manager.cpp', |
Krzysztof Grobelny | b564594 | 2020-09-29 11:52:45 +0200 | [diff] [blame] | 70 | 'src/sensor.cpp', |
Krzysztof Grobelny | 7f06f61 | 2020-09-24 13:42:10 +0200 | [diff] [blame] | 71 | 'src/sensor_cache.cpp', |
Wludzik, Jozef | 76833cb | 2020-12-21 14:42:41 +0100 | [diff] [blame] | 72 | 'src/trigger.cpp', |
Wludzik, Jozef | d960e1f | 2021-01-08 09:25:59 +0100 | [diff] [blame] | 73 | 'src/trigger_actions.cpp', |
Wludzik, Jozef | 76833cb | 2020-12-21 14:42:41 +0100 | [diff] [blame] | 74 | 'src/trigger_factory.cpp', |
| 75 | 'src/trigger_manager.cpp', |
Krzysztof Grobelny | 493e62e | 2022-02-14 10:55:50 +0100 | [diff] [blame] | 76 | 'src/types/readings.cpp', |
Krzysztof Grobelny | dcc4e19 | 2021-03-08 09:09:34 +0000 | [diff] [blame] | 77 | 'src/types/report_types.cpp', |
Cezary Zwolak | 4416fce | 2021-03-17 03:21:06 +0100 | [diff] [blame] | 78 | 'src/utils/conversion_trigger.cpp', |
Szymon Dompke | 1cdd7e4 | 2022-06-08 14:43:13 +0200 | [diff] [blame] | 79 | 'src/utils/dbus_path_utils.cpp', |
Szymon Dompke | 32305f1 | 2022-07-05 15:37:21 +0200 | [diff] [blame] | 80 | 'src/utils/make_id_name.cpp', |
Krzysztof Grobelny | e6d4887 | 2022-02-08 13:41:30 +0100 | [diff] [blame] | 81 | 'src/utils/messanger_service.cpp', |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 82 | ], |
| 83 | dependencies: [ |
| 84 | boost, |
Patrick Williams | 4444a13 | 2023-12-08 06:35:17 -0600 | [diff] [blame] | 85 | nlohmann_json_dep, |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 86 | 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 Dompke | 458a37d | 2022-08-05 10:16:39 +0200 | [diff] [blame] | 95 | service_wants = '' |
| 96 | if get_option('service-wants').length() > 0 |
| 97 | service_wants = '\nWants=' + ' '.join(get_option('service-wants')) |
| 98 | endif |
| 99 | |
| 100 | service_requires = '' |
| 101 | if get_option('service-requires').length() > 0 |
| 102 | service_requires = '\nRequires=' + ' '.join(get_option('service-requires')) |
| 103 | endif |
| 104 | |
| 105 | service_before = '' |
| 106 | if get_option('service-before').length() > 0 |
| 107 | service_before = '\nBefore=' + ' '.join(get_option('service-before')) |
| 108 | endif |
| 109 | |
| 110 | service_after = '' |
| 111 | if get_option('service-after').length() > 0 |
| 112 | service_after = ' ' + ' '.join(get_option('service-after')) |
| 113 | endif |
| 114 | |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 115 | configure_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 Dompke | 458a37d | 2022-08-05 10:16:39 +0200 | [diff] [blame] | 120 | 'wants': service_wants, |
| 121 | 'requires': service_requires, |
| 122 | 'before': service_before, |
| 123 | 'after': service_after |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 124 | }, |
| 125 | install: true, |
Patrick Williams | 97c20e2 | 2023-04-12 08:01:22 -0500 | [diff] [blame] | 126 | install_dir: systemd.get_variable('systemdsystemunitdir'), |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 127 | ) |
Krzysztof Grobelny | 73da690 | 2020-09-24 13:42:04 +0200 | [diff] [blame] | 128 | |
| 129 | if get_option('buildtest') |
| 130 | subdir('tests') |
| 131 | endif |