blob: 448d167244a64081e3a0c1fa8d1a9121f34664f2 [file] [log] [blame]
Patrick Williamsad145e02020-05-19 16:45:15 -05001project('sdbusplus', 'cpp', 'c',
Patrick Williams98d71082020-05-15 18:55:16 -05002 default_options: [
Patrick Williamsfeb48472020-05-19 06:23:10 -05003 'buildtype=debugoptimized',
Patrick Williams2e988612021-04-14 14:49:25 -05004 'cpp_std=c++20',
Patrick Williams601d9752021-07-21 14:16:06 -05005 'warning_level=3',
Patrick Williams98d71082020-05-15 18:55:16 -05006 'werror=true',
William A. Kennington IIIf05b4ca2020-06-04 02:48:52 -07007 'tests=' + (meson.is_subproject() ? 'disabled' : 'auto'),
8 'examples=' + (meson.is_subproject() ? 'disabled' : 'auto'),
Patrick Williams98d71082020-05-15 18:55:16 -05009 ],
10 version: '1.0.0',
Patrick Williams2e988612021-04-14 14:49:25 -050011 meson_version: '>=0.57.0',
Patrick Williams98d71082020-05-15 18:55:16 -050012)
13
14libsystemd_pkg = dependency('libsystemd')
Manojkiran Eda22a03e32022-06-17 09:14:41 +053015
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
Patrick Williams7f664252020-06-04 10:20:56 -050024root_inc = include_directories('include')
Patrick Williams98d71082020-05-15 18:55:16 -050025
26libsdbusplus_src = files(
Patrick Williams74187662022-08-26 19:28:24 -050027 'src/async/context.cpp',
Patrick Williams290fa422022-08-29 09:15:58 -050028 'src/async/match.cpp',
Patrick Williams0139cac2022-09-20 17:04:17 -050029 'src/async/scope.cpp',
Patrick Williams32ffb032020-10-12 12:17:48 -050030 'src/bus.cpp',
Patrick Williamsd2b00442022-09-16 08:28:07 -050031 'src/event.cpp',
Patrick Williams74187662022-08-26 19:28:24 -050032 'src/exception.cpp',
William A. Kennington III226bc422021-05-05 17:08:36 -070033 'src/message/native_types.cpp',
Patrick Williams7f664252020-06-04 10:20:56 -050034 'src/sdbus.cpp',
Patrick Williams32ffb032020-10-12 12:17:48 -050035 'src/server/interface.cpp',
Patrick Williams7f664252020-06-04 10:20:56 -050036 'src/server/transaction.cpp',
Patrick Williams98d71082020-05-15 18:55:16 -050037)
38
William A. Kennington IIIf69a8b72020-05-28 12:59:40 -070039libsdbusplus = library(
Patrick Williams98d71082020-05-15 18:55:16 -050040 'sdbusplus',
41 libsdbusplus_src,
Patrick Williams7f664252020-06-04 10:20:56 -050042 include_directories: root_inc,
Patrick Williams98d71082020-05-15 18:55:16 -050043 dependencies: libsystemd_pkg,
44 version: meson.project_version(),
45 install: true,
46)
47
William A. Kennington III270f2422021-06-04 16:07:43 -070048boost_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
Patrick Williamsd0285b92020-06-01 09:43:47 -050060sdbusplus_dep = declare_dependency(
61 include_directories: root_inc,
62 link_with: libsdbusplus,
William A. Kennington III270f2422021-06-04 16:07:43 -070063 dependencies: [ libsystemd_pkg, boost_dep ],
Patrick Williamsd0285b92020-06-01 09:43:47 -050064)
65
Patrick Williamsad145e02020-05-19 16:45:15 -050066subdir('tools')
67
William A. Kennington III5e893b92020-06-04 02:47:29 -070068if not get_option('examples').disabled()
69 subdir('example')
70endif
71if not get_option('tests').disabled()
72 subdir('test')
73endif
Patrick Williamsad145e02020-05-19 16:45:15 -050074
Patrick Williams98d71082020-05-15 18:55:16 -050075install_subdir(
Patrick Williams7f664252020-06-04 10:20:56 -050076 'include/sdbusplus',
Patrick Williams98d71082020-05-15 18:55:16 -050077 install_dir: get_option('includedir'),
78 strip_directory: false,
Patrick Williams98d71082020-05-15 18:55:16 -050079)
80
81import('pkgconfig').generate(
Patrick Williamsfe0edaa2021-04-15 13:30:16 -050082 libsdbusplus,
Patrick Williams98d71082020-05-15 18:55:16 -050083 name: meson.project_name(),
84 version: meson.project_version(),
Patrick Williamsfa3137a2020-05-28 14:49:15 -050085 requires: libsystemd_pkg,
William A. Kennington III270f2422021-06-04 16:07:43 -070086 extra_cflags: boost_compile_args,
Patrick Williams98d71082020-05-15 18:55:16 -050087 description: 'C++ bindings for sdbus',
88)