xref: /openbmc/ipmbbridge/meson.build (revision 43d840e7efaaf313755aa867b7600f8777321c47)
1project(
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    ],
12)
13
14cpp = meson.get_compiler('cpp')
15add_project_arguments(
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',
27)
28
29
30boost_dep = dependency(
31    'boost',
32    modules: ['coroutine'],
33    include_type: 'system',
34    required: false,
35)
36
37if not boost_dep.found()
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    ]
54endif
55
56i2c_dep = cpp.find_library('i2c')
57nlohmann_json_dep = dependency('nlohmann_json', include_type: 'system')
58phosphor_logging_dep = dependency('phosphor-logging')
59sdbusplus_dep = dependency('sdbusplus')
60systemd_dep = dependency('systemd')
61
62executable(
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,
74)
75
76install_data(
77    'ipmb.service',
78    install_dir: systemd_dep.get_variable('systemdsystemunitdir'),
79)
80
81install_data(
82    'ipmb-channels.json',
83    install_dir: get_option('datadir') / 'ipmbbridge',
84)
85