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