Brandon Kim | dab96f1 | 2021-02-18 11:21:37 -0800 | [diff] [blame] | 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 | |
Sui Chen | 03eba28 | 2021-02-11 11:35:56 -0800 | [diff] [blame] | 15 | project( |
| 16 | 'metrics-ipmi-blobs', |
| 17 | 'cpp', |
| 18 | version: '0.1', |
| 19 | default_options: [ |
William A. Kennington III | 3f43b7e | 2021-02-16 16:54:40 -0800 | [diff] [blame] | 20 | 'warning_level=3', |
| 21 | 'werror=true', |
Willy Tu | 382d628 | 2021-10-21 13:31:14 -0700 | [diff] [blame] | 22 | 'cpp_std=c++20', |
William A. Kennington III | 3f43b7e | 2021-02-16 16:54:40 -0800 | [diff] [blame] | 23 | 'tests=' + (meson.is_subproject() ? 'disabled' : 'auto'), |
Sui Chen | 03eba28 | 2021-02-11 11:35:56 -0800 | [diff] [blame] | 24 | ], |
| 25 | ) |
| 26 | |
William A. Kennington III | 3f43b7e | 2021-02-16 16:54:40 -0800 | [diff] [blame] | 27 | headers = include_directories('.') |
Sui Chen | 03eba28 | 2021-02-11 11:35:56 -0800 | [diff] [blame] | 28 | |
William A. Kennington III | 3f43b7e | 2021-02-16 16:54:40 -0800 | [diff] [blame] | 29 | deps = [ |
| 30 | dependency('phosphor-logging'), |
| 31 | dependency('phosphor-ipmi-blobs'), |
| 32 | dependency('protobuf'), |
Michael Shen | b63d631 | 2021-04-26 13:30:57 +0800 | [diff] [blame] | 33 | dependency('sdbusplus'), |
William A. Kennington III | 3f43b7e | 2021-02-16 16:54:40 -0800 | [diff] [blame] | 34 | ] |
Sui Chen | 03eba28 | 2021-02-11 11:35:56 -0800 | [diff] [blame] | 35 | |
William A. Kennington III | b056df6 | 2021-03-23 21:19:18 -0700 | [diff] [blame] | 36 | proto = 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') |
| 49 | proto_h = proto[1] |
| 50 | |
William A. Kennington III | 3f43b7e | 2021-02-16 16:54:40 -0800 | [diff] [blame] | 51 | lib = static_library( |
| 52 | 'metricsblob', |
| 53 | 'util.cpp', |
Sui Chen | 03eba28 | 2021-02-11 11:35:56 -0800 | [diff] [blame] | 54 | 'handler.cpp', |
| 55 | 'metric.cpp', |
William A. Kennington III | b056df6 | 2021-03-23 21:19:18 -0700 | [diff] [blame] | 56 | proto, |
William A. Kennington III | 3f43b7e | 2021-02-16 16:54:40 -0800 | [diff] [blame] | 57 | include_directories: headers, |
| 58 | implicit_include_directories: false, |
| 59 | dependencies: deps) |
Sui Chen | 03eba28 | 2021-02-11 11:35:56 -0800 | [diff] [blame] | 60 | |
William A. Kennington III | 3f43b7e | 2021-02-16 16:54:40 -0800 | [diff] [blame] | 61 | dep = declare_dependency( |
William A. Kennington III | b056df6 | 2021-03-23 21:19:18 -0700 | [diff] [blame] | 62 | sources: proto_h, |
William A. Kennington III | 3f43b7e | 2021-02-16 16:54:40 -0800 | [diff] [blame] | 63 | dependencies: deps, |
| 64 | include_directories: headers, |
| 65 | link_with: lib) |
| 66 | |
| 67 | shared_module( |
| 68 | 'metricsblob', |
| 69 | 'main.cpp', |
| 70 | dependencies: dep, |
| 71 | implicit_include_directories: false, |
| 72 | install: true, |
William A. Kennington III | 548f3ad | 2021-06-17 20:07:47 -0700 | [diff] [blame] | 73 | install_dir: get_option('libdir') / 'blob-ipmid') |
William A. Kennington III | 3f43b7e | 2021-02-16 16:54:40 -0800 | [diff] [blame] | 74 | |
| 75 | if not get_option('tests').disabled() |
| 76 | subdir('test') |
| 77 | endif |