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++17',
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]
34
35proto = custom_target(
36  'metricblob_proto',
37  command: [
38    find_program('protoc', native: true),
39    '--proto_path=@CURRENT_SOURCE_DIR@',
40    '--cpp_out=@OUTDIR@',
41    '@INPUT@'
42  ],
43  output: [
44    'metricblob.pb.cc',
45    'metricblob.pb.h',
46  ],
47  input: 'metricblob.proto')
48proto_h = proto[1]
49
50lib = static_library(
51  'metricsblob',
52  'util.cpp',
53  'handler.cpp',
54  'metric.cpp',
55  proto,
56  include_directories: headers,
57  implicit_include_directories: false,
58  dependencies: deps)
59
60dep = declare_dependency(
61  sources: proto_h,
62  dependencies: deps,
63  include_directories: headers,
64  link_with: lib)
65
66shared_module(
67  'metricsblob',
68  'main.cpp',
69  dependencies: dep,
70  implicit_include_directories: false,
71  install: true,
72  install_dir: get_option('libdir') / 'ipmid-providers')
73
74if not get_option('tests').disabled()
75  subdir('test')
76endif
77