blob: 640059ba3f2747bf74f2195cbfceade423872ae2 [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 Williams32ffb032020-10-12 12:17:48 -050028 'src/bus.cpp',
Patrick Williams74187662022-08-26 19:28:24 -050029 'src/exception.cpp',
William A. Kennington III226bc422021-05-05 17:08:36 -070030 'src/message/native_types.cpp',
Patrick Williams7f664252020-06-04 10:20:56 -050031 'src/sdbus.cpp',
Patrick Williams32ffb032020-10-12 12:17:48 -050032 'src/server/interface.cpp',
Patrick Williams7f664252020-06-04 10:20:56 -050033 'src/server/transaction.cpp',
Patrick Williams98d71082020-05-15 18:55:16 -050034)
35
William A. Kennington IIIf69a8b72020-05-28 12:59:40 -070036libsdbusplus = library(
Patrick Williams98d71082020-05-15 18:55:16 -050037 'sdbusplus',
38 libsdbusplus_src,
Patrick Williams7f664252020-06-04 10:20:56 -050039 include_directories: root_inc,
Patrick Williams98d71082020-05-15 18:55:16 -050040 dependencies: libsystemd_pkg,
41 version: meson.project_version(),
42 install: true,
43)
44
William A. Kennington III270f2422021-06-04 16:07:43 -070045boost_compile_args = [
46 '-DBOOST_ASIO_DISABLE_THREADS',
47 '-DBOOST_ALL_NO_LIB',
48 '-DBOOST_SYSTEM_NO_DEPRECATED',
49 '-DBOOST_ERROR_CODE_HEADER_ONLY',
50 '-DBOOST_COROUTINES_NO_DEPRECATION_WARNING',
51]
52
53boost_dep = declare_dependency(
54 dependencies: dependency('boost', required: false),
55 compile_args: boost_compile_args)
56
Patrick Williamsd0285b92020-06-01 09:43:47 -050057sdbusplus_dep = declare_dependency(
58 include_directories: root_inc,
59 link_with: libsdbusplus,
William A. Kennington III270f2422021-06-04 16:07:43 -070060 dependencies: [ libsystemd_pkg, boost_dep ],
Patrick Williamsd0285b92020-06-01 09:43:47 -050061)
62
Patrick Williamsad145e02020-05-19 16:45:15 -050063subdir('tools')
64
William A. Kennington III5e893b92020-06-04 02:47:29 -070065if not get_option('examples').disabled()
66 subdir('example')
67endif
68if not get_option('tests').disabled()
69 subdir('test')
70endif
Patrick Williamsad145e02020-05-19 16:45:15 -050071
Patrick Williams98d71082020-05-15 18:55:16 -050072install_subdir(
Patrick Williams7f664252020-06-04 10:20:56 -050073 'include/sdbusplus',
Patrick Williams98d71082020-05-15 18:55:16 -050074 install_dir: get_option('includedir'),
75 strip_directory: false,
Patrick Williams98d71082020-05-15 18:55:16 -050076)
77
78import('pkgconfig').generate(
Patrick Williamsfe0edaa2021-04-15 13:30:16 -050079 libsdbusplus,
Patrick Williams98d71082020-05-15 18:55:16 -050080 name: meson.project_name(),
81 version: meson.project_version(),
Patrick Williamsfa3137a2020-05-28 14:49:15 -050082 requires: libsystemd_pkg,
William A. Kennington III270f2422021-06-04 16:07:43 -070083 extra_cflags: boost_compile_args,
Patrick Williams98d71082020-05-15 18:55:16 -050084 description: 'C++ bindings for sdbus',
85)