Patrick Williams | f254b06 | 2023-03-30 15:51:12 -0500 | [diff] [blame] | 1 | project( |
| 2 | 'ipmbbridge', |
| 3 | 'cpp', |
| 4 | version: '0.1', |
Patrick Williams | e6b07fa | 2023-07-12 11:15:47 -0500 | [diff] [blame] | 5 | meson_version: '>=1.1.1', |
Patrick Williams | f254b06 | 2023-03-30 15:51:12 -0500 | [diff] [blame] | 6 | default_options: [ |
| 7 | 'warning_level=3', |
| 8 | 'werror=true', |
Patrick Williams | e6b07fa | 2023-07-12 11:15:47 -0500 | [diff] [blame] | 9 | 'cpp_std=c++23', |
Konstantin Aladyshev | dcd3037 | 2024-04-04 13:14:43 +0300 | [diff] [blame] | 10 | 'b_lto=true', |
Patrick Williams | f254b06 | 2023-03-30 15:51:12 -0500 | [diff] [blame] | 11 | ], |
| 12 | ) |
| 13 | |
| 14 | cpp = meson.get_compiler('cpp') |
| 15 | add_project_arguments( |
| 16 | cpp.get_supported_arguments([ |
| 17 | '-DBOOST_ERROR_CODE_HEADER_ONLY', |
| 18 | '-DBOOST_SYSTEM_NO_DEPRECATED', |
| 19 | '-DBOOST_ALL_NO_LIB', |
| 20 | '-DBOOST_NO_RTTI', |
| 21 | '-DBOOST_NO_TYPEID', |
| 22 | '-DBOOST_ASIO_DISABLE_THREADS', |
| 23 | ]), |
| 24 | language: 'cpp', |
| 25 | ) |
| 26 | |
Patrick Williams | f254b06 | 2023-03-30 15:51:12 -0500 | [diff] [blame] | 27 | |
| 28 | boost_dep = dependency( |
| 29 | 'boost', |
| 30 | modules: ['coroutine'], |
| 31 | include_type: 'system', |
Konstantin Aladyshev | dcd3037 | 2024-04-04 13:14:43 +0300 | [diff] [blame] | 32 | required: false, |
Patrick Williams | f254b06 | 2023-03-30 15:51:12 -0500 | [diff] [blame] | 33 | ) |
Konstantin Aladyshev | dcd3037 | 2024-04-04 13:14:43 +0300 | [diff] [blame] | 34 | |
| 35 | if not boost_dep.found() |
| 36 | cmake = import('cmake') |
| 37 | opt = cmake.subproject_options() |
| 38 | opt.add_cmake_defines({ |
| 39 | 'BOOST_INCLUDE_LIBRARIES': 'asio;callable_traits;context;coroutine', |
| 40 | }) |
| 41 | boost_cmake = cmake.subproject('boost', required: true, options: opt) |
| 42 | boost_asio = boost_cmake.dependency('boost_asio').as_system() |
| 43 | boost_callable_traits = boost_cmake.dependency('boost_callable_traits').as_system() |
| 44 | boost_context = boost_cmake.dependency('boost_context').as_system() |
| 45 | boost_coroutine = boost_cmake.dependency('boost_coroutine').as_system() |
| 46 | boost_dep = [boost_asio, boost_callable_traits, boost_context, boost_coroutine] |
| 47 | endif |
| 48 | |
Patrick Williams | f254b06 | 2023-03-30 15:51:12 -0500 | [diff] [blame] | 49 | i2c_dep = cpp.find_library('i2c') |
Patrick Williams | 0afdd8c | 2023-12-07 14:31:27 -0600 | [diff] [blame] | 50 | nlohmann_json_dep = dependency('nlohmann_json', include_type: 'system') |
Patrick Williams | f254b06 | 2023-03-30 15:51:12 -0500 | [diff] [blame] | 51 | phosphor_logging_dep = dependency('phosphor-logging') |
| 52 | sdbusplus_dep = dependency('sdbusplus') |
| 53 | systemd_dep = dependency('systemd') |
| 54 | |
| 55 | executable( |
Jorge Cisneros | 315002a | 2023-04-07 11:43:45 -0500 | [diff] [blame] | 56 | 'ipmbbridged', |
Patrick Williams | f254b06 | 2023-03-30 15:51:12 -0500 | [diff] [blame] | 57 | 'ipmbbridged.cpp', |
| 58 | 'ipmbutils.cpp', |
| 59 | dependencies: [ |
| 60 | boost_dep, |
| 61 | i2c_dep, |
| 62 | nlohmann_json_dep, |
| 63 | phosphor_logging_dep, |
| 64 | sdbusplus_dep, |
| 65 | ], |
| 66 | install: true, |
| 67 | ) |
| 68 | |
| 69 | install_data( |
| 70 | 'ipmb.service', |
Patrick Williams | 3e9bd93 | 2023-04-12 08:01:21 -0500 | [diff] [blame] | 71 | install_dir: systemd_dep.get_variable('systemdsystemunitdir'), |
Patrick Williams | f254b06 | 2023-03-30 15:51:12 -0500 | [diff] [blame] | 72 | ) |
| 73 | |
| 74 | install_data( |
| 75 | 'ipmb-channels.json', |
| 76 | install_dir: get_option('datadir') / 'ipmbbridge', |
| 77 | ) |