blob: fdbecfd7d456b26d8d93255e0e787d6c079809d2 [file] [log] [blame]
Brad Bishopfeb19ef2019-11-07 18:02:16 -05001project(
2 'dbus-sensors',
3 'cpp',
4 default_options: [
5 'warning_level=3',
6 'werror=true',
Andrew Jefferyfbf92542021-05-27 15:00:47 +09307 'cpp_std=c++20'
Brad Bishopfeb19ef2019-11-07 18:02:16 -05008 ],
9 license: 'Apache-2.0',
10 version: '0.1',
Andrew Jefferyfbf92542021-05-27 15:00:47 +093011 meson_version: '>=0.57.0',
Brad Bishopfeb19ef2019-11-07 18:02:16 -050012)
13
Ed Tanous16966b52021-09-15 15:06:59 -070014# Note, there is currently an issue with CPUSensor when used in conjunction
15# with io_uring. For the moment, we enable uring for all other daemons, but
16# we'd like to enable it for all daemons.
17# https://github.com/openbmc/dbus-sensors/issues/19
18uring_args = [
19 '-DBOOST_ASIO_HAS_IO_URING',
20 '-DBOOST_ASIO_DISABLE_EPOLL',
21 '-DBOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT',
22]
23
Brad Bishopfeb19ef2019-11-07 18:02:16 -050024add_project_arguments(
Andrew Jefferye3b23c02021-09-23 11:29:49 +093025 '-Wno-psabi',
Ed Tanousa771f6a2022-01-14 09:36:51 -080026 '-Wuninitialized',
Brad Bishopfeb19ef2019-11-07 18:02:16 -050027 '-DBOOST_SYSTEM_NO_DEPRECATED',
Ed Tanous83db50c2023-03-01 10:20:24 -080028 '-DBOOST_ASIO_NO_DEPRECATED',
Brad Bishopfeb19ef2019-11-07 18:02:16 -050029 '-DBOOST_ERROR_CODE_HEADER_ONLY',
30 '-DBOOST_NO_RTTI',
31 '-DBOOST_NO_TYPEID',
32 '-DBOOST_ALL_NO_LIB',
33 '-DBOOST_ASIO_DISABLE_THREADS',
34 '-DBOOST_ALLOW_DEPRECATED_HEADERS',
35 language: 'cpp',
36)
37
Patrick Williams1889ebf2021-08-27 14:38:52 -050038cpp = meson.get_compiler('cpp')
39
Brad Bishopfeb19ef2019-11-07 18:02:16 -050040build_tests = get_option('tests')
Patrick Williams3f556a82022-03-21 11:25:15 -050041gpiodcxx = dependency('libgpiodcxx',
Patrick Williams3911b822021-08-27 14:31:50 -050042 default_options: ['bindings=cxx'],
43)
Andrew Jeffery2d66c242021-05-27 12:57:50 +093044
45# i2c-tools doesn't ship a pkg-config file for libi2c
Brad Bishopfeb19ef2019-11-07 18:02:16 -050046i2c = meson.get_compiler('cpp').find_library('i2c')
Andrew Jeffery2d66c242021-05-27 12:57:50 +093047
Ed Tanous16966b52021-09-15 15:06:59 -070048sdbusplus = dependency('sdbusplus', required : false, include_type: 'system')
49if not sdbusplus.found()
50 sdbusplus_proj = subproject('sdbusplus', required: true)
51 sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep')
52 sdbusplus = sdbusplus.as_system('system')
53endif
54
Patrick Williams3f556a82022-03-21 11:25:15 -050055phosphor_logging_dep = dependency('phosphor-logging')
Patrick Williams08d684a2021-08-27 15:15:34 -050056
Patrick Williams1889ebf2021-08-27 14:38:52 -050057if cpp.has_header('nlohmann/json.hpp')
58 nlohmann_json = declare_dependency()
59else
Patrick Williams3f556a82022-03-21 11:25:15 -050060 nlohmann_json = dependency('nlohmann_json')
Patrick Williams1889ebf2021-08-27 14:38:52 -050061endif
62
Brad Bishopfeb19ef2019-11-07 18:02:16 -050063systemd = dependency('systemd')
Andrew Jefferyfbf92542021-05-27 15:00:47 +093064systemd_system_unit_dir = systemd.get_variable(
65 pkgconfig: 'systemdsystemunitdir',
66 pkgconfig_define: ['prefix', get_option('prefix')])
Brad Bishopfeb19ef2019-11-07 18:02:16 -050067threads = dependency('threads')
68
Ed Tanous16966b52021-09-15 15:06:59 -070069boost = dependency('boost',version : '>=1.79.0', required : false, include_type: 'system')
70if not boost.found()
71 subproject('boost', required: false)
72 boost_inc = include_directories('subprojects/boost_1_79_0/', is_system:true)
73 boost = declare_dependency(include_directories : boost_inc)
74 boost = boost.as_system('system')
75endif
76
77uring = dependency('liburing', required : false, include_type: 'system')
78if not uring.found()
79 uring_proj = subproject('liburing', required: true)
80 uring = uring_proj.get_variable('uring')
81 uring = uring.as_system('system')
82endif
83
Patrick Williams302a61a2021-08-27 15:40:08 -050084default_deps = [
Ed Tanous16966b52021-09-15 15:06:59 -070085 boost,
Patrick Williams302a61a2021-08-27 15:40:08 -050086 nlohmann_json,
Patrick Williams0c42f402021-08-27 16:05:45 -050087 phosphor_logging_dep,
Patrick Williams302a61a2021-08-27 15:40:08 -050088 sdbusplus,
Ed Tanous16966b52021-09-15 15:06:59 -070089 uring,
Patrick Williams302a61a2021-08-27 15:40:08 -050090]
91
Brad Bishopfeb19ef2019-11-07 18:02:16 -050092subdir('service_files')
93subdir('src')
94
95if not build_tests.disabled()
96 subdir('tests')
97endif