blob: 22e0cc3420a0afe3bbe64ebfa80610fba4046d12 [file] [log] [blame]
project(
'Telemetry',
'cpp',
meson_version: '>=0.54.3',
default_options: [
'buildtype=debugoptimized',
'cpp_std=c++17',
# TODO: Without RTTI telemetry does not build using Boost 1.74.0
# https://github.com/chriskohlhoff/asio/issues/533
#'cpp_rtti=false',
'warning_level=3',
'werror=true',
'b_lto=true',
],
license: 'Apache-2.0',
)
cpp = meson.get_compiler('cpp')
add_project_arguments(
cpp.get_supported_arguments([
'-DBOOST_ASIO_DISABLE_THREADS',
'-DBOOST_ALL_NO_LIB',
'-DBOOST_SYSTEM_NO_DEPRECATED',
'-DBOOST_ASIO_NO_DEPRECATED',
'-DBOOST_NO_RTTI',
'-DBOOST_NO_TYPEID',
'-Wno-unused-parameter',
]),
language: 'cpp'
)
boost = dependency(
'boost',
version: '>=1.74.0',
required: false,
modules: ['coroutine'])
if not boost.found()
subproject('boost', required: false)
boost = declare_dependency(include_directories: 'subprojects/boost_1_74_0')
endif
phosphor_logging = dependency('phosphor-logging', required: false)
if not phosphor_logging.found()
subproject('phosphor-logging', required: false)
phosphor_logging = declare_dependency(
include_directories: 'subprojects/phosphor-logging'
)
endif
sdbusplus = dependency('sdbusplus',required : false)
if not sdbusplus.found()
sdbusplus_proj = subproject('sdbusplus', required: true)
sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep')
endif
systemd = dependency('systemd')
if cpp.has_header('nlohmann/json.hpp')
nlohmann_json = declare_dependency()
else
subproject('nlohmann', required: false)
nlohmann_json = declare_dependency(
include_directories: [
'subprojects/nlohmann/single_include',
'subprojects/nlohmann/single_include/nlohmann',
]
)
endif
executable(
'telemetry',
[
'src/main.cpp',
'src/metric.cpp',
'src/persistent_json_storage.cpp',
'src/report.cpp',
'src/report_factory.cpp',
'src/report_manager.cpp',
'src/sensor.cpp',
'src/sensor_cache.cpp',
],
dependencies: [
boost,
nlohmann_json,
sdbusplus,
phosphor_logging,
],
include_directories: 'src',
install: true,
install_dir: get_option('prefix') / get_option('bindir'),
pie: true,
)
configure_file(
input: 'xyz.openbmc_project.Telemetry.service.in',
output: 'xyz.openbmc_project.Telemetry.service',
configuration: {
'bindir': get_option('prefix') / get_option('bindir'),
},
install: true,
install_dir: systemd.get_pkgconfig_variable('systemdsystemunitdir'),
)
if get_option('buildtest')
subdir('tests')
endif