blob: 0f5912bf7a5b7a3ee9eb81632b2dab9d10b22e67 [file] [log] [blame]
Patrick Williamsf254b062023-03-30 15:51:12 -05001project(
Patrick Williams43d840e2025-02-01 08:37:33 -05002 '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 Williamsf254b062023-03-30 15:51:12 -050012)
13
14cpp = meson.get_compiler('cpp')
15add_project_arguments(
Patrick Williams43d840e2025-02-01 08:37:33 -050016 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 Williamsf254b062023-03-30 15:51:12 -050027)
28
Patrick Williamsf254b062023-03-30 15:51:12 -050029
30boost_dep = dependency(
Patrick Williams43d840e2025-02-01 08:37:33 -050031 'boost',
32 modules: ['coroutine'],
33 include_type: 'system',
34 required: false,
Patrick Williamsf254b062023-03-30 15:51:12 -050035)
Konstantin Aladyshevdcd30372024-04-04 13:14:43 +030036
37if not boost_dep.found()
Patrick Williams43d840e2025-02-01 08:37:33 -050038 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 Aladyshevdcd30372024-04-04 13:14:43 +030054endif
55
Patrick Williamsf254b062023-03-30 15:51:12 -050056i2c_dep = cpp.find_library('i2c')
Patrick Williams0afdd8c2023-12-07 14:31:27 -060057nlohmann_json_dep = dependency('nlohmann_json', include_type: 'system')
Patrick Williamsf254b062023-03-30 15:51:12 -050058phosphor_logging_dep = dependency('phosphor-logging')
59sdbusplus_dep = dependency('sdbusplus')
60systemd_dep = dependency('systemd')
61
62executable(
Patrick Williams43d840e2025-02-01 08:37:33 -050063 '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 Williamsf254b062023-03-30 15:51:12 -050074)
75
76install_data(
Patrick Williams43d840e2025-02-01 08:37:33 -050077 'ipmb.service',
78 install_dir: systemd_dep.get_variable('systemdsystemunitdir'),
Patrick Williamsf254b062023-03-30 15:51:12 -050079)
80
81install_data(
Patrick Williams43d840e2025-02-01 08:37:33 -050082 'ipmb-channels.json',
83 install_dir: get_option('datadir') / 'ipmbbridge',
Patrick Williamsf254b062023-03-30 15:51:12 -050084)