blob: 630cabe8d8fb5d26eb3198c406f133af8b8dea72 [file] [log] [blame]
Brad Bishopfeb19ef2019-11-07 18:02:16 -05001project(
2 'dbus-sensors',
3 'cpp',
Andrew Jefferyab8b0452024-01-11 09:55:51 +10304 default_options: ['warning_level=3', 'werror=true', 'cpp_std=c++20'],
Brad Bishopfeb19ef2019-11-07 18:02:16 -05005 license: 'Apache-2.0',
6 version: '0.1',
Andrew Jeffery8eb514a2024-01-04 10:30:10 +10307 meson_version: '>=1.1',
Brad Bishopfeb19ef2019-11-07 18:02:16 -05008)
9
Patrick Williamsab570a62023-12-07 14:49:43 -060010# Enable io_uring for all daemons with below flags.
Zhikui Rena0c6b5b2023-06-06 12:14:19 -070011# '-DBOOST_ASIO_HAS_IO_URING',
12# '-DBOOST_ASIO_DISABLE_EPOLL',
13# '-DBOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT',
14# Note, there is currently an issue with CPUSensor when used in
15# conjunction with io_uring. So it has not been changed to use
16# random file access. But we'd like to enable it for all daemons.
Ed Tanous16966b52021-09-15 15:06:59 -070017# https://github.com/openbmc/dbus-sensors/issues/19
Ed Tanous16966b52021-09-15 15:06:59 -070018
Brad Bishopfeb19ef2019-11-07 18:02:16 -050019add_project_arguments(
Andrew Jefferye3b23c02021-09-23 11:29:49 +093020 '-Wno-psabi',
Ed Tanousa771f6a2022-01-14 09:36:51 -080021 '-Wuninitialized',
Brad Bishopfeb19ef2019-11-07 18:02:16 -050022 '-DBOOST_SYSTEM_NO_DEPRECATED',
Ed Tanous83db50c2023-03-01 10:20:24 -080023 '-DBOOST_ASIO_NO_DEPRECATED',
Brad Bishopfeb19ef2019-11-07 18:02:16 -050024 '-DBOOST_ERROR_CODE_HEADER_ONLY',
25 '-DBOOST_NO_RTTI',
26 '-DBOOST_NO_TYPEID',
27 '-DBOOST_ALL_NO_LIB',
28 '-DBOOST_ASIO_DISABLE_THREADS',
29 '-DBOOST_ALLOW_DEPRECATED_HEADERS',
Zhikui Rena0c6b5b2023-06-06 12:14:19 -070030 '-DBOOST_ASIO_HAS_IO_URING',
31 '-DBOOST_ASIO_DISABLE_EPOLL',
32 '-DBOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT',
Brad Bishopfeb19ef2019-11-07 18:02:16 -050033 language: 'cpp',
34)
35
36build_tests = get_option('tests')
Andrew Jefferyab8b0452024-01-11 09:55:51 +103037gpiodcxx = dependency(
38 'libgpiodcxx',
Patrick Williams3911b822021-08-27 14:31:50 -050039 default_options: ['bindings=cxx'],
40)
Andrew Jeffery2d66c242021-05-27 12:57:50 +093041
42# i2c-tools doesn't ship a pkg-config file for libi2c
Brad Bishopfeb19ef2019-11-07 18:02:16 -050043i2c = meson.get_compiler('cpp').find_library('i2c')
Andrew Jeffery2d66c242021-05-27 12:57:50 +093044
Andrew Jefferyab8b0452024-01-11 09:55:51 +103045sdbusplus = dependency('sdbusplus', required: false, include_type: 'system')
Ed Tanous16966b52021-09-15 15:06:59 -070046if not sdbusplus.found()
Andrew Jefferyab8b0452024-01-11 09:55:51 +103047 sdbusplus_proj = subproject('sdbusplus', required: true)
48 sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep')
49 sdbusplus = sdbusplus.as_system('system')
Ed Tanous16966b52021-09-15 15:06:59 -070050endif
51
Patrick Williams3f556a82022-03-21 11:25:15 -050052phosphor_logging_dep = dependency('phosphor-logging')
Patrick Williamsab570a62023-12-07 14:49:43 -060053nlohmann_json_dep = dependency('nlohmann_json', include_type: 'system')
Patrick Williams1889ebf2021-08-27 14:38:52 -050054
Brad Bishopfeb19ef2019-11-07 18:02:16 -050055systemd = dependency('systemd')
Andrew Jefferyfbf92542021-05-27 15:00:47 +093056systemd_system_unit_dir = systemd.get_variable(
Patrick Williamse46b4442023-04-12 08:01:11 -050057 'systemdsystemunitdir',
Andrew Jefferyab8b0452024-01-11 09:55:51 +103058 pkgconfig_define: ['prefix', get_option('prefix')],
59)
Brad Bishopfeb19ef2019-11-07 18:02:16 -050060threads = dependency('threads')
61
Andrew Jefferyab8b0452024-01-11 09:55:51 +103062boost = dependency(
63 'boost',
64 version: '>=1.79.0',
65 required: false,
66 include_type: 'system',
67)
Ed Tanous16966b52021-09-15 15:06:59 -070068if not boost.found()
Andrew Jefferyab8b0452024-01-11 09:55:51 +103069 subproject('boost', required: false)
70 boost_inc = include_directories(
71 'subprojects/boost_1_79_0/',
72 is_system: true,
73 )
74 boost = declare_dependency(include_directories: boost_inc)
75 boost = boost.as_system('system')
Ed Tanous16966b52021-09-15 15:06:59 -070076endif
77
Andrew Jefferyab8b0452024-01-11 09:55:51 +103078uring = dependency('liburing', required: false, include_type: 'system')
Ed Tanous16966b52021-09-15 15:06:59 -070079if not uring.found()
Andrew Jefferyab8b0452024-01-11 09:55:51 +103080 uring_proj = subproject('liburing', required: true)
81 uring = uring_proj.get_variable('uring')
82 uring = uring.as_system('system')
Ed Tanous16966b52021-09-15 15:06:59 -070083endif
84
Patrick Williams302a61a2021-08-27 15:40:08 -050085default_deps = [
Ed Tanous16966b52021-09-15 15:06:59 -070086 boost,
Patrick Williamsab570a62023-12-07 14:49:43 -060087 nlohmann_json_dep,
Patrick Williams0c42f402021-08-27 16:05:45 -050088 phosphor_logging_dep,
Patrick Williams302a61a2021-08-27 15:40:08 -050089 sdbusplus,
Ed Tanous16966b52021-09-15 15:06:59 -070090 uring,
Patrick Williams302a61a2021-08-27 15:40:08 -050091]
92
Brad Bishopfeb19ef2019-11-07 18:02:16 -050093subdir('service_files')
94subdir('src')
95
96if not build_tests.disabled()
97 subdir('tests')
98endif