blob: f373ef7b52831df24ceb664d1e05d74586335eab [file] [log] [blame]
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +02001project(
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
16cpp = meson.get_compiler('cpp')
17add_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
30boost = dependency('boost', version: '>=1.73.0', required: false)
31if not boost.found()
32 subproject('boost', required: false)
33 boost = declare_dependency(include_directories: 'subprojects/boost_1_73_0')
34endif
35
36phosphor_logging = dependency('phosphor-logging', required: false)
37if not phosphor_logging.found()
38 subproject('phosphor-logging', required: false)
39 phosphor_logging = declare_dependency(
40 include_directories: 'subprojects/phosphor-logging'
41 )
42endif
43
44sdbusplus = dependency('sdbusplus',required : false)
45if not sdbusplus.found()
46 sdbusplus_proj = subproject('sdbusplus', required: true)
47 sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep')
48endif
49
50systemd = dependency('systemd')
51
Krzysztof Grobelny73da6902020-09-24 13:42:04 +020052if cpp.has_header('nlohmann/json.hpp')
53 nlohmann_json = declare_dependency()
54else
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 )
62endif
63
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020064executable(
65 'telemetry',
66 [
67 'src/main.cpp',
Wludzik, Jozefcb88cfd2020-09-28 16:38:57 +020068 'src/report.cpp',
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020069 'src/report_manager.cpp',
Krzysztof Grobelny73da6902020-09-24 13:42:04 +020070 'src/persistent_json_storage.cpp',
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020071 ],
72 dependencies: [
73 boost,
Krzysztof Grobelny73da6902020-09-24 13:42:04 +020074 nlohmann_json,
Krzysztof Grobelny64b75a52020-09-18 10:17:16 +020075 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
84configure_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 Grobelny73da6902020-09-24 13:42:04 +020093
94if get_option('buildtest')
95 subdir('tests')
96endif