xref: /openbmc/sdbusplus/meson.build (revision 43fcd1ce)
1project('sdbusplus', 'cpp', 'c',
2    default_options: [
3      'buildtype=debugoptimized',
4      'cpp_std=c++23',
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: '>=1.1.1',
12)
13
14libsystemd_pkg = dependency('libsystemd')
15
16python = import('python')
17python_bin = python.find_installation('python3', modules:['inflection', 'yaml', 'mako'])
18
19if not python_bin.found()
20  error('No valid python3 installation found')
21endif
22
23
24root_inc = include_directories('include')
25
26libsdbusplus_src = files(
27    'src/async/context.cpp',
28    'src/async/match.cpp',
29    'src/bus.cpp',
30    'src/bus/match.cpp',
31    'src/event.cpp',
32    'src/exception.cpp',
33    'src/message/native_types.cpp',
34    'src/sdbus.cpp',
35    'src/server/interface.cpp',
36    'src/server/transaction.cpp',
37)
38
39libsdbusplus = library(
40    'sdbusplus',
41    libsdbusplus_src,
42    include_directories: root_inc,
43    dependencies: libsystemd_pkg,
44    version: meson.project_version(),
45    install: true,
46)
47
48boost_compile_args = [
49    '-DBOOST_ASIO_DISABLE_THREADS',
50    '-DBOOST_ALL_NO_LIB',
51    '-DBOOST_SYSTEM_NO_DEPRECATED',
52    '-DBOOST_ERROR_CODE_HEADER_ONLY',
53    '-DBOOST_COROUTINES_NO_DEPRECATION_WARNING',
54]
55
56boost_dep = declare_dependency(
57    dependencies: dependency('boost', required: false),
58    compile_args: boost_compile_args)
59
60sdbusplus_dep = declare_dependency(
61    include_directories: root_inc,
62    link_with: libsdbusplus,
63    dependencies: [ libsystemd_pkg, boost_dep ],
64)
65
66subdir('tools')
67
68if not get_option('examples').disabled()
69  subdir('example')
70endif
71if not get_option('tests').disabled()
72  subdir('test')
73endif
74
75install_subdir(
76    'include/sdbusplus',
77    install_dir: get_option('includedir'),
78    strip_directory: false,
79)
80
81import('pkgconfig').generate(
82    libsdbusplus,
83    name: meson.project_name(),
84    version: meson.project_version(),
85    requires: libsystemd_pkg,
86    extra_cflags: boost_compile_args,
87    description: 'C++ bindings for sdbus',
88)
89