| # Copyright 2025 Google LLC |
| # |
| # Licensed under the Apache License, Version 2.0 (the "License"); |
| # you may not use this file except in compliance with the License. |
| # You may obtain a copy of the License at |
| # |
| # http://www.apache.org/licenses/LICENSE-2.0 |
| # |
| # Unless required by applicable law or agreed to in writing, software |
| # distributed under the License is distributed on an "AS IS" BASIS, |
| # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| # See the License for the specific language governing permissions and |
| # limitations under the License. |
| |
| project( |
| 'health-scan', |
| 'cpp', |
| default_options: [ |
| 'warning_level=3', |
| 'werror=true', |
| 'cpp_std=c++20' |
| ], |
| license: 'Apache-2.0', |
| version: '0.1', |
| meson_version: '>=0.58.0', |
| ) |
| |
| boost_args = [ |
| '-DBOOST_SYSTEM_NO_DEPRECATED', |
| '-DBOOST_ERROR_CODE_HEADER_ONLY', |
| '-DBOOST_NO_RTTI', |
| '-DBOOST_NO_TYPEID', |
| '-DBOOST_ALL_NO_LIB', |
| '-DBOOST_ALLOW_DEPRECATED_HEADERS' |
| ] |
| build_tests = get_option('tests') |
| cpp = meson.get_compiler('cpp') |
| boost = dependency('boost', required: false) |
| if not boost.found() |
| subproject('boost', required: false) |
| boost = declare_dependency( |
| include_directories: 'subprojects/boost_1_71_0', |
| ) |
| boost = boost.as_system('system') |
| endif |
| i2c = cpp.find_library('i2c') |
| |
| nlohmann_json_dep = dependency('nlohmann_json', include_type: 'system') |
| |
| protoc = find_program('protoc') |
| protobuf = dependency('protobuf', required : true) |
| subdir('machines') |
| |
| subdir('src') |
| |
| if not build_tests.disabled() |
| test_boost_args = boost_args + ['-DBOOST_ASIO_DISABLE_THREADS'] |
| gtest = dependency('gtest', main: true, disabler: true, required: false) |
| gmock = dependency('gmock', disabler: true, required: false) |
| if not (gtest.found() and gmock.found()) and build_tests.enabled() |
| cmake = import('cmake') |
| gtest_subproject = cmake.subproject('gtest') |
| cm_gtest = gtest_subproject.dependency('gtest') |
| cm_gtest_main = gtest_subproject.dependency('gtest_main') |
| gtest = declare_dependency(dependencies: [cm_gtest, cm_gtest_main, threads]) |
| gmock = gtest_subproject.dependency('gmock') |
| |
| endif |
| |
| endif |