1project( 2 'sdbusplus', 3 'cpp', 4 'c', 5 default_options: [ 6 'buildtype=debugoptimized', 7 'cpp_std=c++23', 8 'warning_level=3', 9 'werror=true', 10 'tests=' + (meson.is_subproject() ? 'disabled' : 'auto'), 11 'examples=' + (meson.is_subproject() ? 'disabled' : 'auto'), 12 ], 13 version: '1.0.0', 14 meson_version: '>=1.1.1', 15) 16cxx = meson.get_compiler('cpp') 17if (cxx.get_id() == 'clang') 18 add_project_arguments(['-Wno-c++26-extensions'], language: 'cpp') 19endif 20 21libsystemd_pkg = dependency('libsystemd') 22nlohmann_json_dep = dependency('nlohmann_json', include_type: 'system') 23 24python = import('python') 25python_bin = python.find_installation( 26 'python3', 27 modules: ['inflection', 'yaml', 'mako'], 28) 29 30if not python_bin.found() 31 error('No valid python3 installation found') 32endif 33 34root_inc = include_directories('include') 35 36libsdbusplus_src = files( 37 'src/async/context.cpp', 38 'src/async/fdio.cpp', 39 'src/async/match.cpp', 40 'src/bus.cpp', 41 'src/bus/match.cpp', 42 'src/event.cpp', 43 'src/exception.cpp', 44 'src/message/native_types.cpp', 45 'src/sdbus.cpp', 46 'src/server/interface.cpp', 47 'src/server/transaction.cpp', 48) 49 50libsdbusplus = library( 51 'sdbusplus', 52 libsdbusplus_src, 53 include_directories: root_inc, 54 dependencies: [libsystemd_pkg, nlohmann_json_dep], 55 version: meson.project_version(), 56 install: true, 57) 58 59boost_compile_args = [ 60 '-DBOOST_ASIO_DISABLE_THREADS', 61 '-DBOOST_ALL_NO_LIB', 62 '-DBOOST_SYSTEM_NO_DEPRECATED', 63 '-DBOOST_ERROR_CODE_HEADER_ONLY', 64 '-DBOOST_COROUTINES_NO_DEPRECATION_WARNING', 65] 66 67boost_dep = declare_dependency( 68 dependencies: dependency('boost', required: false), 69 compile_args: boost_compile_args, 70) 71 72sdbusplus_dep = declare_dependency( 73 include_directories: root_inc, 74 link_with: libsdbusplus, 75 dependencies: [boost_dep, libsystemd_pkg, nlohmann_json_dep], 76) 77 78should_generate_cpp = true 79should_generate_markdown = false 80should_generate_registry = false 81 82subdir('tools') 83 84if get_option('examples').allowed() 85 subdir('example') 86endif 87if get_option('tests').allowed() 88 subdir('test') 89endif 90 91install_subdir( 92 'include/sdbusplus', 93 install_dir: get_option('includedir'), 94 strip_directory: false, 95) 96 97import('pkgconfig').generate( 98 libsdbusplus, 99 name: meson.project_name(), 100 version: meson.project_version(), 101 requires: libsystemd_pkg, 102 extra_cflags: boost_compile_args, 103 description: 'C++ bindings for sdbus', 104) 105