xref: /openbmc/sdbusplus/meson.build (revision 08dc23c1)
1project('sdbusplus', 'cpp', 'c',
2    default_options: [
3      'buildtype=debugoptimized',
4      'cpp_std=c++20',
5      'werror=true',
6      'tests=' + (meson.is_subproject() ? 'disabled' : 'auto'),
7      'examples=' + (meson.is_subproject() ? 'disabled' : 'auto'),
8    ],
9    version: '1.0.0',
10    meson_version: '>=0.57.0',
11)
12
13libsystemd_pkg = dependency('libsystemd')
14root_inc = include_directories('include')
15
16libsdbusplus_src = files(
17    'src/exception.cpp',
18    'src/bus.cpp',
19    'src/message/native_types.cpp',
20    'src/sdbus.cpp',
21    'src/server/interface.cpp',
22    'src/server/transaction.cpp',
23)
24
25libsdbusplus = library(
26    'sdbusplus',
27    libsdbusplus_src,
28    include_directories: root_inc,
29    dependencies: libsystemd_pkg,
30    version: meson.project_version(),
31    install: true,
32)
33
34boost_compile_args = [
35    '-DBOOST_ASIO_DISABLE_THREADS',
36    '-DBOOST_ALL_NO_LIB',
37    '-DBOOST_SYSTEM_NO_DEPRECATED',
38    '-DBOOST_ERROR_CODE_HEADER_ONLY',
39    '-DBOOST_COROUTINES_NO_DEPRECATION_WARNING',
40]
41
42boost_dep = declare_dependency(
43    dependencies: dependency('boost', required: false),
44    compile_args: boost_compile_args)
45
46sdbusplus_dep = declare_dependency(
47    include_directories: root_inc,
48    link_with: libsdbusplus,
49    dependencies: [ libsystemd_pkg, boost_dep ],
50)
51
52subdir('tools')
53
54if not get_option('examples').disabled()
55  subdir('example')
56endif
57if not get_option('tests').disabled()
58  subdir('test')
59endif
60
61install_subdir(
62    'include/sdbusplus',
63    install_dir: get_option('includedir'),
64    strip_directory: false,
65)
66
67import('pkgconfig').generate(
68    libsdbusplus,
69    name: meson.project_name(),
70    version: meson.project_version(),
71    requires: libsystemd_pkg,
72    extra_cflags: boost_compile_args,
73    description: 'C++ bindings for sdbus',
74)
75