blob: 1fc0b0c812b397151a0c121ee155bfd0adb84611 [file] [log] [blame]
Brandon Kimdab96f12021-02-18 11:21:37 -08001# 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
Sui Chen03eba282021-02-11 11:35:56 -080015project(
16 'metrics-ipmi-blobs',
17 'cpp',
18 version: '0.1',
19 default_options: [
William A. Kennington III3f43b7e2021-02-16 16:54:40 -080020 'warning_level=3',
21 'werror=true',
Sui Chen03eba282021-02-11 11:35:56 -080022 'cpp_std=c++17',
William A. Kennington III3f43b7e2021-02-16 16:54:40 -080023 'tests=' + (meson.is_subproject() ? 'disabled' : 'auto'),
Sui Chen03eba282021-02-11 11:35:56 -080024 ],
25)
26
William A. Kennington III3f43b7e2021-02-16 16:54:40 -080027headers = include_directories('.')
Sui Chen03eba282021-02-11 11:35:56 -080028
William A. Kennington III3f43b7e2021-02-16 16:54:40 -080029deps = [
30 dependency('phosphor-logging'),
31 dependency('phosphor-ipmi-blobs'),
32 dependency('protobuf'),
33]
Sui Chen03eba282021-02-11 11:35:56 -080034
William A. Kennington IIIb056df62021-03-23 21:19:18 -070035proto = 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
William A. Kennington III3f43b7e2021-02-16 16:54:40 -080050lib = static_library(
51 'metricsblob',
52 'util.cpp',
Sui Chen03eba282021-02-11 11:35:56 -080053 'handler.cpp',
54 'metric.cpp',
William A. Kennington IIIb056df62021-03-23 21:19:18 -070055 proto,
William A. Kennington III3f43b7e2021-02-16 16:54:40 -080056 include_directories: headers,
57 implicit_include_directories: false,
58 dependencies: deps)
Sui Chen03eba282021-02-11 11:35:56 -080059
William A. Kennington III3f43b7e2021-02-16 16:54:40 -080060dep = declare_dependency(
William A. Kennington IIIb056df62021-03-23 21:19:18 -070061 sources: proto_h,
William A. Kennington III3f43b7e2021-02-16 16:54:40 -080062 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