Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 1 | project( |
| 2 | 'Telemetry', |
| 3 | 'cpp', |
| 4 | meson_version: '>=0.55.0', |
| 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', |
| 27 | '-Wno-unused-parameter', |
| 28 | ]), |
| 29 | language: 'cpp' |
| 30 | ) |
| 31 | |
Wludzik, Jozef | a4bf740 | 2020-10-21 15:08:58 +0200 | [diff] [blame^] | 32 | boost = dependency('boost', version: '>=1.74.0', required: false) |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 33 | if not boost.found() |
| 34 | subproject('boost', required: false) |
Wludzik, Jozef | a4bf740 | 2020-10-21 15:08:58 +0200 | [diff] [blame^] | 35 | boost = declare_dependency(include_directories: 'subprojects/boost_1_74_0') |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 36 | endif |
| 37 | |
| 38 | phosphor_logging = dependency('phosphor-logging', required: false) |
| 39 | if not phosphor_logging.found() |
| 40 | subproject('phosphor-logging', required: false) |
| 41 | phosphor_logging = declare_dependency( |
| 42 | include_directories: 'subprojects/phosphor-logging' |
| 43 | ) |
| 44 | endif |
| 45 | |
| 46 | sdbusplus = dependency('sdbusplus',required : false) |
| 47 | if not sdbusplus.found() |
| 48 | sdbusplus_proj = subproject('sdbusplus', required: true) |
| 49 | sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep') |
| 50 | endif |
| 51 | |
| 52 | systemd = dependency('systemd') |
| 53 | |
Krzysztof Grobelny | 73da690 | 2020-09-24 13:42:04 +0200 | [diff] [blame] | 54 | if cpp.has_header('nlohmann/json.hpp') |
| 55 | nlohmann_json = declare_dependency() |
| 56 | else |
| 57 | subproject('nlohmann', required: false) |
| 58 | nlohmann_json = declare_dependency( |
| 59 | include_directories: [ |
| 60 | 'subprojects/nlohmann/single_include', |
| 61 | 'subprojects/nlohmann/single_include/nlohmann', |
| 62 | ] |
| 63 | ) |
| 64 | endif |
| 65 | |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 66 | executable( |
| 67 | 'telemetry', |
| 68 | [ |
| 69 | 'src/main.cpp', |
Wludzik, Jozef | cb88cfd | 2020-09-28 16:38:57 +0200 | [diff] [blame] | 70 | 'src/report.cpp', |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 71 | 'src/report_manager.cpp', |
Krzysztof Grobelny | 73da690 | 2020-09-24 13:42:04 +0200 | [diff] [blame] | 72 | 'src/persistent_json_storage.cpp', |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 73 | ], |
| 74 | dependencies: [ |
| 75 | boost, |
Krzysztof Grobelny | 73da690 | 2020-09-24 13:42:04 +0200 | [diff] [blame] | 76 | nlohmann_json, |
Krzysztof Grobelny | 64b75a5 | 2020-09-18 10:17:16 +0200 | [diff] [blame] | 77 | sdbusplus, |
| 78 | phosphor_logging, |
| 79 | ], |
| 80 | include_directories: 'src', |
| 81 | install: true, |
| 82 | install_dir: get_option('prefix') / get_option('bindir'), |
| 83 | pie: true, |
| 84 | ) |
| 85 | |
| 86 | configure_file( |
| 87 | input: 'xyz.openbmc_project.Telemetry.service.in', |
| 88 | output: 'xyz.openbmc_project.Telemetry.service', |
| 89 | configuration: { |
| 90 | 'bindir': get_option('prefix') / get_option('bindir'), |
| 91 | }, |
| 92 | install: true, |
| 93 | install_dir: systemd.get_pkgconfig_variable('systemdsystemunitdir'), |
| 94 | ) |
Krzysztof Grobelny | 73da690 | 2020-09-24 13:42:04 +0200 | [diff] [blame] | 95 | |
| 96 | if get_option('buildtest') |
| 97 | subdir('tests') |
| 98 | endif |