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