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