1project( 2 'Telemetry', 3 'cpp', 4 meson_version: '>=0.58.0', 5 default_options: [ 6 'buildtype=debugoptimized', 7 'cpp_std=c++20', 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 '-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 29boost_version = '>=1.79.0' 30boost_modules = ['coroutine', 'context'] 31boost = dependency('boost', 32 version: boost_version, 33 modules: boost_modules) 34 35phosphor_logging = dependency('phosphor-logging') 36sdbusplus = dependency('sdbusplus') 37systemd = dependency('systemd') 38 39if cxx.has_header('nlohmann/json.hpp') 40 nlohmann_json = declare_dependency() 41else 42 nlohmann_json = dependency('nlohmann_json') 43endif 44 45add_project_arguments( 46 '-DTELEMETRY_MAX_REPORTS=' + get_option('max-reports').to_string(), 47 '-DTELEMETRY_MAX_READING_PARAMS=' + 48 get_option('max-reading-parameters').to_string(), 49 '-DTELEMETRY_MIN_INTERVAL=' + get_option('min-interval').to_string(), 50 '-DTELEMETRY_MAX_TRIGGERS=' + get_option('max-triggers').to_string(), 51 '-DTELEMETRY_MAX_DBUS_PATH_LENGTH=' + 52 get_option('max-dbus-path-length').to_string(), 53 '-DTELEMETRY_MAX_APPEND_LIMIT=' + 54 get_option('max-append-limit').to_string(), 55 '-DTELEMETRY_MAX_ID_NAME_LENGTH=' + get_option('max-id-name-length').to_string(), 56 '-DTELEMETRY_MAX_PREFIX_LENGTH=' + get_option('max-prefix-length').to_string(), 57 language: 'cpp' 58) 59 60executable( 61 'telemetry', 62 [ 63 'src/discrete_threshold.cpp', 64 'src/main.cpp', 65 'src/metric.cpp', 66 'src/errors.cpp', 67 'src/metrics/collection_data.cpp', 68 'src/metrics/collection_function.cpp', 69 'src/numeric_threshold.cpp', 70 'src/on_change_threshold.cpp', 71 'src/persistent_json_storage.cpp', 72 'src/report.cpp', 73 'src/report_factory.cpp', 74 'src/report_manager.cpp', 75 'src/sensor.cpp', 76 'src/sensor_cache.cpp', 77 'src/trigger.cpp', 78 'src/trigger_actions.cpp', 79 'src/trigger_factory.cpp', 80 'src/trigger_manager.cpp', 81 'src/types/readings.cpp', 82 'src/types/report_types.cpp', 83 'src/utils/conversion_trigger.cpp', 84 'src/utils/dbus_path_utils.cpp', 85 'src/utils/make_id_name.cpp', 86 'src/utils/messanger_service.cpp', 87 ], 88 dependencies: [ 89 boost, 90 nlohmann_json, 91 sdbusplus, 92 phosphor_logging, 93 ], 94 include_directories: 'src', 95 install: true, 96 install_dir: get_option('prefix') / get_option('bindir'), 97 pie: true, 98) 99 100service_wants = '' 101if get_option('service-wants').length() > 0 102 service_wants = '\nWants=' + ' '.join(get_option('service-wants')) 103endif 104 105service_requires = '' 106if get_option('service-requires').length() > 0 107 service_requires = '\nRequires=' + ' '.join(get_option('service-requires')) 108endif 109 110service_before = '' 111if get_option('service-before').length() > 0 112 service_before = '\nBefore=' + ' '.join(get_option('service-before')) 113endif 114 115service_after = '' 116if get_option('service-after').length() > 0 117 service_after = ' ' + ' '.join(get_option('service-after')) 118endif 119 120configure_file( 121 input: 'xyz.openbmc_project.Telemetry.service.in', 122 output: 'xyz.openbmc_project.Telemetry.service', 123 configuration: { 124 'bindir': get_option('prefix') / get_option('bindir'), 125 'wants': service_wants, 126 'requires': service_requires, 127 'before': service_before, 128 'after': service_after 129 }, 130 install: true, 131 install_dir: systemd.get_variable('systemdsystemunitdir'), 132) 133 134if get_option('buildtest') 135 subdir('tests') 136endif 137