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