blob: 0a214e26ec8b4af9ef179dd15798aa9798d580ec [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 Williams7f664252020-06-04 10:20:56 -050027 'src/exception.cpp',
Patrick Williams32ffb032020-10-12 12:17:48 -050028 'src/bus.cpp',
William A. Kennington III226bc422021-05-05 17:08:36 -070029 'src/message/native_types.cpp',
Patrick Williams7f664252020-06-04 10:20:56 -050030 'src/sdbus.cpp',
Patrick Williams32ffb032020-10-12 12:17:48 -050031 'src/server/interface.cpp',
Patrick Williams7f664252020-06-04 10:20:56 -050032 'src/server/transaction.cpp',
Patrick Williams98d71082020-05-15 18:55:16 -050033)
34
William A. Kennington IIIf69a8b72020-05-28 12:59:40 -070035libsdbusplus = library(
Patrick Williams98d71082020-05-15 18:55:16 -050036 'sdbusplus',
37 libsdbusplus_src,
Patrick Williams7f664252020-06-04 10:20:56 -050038 include_directories: root_inc,
Patrick Williams98d71082020-05-15 18:55:16 -050039 dependencies: libsystemd_pkg,
40 version: meson.project_version(),
41 install: true,
42)
43
William A. Kennington III270f2422021-06-04 16:07:43 -070044boost_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
Patrick Williamsd0285b92020-06-01 09:43:47 -050056sdbusplus_dep = declare_dependency(
57 include_directories: root_inc,
58 link_with: libsdbusplus,
William A. Kennington III270f2422021-06-04 16:07:43 -070059 dependencies: [ libsystemd_pkg, boost_dep ],
Patrick Williamsd0285b92020-06-01 09:43:47 -050060)
61
Patrick Williamsad145e02020-05-19 16:45:15 -050062subdir('tools')
63
William A. Kennington III5e893b92020-06-04 02:47:29 -070064if not get_option('examples').disabled()
65 subdir('example')
66endif
67if not get_option('tests').disabled()
68 subdir('test')
69endif
Patrick Williamsad145e02020-05-19 16:45:15 -050070
Patrick Williams98d71082020-05-15 18:55:16 -050071install_subdir(
Patrick Williams7f664252020-06-04 10:20:56 -050072 'include/sdbusplus',
Patrick Williams98d71082020-05-15 18:55:16 -050073 install_dir: get_option('includedir'),
74 strip_directory: false,
Patrick Williams98d71082020-05-15 18:55:16 -050075)
76
77import('pkgconfig').generate(
Patrick Williamsfe0edaa2021-04-15 13:30:16 -050078 libsdbusplus,
Patrick Williams98d71082020-05-15 18:55:16 -050079 name: meson.project_name(),
80 version: meson.project_version(),
Patrick Williamsfa3137a2020-05-28 14:49:15 -050081 requires: libsystemd_pkg,
William A. Kennington III270f2422021-06-04 16:07:43 -070082 extra_cflags: boost_compile_args,
Patrick Williams98d71082020-05-15 18:55:16 -050083 description: 'C++ bindings for sdbus',
84)