blob: 1c4e4bf88a549519d8b019d9cc0b6209115deea2 [file] [log] [blame]
Patrick Williamsf254b062023-03-30 15:51:12 -05001project(
2 'ipmbbridge',
3 'cpp',
4 version: '0.1',
Patrick Williamse6b07fa2023-07-12 11:15:47 -05005 meson_version: '>=1.1.1',
Patrick Williamsf254b062023-03-30 15:51:12 -05006 default_options: [
7 'warning_level=3',
8 'werror=true',
Patrick Williamse6b07fa2023-07-12 11:15:47 -05009 'cpp_std=c++23',
Konstantin Aladyshevdcd30372024-04-04 13:14:43 +030010 'b_lto=true',
Patrick Williamsf254b062023-03-30 15:51:12 -050011 ],
12)
13
14cpp = meson.get_compiler('cpp')
15add_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 Williamsf254b062023-03-30 15:51:12 -050027
28boost_dep = dependency(
29 'boost',
30 modules: ['coroutine'],
31 include_type: 'system',
Konstantin Aladyshevdcd30372024-04-04 13:14:43 +030032 required: false,
Patrick Williamsf254b062023-03-30 15:51:12 -050033)
Konstantin Aladyshevdcd30372024-04-04 13:14:43 +030034
35if 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]
47endif
48
Patrick Williamsf254b062023-03-30 15:51:12 -050049i2c_dep = cpp.find_library('i2c')
Patrick Williams0afdd8c2023-12-07 14:31:27 -060050nlohmann_json_dep = dependency('nlohmann_json', include_type: 'system')
Patrick Williamsf254b062023-03-30 15:51:12 -050051phosphor_logging_dep = dependency('phosphor-logging')
52sdbusplus_dep = dependency('sdbusplus')
53systemd_dep = dependency('systemd')
54
55executable(
Jorge Cisneros315002a2023-04-07 11:43:45 -050056 'ipmbbridged',
Patrick Williamsf254b062023-03-30 15:51:12 -050057 '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
69install_data(
70 'ipmb.service',
Patrick Williams3e9bd932023-04-12 08:01:21 -050071 install_dir: systemd_dep.get_variable('systemdsystemunitdir'),
Patrick Williamsf254b062023-03-30 15:51:12 -050072)
73
74install_data(
75 'ipmb-channels.json',
76 install_dir: get_option('datadir') / 'ipmbbridge',
77)