xref: /openbmc/sdbusplus/meson.build (revision 290fa427)
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')
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/exception.cpp',
31    'src/message/native_types.cpp',
32    'src/sdbus.cpp',
33    'src/server/interface.cpp',
34    'src/server/transaction.cpp',
35)
36
37libsdbusplus = library(
38    'sdbusplus',
39    libsdbusplus_src,
40    include_directories: root_inc,
41    dependencies: libsystemd_pkg,
42    version: meson.project_version(),
43    install: true,
44)
45
46boost_compile_args = [
47    '-DBOOST_ASIO_DISABLE_THREADS',
48    '-DBOOST_ALL_NO_LIB',
49    '-DBOOST_SYSTEM_NO_DEPRECATED',
50    '-DBOOST_ERROR_CODE_HEADER_ONLY',
51    '-DBOOST_COROUTINES_NO_DEPRECATION_WARNING',
52]
53
54boost_dep = declare_dependency(
55    dependencies: dependency('boost', required: false),
56    compile_args: boost_compile_args)
57
58sdbusplus_dep = declare_dependency(
59    include_directories: root_inc,
60    link_with: libsdbusplus,
61    dependencies: [ libsystemd_pkg, boost_dep ],
62)
63
64subdir('tools')
65
66if not get_option('examples').disabled()
67  subdir('example')
68endif
69if not get_option('tests').disabled()
70  subdir('test')
71endif
72
73install_subdir(
74    'include/sdbusplus',
75    install_dir: get_option('includedir'),
76    strip_directory: false,
77)
78
79import('pkgconfig').generate(
80    libsdbusplus,
81    name: meson.project_name(),
82    version: meson.project_version(),
83    requires: libsystemd_pkg,
84    extra_cflags: boost_compile_args,
85    description: 'C++ bindings for sdbus',
86)
87