1project( 2 'Telemetry', 3 'cpp', 4 meson_version: '>=1.1.1', 5 default_options: [ 6 'buildtype=debugoptimized', 7 'cpp_std=c++23', 8 'warning_level=3', 9 'werror=true', 10 'b_lto=true', 11 ], 12 license: 'Apache-2.0', 13) 14 15cxx = meson.get_compiler('cpp') 16add_project_arguments( 17 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', 29) 30 31boost_version = '>=1.79.0' 32boost_modules = ['coroutine', 'context'] 33boost = dependency('boost', version: boost_version, modules: boost_modules) 34 35nlohmann_json_dep = dependency('nlohmann_json', include_type: 'system') 36phosphor_logging = dependency('phosphor-logging') 37sdbusplus = dependency('sdbusplus') 38systemd = dependency('systemd') 39 40add_project_arguments( 41 '-DTELEMETRY_MAX_REPORTS=' + get_option('max-reports').to_string(), 42 '-DTELEMETRY_MAX_READING_PARAMS=' + get_option('max-reading-parameters').to_string(), 43 '-DTELEMETRY_MIN_INTERVAL=' + get_option('min-interval').to_string(), 44 '-DTELEMETRY_MAX_TRIGGERS=' + get_option('max-triggers').to_string(), 45 '-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(), 47 '-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(), 49 language: 'cpp', 50) 51 52executable( 53 'telemetry', 54 [ 55 'src/discrete_threshold.cpp', 56 'src/main.cpp', 57 'src/metric.cpp', 58 'src/errors.cpp', 59 'src/metrics/collection_data.cpp', 60 'src/metrics/collection_function.cpp', 61 'src/numeric_threshold.cpp', 62 'src/on_change_threshold.cpp', 63 'src/persistent_json_storage.cpp', 64 'src/report.cpp', 65 'src/report_factory.cpp', 66 'src/report_manager.cpp', 67 'src/sensor.cpp', 68 'src/sensor_cache.cpp', 69 'src/trigger.cpp', 70 'src/trigger_actions.cpp', 71 'src/trigger_factory.cpp', 72 'src/trigger_manager.cpp', 73 'src/types/readings.cpp', 74 'src/types/report_types.cpp', 75 'src/utils/conversion_trigger.cpp', 76 'src/utils/dbus_path_utils.cpp', 77 'src/utils/make_id_name.cpp', 78 'src/utils/messanger_service.cpp', 79 ], 80 dependencies: [boost, nlohmann_json_dep, sdbusplus, phosphor_logging], 81 include_directories: 'src', 82 install: true, 83 install_dir: get_option('prefix') / get_option('bindir'), 84 pie: true, 85) 86 87service_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 107configure_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'), 112 'wants': service_wants, 113 'requires': service_requires, 114 'before': service_before, 115 'after': service_after, 116 }, 117 install: true, 118 install_dir: systemd.get_variable('systemd_system_unit_dir'), 119) 120 121if get_option('buildtest') 122 subdir('tests') 123endif 124