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