1# Copyright 2021 Google LLC
2#
3# Licensed under the Apache License, Version 2.0 (the "License");
4# you may not use this file except in compliance with the License.
5# You may obtain a copy of the License at
6#
7#      http://www.apache.org/licenses/LICENSE-2.0
8#
9# Unless required by applicable law or agreed to in writing, software
10# distributed under the License is distributed on an "AS IS" BASIS,
11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
12# See the License for the specific language governing permissions and
13# limitations under the License.
14
15project(
16  'metrics-ipmi-blobs',
17  'cpp',
18  version: '0.1',
19  default_options: [
20    'warning_level=3',
21    'werror=true',
22    'cpp_std=c++23',
23    'tests=' + (meson.is_subproject() ? 'disabled' : 'auto'),
24  ],
25)
26
27headers = include_directories('.')
28
29deps = [
30  dependency('phosphor-logging'),
31  dependency('phosphor-ipmi-blobs'),
32  dependency('protobuf'),
33  dependency('sdbusplus'),
34]
35
36proto = custom_target(
37  'metricblob_proto',
38  command: [
39    find_program('protoc', native: true),
40    '--proto_path=@CURRENT_SOURCE_DIR@',
41    '--cpp_out=@OUTDIR@',
42    '@INPUT@'
43  ],
44  output: [
45    'metricblob.pb.cc',
46    'metricblob.pb.h',
47  ],
48  input: 'metricblob.proto')
49proto_h = proto[1]
50
51lib = static_library(
52  'metricsblob',
53  'util.cpp',
54  'handler.cpp',
55  'metric.cpp',
56  proto,
57  include_directories: headers,
58  implicit_include_directories: false,
59  dependencies: deps)
60
61dep = declare_dependency(
62  sources: proto_h,
63  dependencies: deps,
64  include_directories: headers,
65  link_with: lib)
66
67shared_module(
68  'metricsblob',
69  'main.cpp',
70  dependencies: dep,
71  implicit_include_directories: false,
72  install: true,
73  install_dir: get_option('libdir') / 'blob-ipmid')
74
75if not get_option('tests').disabled()
76  subdir('test')
77endif
78