blob: 8dfa8280744a5036083585794f7a51a196dc8915 [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',
Patrick Williamse46b4442023-04-12 08:01:11 -050011 meson_version: '>=0.58.0',
Brad Bishopfeb19ef2019-11-07 18:02:16 -050012)
13
Zhikui Rena0c6b5b2023-06-06 12:14:19 -070014# Enable io_uring for all daemons with below flags.
15# '-DBOOST_ASIO_HAS_IO_URING',
16# '-DBOOST_ASIO_DISABLE_EPOLL',
17# '-DBOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT',
18# Note, there is currently an issue with CPUSensor when used in
19# conjunction with io_uring. So it has not been changed to use
20# random file access. But we'd like to enable it for all daemons.
Ed Tanous16966b52021-09-15 15:06:59 -070021# https://github.com/openbmc/dbus-sensors/issues/19
Ed Tanous16966b52021-09-15 15:06:59 -070022
Brad Bishopfeb19ef2019-11-07 18:02:16 -050023add_project_arguments(
Andrew Jefferye3b23c02021-09-23 11:29:49 +093024 '-Wno-psabi',
Ed Tanousa771f6a2022-01-14 09:36:51 -080025 '-Wuninitialized',
Brad Bishopfeb19ef2019-11-07 18:02:16 -050026 '-DBOOST_SYSTEM_NO_DEPRECATED',
Ed Tanous83db50c2023-03-01 10:20:24 -080027 '-DBOOST_ASIO_NO_DEPRECATED',
Brad Bishopfeb19ef2019-11-07 18:02:16 -050028 '-DBOOST_ERROR_CODE_HEADER_ONLY',
29 '-DBOOST_NO_RTTI',
30 '-DBOOST_NO_TYPEID',
31 '-DBOOST_ALL_NO_LIB',
32 '-DBOOST_ASIO_DISABLE_THREADS',
33 '-DBOOST_ALLOW_DEPRECATED_HEADERS',
Zhikui Rena0c6b5b2023-06-06 12:14:19 -070034 '-DBOOST_ASIO_HAS_IO_URING',
35 '-DBOOST_ASIO_DISABLE_EPOLL',
36 '-DBOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT',
Brad Bishopfeb19ef2019-11-07 18:02:16 -050037 language: 'cpp',
38)
39
Patrick Williams1889ebf2021-08-27 14:38:52 -050040cpp = meson.get_compiler('cpp')
41
Brad Bishopfeb19ef2019-11-07 18:02:16 -050042build_tests = get_option('tests')
Patrick Williams3f556a82022-03-21 11:25:15 -050043gpiodcxx = dependency('libgpiodcxx',
Patrick Williams3911b822021-08-27 14:31:50 -050044 default_options: ['bindings=cxx'],
45)
Andrew Jeffery2d66c242021-05-27 12:57:50 +093046
47# i2c-tools doesn't ship a pkg-config file for libi2c
Brad Bishopfeb19ef2019-11-07 18:02:16 -050048i2c = meson.get_compiler('cpp').find_library('i2c')
Andrew Jeffery2d66c242021-05-27 12:57:50 +093049
Ed Tanous16966b52021-09-15 15:06:59 -070050sdbusplus = dependency('sdbusplus', required : false, include_type: 'system')
51if not sdbusplus.found()
52 sdbusplus_proj = subproject('sdbusplus', required: true)
53 sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep')
54 sdbusplus = sdbusplus.as_system('system')
55endif
56
Patrick Williams3f556a82022-03-21 11:25:15 -050057phosphor_logging_dep = dependency('phosphor-logging')
Patrick Williams08d684a2021-08-27 15:15:34 -050058
Patrick Williams1889ebf2021-08-27 14:38:52 -050059if cpp.has_header('nlohmann/json.hpp')
60 nlohmann_json = declare_dependency()
61else
Patrick Williams3f556a82022-03-21 11:25:15 -050062 nlohmann_json = dependency('nlohmann_json')
Patrick Williams1889ebf2021-08-27 14:38:52 -050063endif
64
Brad Bishopfeb19ef2019-11-07 18:02:16 -050065systemd = dependency('systemd')
Andrew Jefferyfbf92542021-05-27 15:00:47 +093066systemd_system_unit_dir = systemd.get_variable(
Patrick Williamse46b4442023-04-12 08:01:11 -050067 'systemdsystemunitdir',
Andrew Jefferyfbf92542021-05-27 15:00:47 +093068 pkgconfig_define: ['prefix', get_option('prefix')])
Brad Bishopfeb19ef2019-11-07 18:02:16 -050069threads = dependency('threads')
70
Ed Tanous16966b52021-09-15 15:06:59 -070071boost = dependency('boost',version : '>=1.79.0', required : false, include_type: 'system')
72if not boost.found()
73 subproject('boost', required: false)
74 boost_inc = include_directories('subprojects/boost_1_79_0/', is_system:true)
75 boost = declare_dependency(include_directories : boost_inc)
76 boost = boost.as_system('system')
77endif
78
79uring = dependency('liburing', required : false, include_type: 'system')
80if not uring.found()
81 uring_proj = subproject('liburing', required: true)
82 uring = uring_proj.get_variable('uring')
83 uring = uring.as_system('system')
84endif
85
Patrick Williams302a61a2021-08-27 15:40:08 -050086default_deps = [
Ed Tanous16966b52021-09-15 15:06:59 -070087 boost,
Patrick Williams302a61a2021-08-27 15:40:08 -050088 nlohmann_json,
Patrick Williams0c42f402021-08-27 16:05:45 -050089 phosphor_logging_dep,
Patrick Williams302a61a2021-08-27 15:40:08 -050090 sdbusplus,
Ed Tanous16966b52021-09-15 15:06:59 -070091 uring,
Patrick Williams302a61a2021-08-27 15:40:08 -050092]
93
Brad Bishopfeb19ef2019-11-07 18:02:16 -050094subdir('service_files')
95subdir('src')
96
97if not build_tests.disabled()
98 subdir('tests')
99endif