blob: 146ec726f125158c241149eefde444e89730e0b9 [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',
Willy Tu382d6282021-10-21 13:31:14 -070022 'cpp_std=c++20',
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'),
Michael Shenb63d6312021-04-26 13:30:57 +080033 dependency('sdbusplus'),
William A. Kennington III3f43b7e2021-02-16 16:54:40 -080034]
Sui Chen03eba282021-02-11 11:35:56 -080035
William A. Kennington IIIb056df62021-03-23 21:19:18 -070036proto = 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
William A. Kennington III3f43b7e2021-02-16 16:54:40 -080051lib = static_library(
52 'metricsblob',
53 'util.cpp',
Sui Chen03eba282021-02-11 11:35:56 -080054 'handler.cpp',
55 'metric.cpp',
William A. Kennington IIIb056df62021-03-23 21:19:18 -070056 proto,
William A. Kennington III3f43b7e2021-02-16 16:54:40 -080057 include_directories: headers,
58 implicit_include_directories: false,
59 dependencies: deps)
Sui Chen03eba282021-02-11 11:35:56 -080060
William A. Kennington III3f43b7e2021-02-16 16:54:40 -080061dep = declare_dependency(
William A. Kennington IIIb056df62021-03-23 21:19:18 -070062 sources: proto_h,
William A. Kennington III3f43b7e2021-02-16 16:54:40 -080063 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,
William A. Kennington III548f3ad2021-06-17 20:07:47 -070073 install_dir: get_option('libdir') / 'blob-ipmid')
William A. Kennington III3f43b7e2021-02-16 16:54:40 -080074
75if not get_option('tests').disabled()
76 subdir('test')
77endif