Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 1 | project( |
| 2 | 'Telemetry', |
| 3 | 'cpp', |
Wludzik, Jozef | 0e29f43 | 2020-11-17 08:22:33 +0100 | [diff] [blame] | 4 | meson_version: '>=0.54.3', |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 5 | default_options: [ |
| 6 | 'buildtype=debugoptimized', |
| 7 | 'cpp_std=c++17', |
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 | |
| 18 | cpp = meson.get_compiler('cpp') |
| 19 | add_project_arguments( |
| 20 | cpp.get_supported_arguments([ |
| 21 | '-DBOOST_ASIO_DISABLE_THREADS', |
| 22 | '-DBOOST_ALL_NO_LIB', |
| 23 | '-DBOOST_SYSTEM_NO_DEPRECATED', |
| 24 | '-DBOOST_ASIO_NO_DEPRECATED', |
| 25 | '-DBOOST_NO_RTTI', |
| 26 | '-DBOOST_NO_TYPEID', |
Wludzik, Jozef | 596a994 | 2021-01-27 12:28:59 +0100 | [diff] [blame] | 27 | # TODO: Removed below arg after upgrade to Boost 1.75 |
| 28 | '-DBOOST_ALLOW_DEPRECATED_HEADERS', |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 29 | '-Wno-unused-parameter', |
| 30 | ]), |
| 31 | language: 'cpp' |
| 32 | ) |
| 33 | |
Krzysztof Grobelny | b564594 | 2020-09-29 11:52:45 +0200 | [diff] [blame] | 34 | boost = dependency( |
Wludzik, Jozef | 596a994 | 2021-01-27 12:28:59 +0100 | [diff] [blame] | 35 | 'boost', |
| 36 | version: '>=1.74.0', |
| 37 | required: false, |
| 38 | modules: ['coroutine']) |
| 39 | assert(boost.found(), |
| 40 | 'Missing Boost 1.74.0 or higher, as WA you can set BOOST_ROOT ' + |
| 41 | 'environemt to point at boost build. To build a boost you can use ' + |
| 42 | 'script ./scripts/boost_build_1.74.0.sh') |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 43 | |
| 44 | phosphor_logging = dependency('phosphor-logging', required: false) |
| 45 | if not phosphor_logging.found() |
| 46 | subproject('phosphor-logging', required: false) |
| 47 | phosphor_logging = declare_dependency( |
| 48 | include_directories: 'subprojects/phosphor-logging' |
| 49 | ) |
| 50 | endif |
| 51 | |
Wludzik, Jozef | 596a994 | 2021-01-27 12:28:59 +0100 | [diff] [blame] | 52 | sdbusplus = dependency('sdbusplus', fallback: ['sdbusplus', 'sdbusplus_dep']) |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 53 | systemd = dependency('systemd') |
| 54 | |
Krzysztof Grobelny | 73da690 | 2020-09-24 13:42:04 +0200 | [diff] [blame] | 55 | if cpp.has_header('nlohmann/json.hpp') |
| 56 | nlohmann_json = declare_dependency() |
| 57 | else |
Wludzik, Jozef | 596a994 | 2021-01-27 12:28:59 +0100 | [diff] [blame] | 58 | nlohmann_json = dependency('nlohmann_json', |
| 59 | fallback: ['nlohmann', 'nlohmann_json_dep']) |
Krzysztof Grobelny | 73da690 | 2020-09-24 13:42:04 +0200 | [diff] [blame] | 60 | endif |
| 61 | |
Wludzik, Jozef | 503c158 | 2020-12-11 14:48:01 +0100 | [diff] [blame] | 62 | add_project_arguments( |
| 63 | '-DTELEMETRY_MAX_REPORTS=' + get_option('max-reports').to_string(), |
Wludzik, Jozef | 596a994 | 2021-01-27 12:28:59 +0100 | [diff] [blame] | 64 | '-DTELEMETRY_MAX_READING_PARAMS=' + |
| 65 | get_option('max-reading-parameters').to_string(), |
Wludzik, Jozef | 503c158 | 2020-12-11 14:48:01 +0100 | [diff] [blame] | 66 | '-DTELEMETRY_MIN_INTERVAL=' + get_option('min-interval').to_string(), |
Wludzik, Jozef | 76833cb | 2020-12-21 14:42:41 +0100 | [diff] [blame] | 67 | '-DTELEMETRY_MAX_TRIGGERS=' + get_option('max-triggers').to_string(), |
Karol Niczyj | 32859b6 | 2021-05-19 10:20:46 +0200 | [diff] [blame] | 68 | '-DTELEMETRY_MAX_REPORT_NAME_LENGTH=' + |
| 69 | get_option('max-report-name-length').to_string(), |
Wludzik, Jozef | 503c158 | 2020-12-11 14:48:01 +0100 | [diff] [blame] | 70 | language: 'cpp' |
| 71 | ) |
| 72 | |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 73 | executable( |
| 74 | 'telemetry', |
| 75 | [ |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 76 | 'src/discrete_threshold.cpp', |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 77 | 'src/main.cpp', |
Krzysztof Grobelny | c8e3a64 | 2020-10-23 12:29:16 +0200 | [diff] [blame] | 78 | 'src/metric.cpp', |
Wludzik, Jozef | 1477fe6 | 2021-01-02 11:56:10 +0100 | [diff] [blame] | 79 | 'src/numeric_threshold.cpp', |
Szymon Dompke | f763c9e | 2021-03-12 09:19:22 +0100 | [diff] [blame] | 80 | 'src/on_change_threshold.cpp', |
Krzysztof Grobelny | 7f06f61 | 2020-09-24 13:42:10 +0200 | [diff] [blame] | 81 | 'src/persistent_json_storage.cpp', |
Wludzik, Jozef | cb88cfd | 2020-09-28 16:38:57 +0200 | [diff] [blame] | 82 | 'src/report.cpp', |
Wludzik, Jozef | 2f9f9b8 | 2020-10-13 09:07:45 +0200 | [diff] [blame] | 83 | 'src/report_factory.cpp', |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 84 | 'src/report_manager.cpp', |
Krzysztof Grobelny | b564594 | 2020-09-29 11:52:45 +0200 | [diff] [blame] | 85 | 'src/sensor.cpp', |
Krzysztof Grobelny | 7f06f61 | 2020-09-24 13:42:10 +0200 | [diff] [blame] | 86 | 'src/sensor_cache.cpp', |
Wludzik, Jozef | 76833cb | 2020-12-21 14:42:41 +0100 | [diff] [blame] | 87 | 'src/trigger.cpp', |
Wludzik, Jozef | d960e1f | 2021-01-08 09:25:59 +0100 | [diff] [blame] | 88 | 'src/trigger_actions.cpp', |
Wludzik, Jozef | 76833cb | 2020-12-21 14:42:41 +0100 | [diff] [blame] | 89 | 'src/trigger_factory.cpp', |
| 90 | 'src/trigger_manager.cpp', |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 91 | ], |
| 92 | dependencies: [ |
| 93 | boost, |
Krzysztof Grobelny | 73da690 | 2020-09-24 13:42:04 +0200 | [diff] [blame] | 94 | nlohmann_json, |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 95 | sdbusplus, |
| 96 | phosphor_logging, |
| 97 | ], |
| 98 | include_directories: 'src', |
| 99 | install: true, |
| 100 | install_dir: get_option('prefix') / get_option('bindir'), |
| 101 | pie: true, |
| 102 | ) |
| 103 | |
| 104 | configure_file( |
| 105 | input: 'xyz.openbmc_project.Telemetry.service.in', |
| 106 | output: 'xyz.openbmc_project.Telemetry.service', |
| 107 | configuration: { |
| 108 | 'bindir': get_option('prefix') / get_option('bindir'), |
| 109 | }, |
| 110 | install: true, |
| 111 | install_dir: systemd.get_pkgconfig_variable('systemdsystemunitdir'), |
| 112 | ) |
Krzysztof Grobelny | 73da690 | 2020-09-24 13:42:04 +0200 | [diff] [blame] | 113 | |
| 114 | if get_option('buildtest') |
| 115 | subdir('tests') |
| 116 | endif |