blob: 606d987a1afa997183e0e9c67fffb2f54b7fe61b [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',
Patrick Williamse46b4442023-04-12 08:01:11 -05007 meson_version: '>=0.58.0',
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
Patrick Williams1889ebf2021-08-27 14:38:52 -050036cpp = meson.get_compiler('cpp')
37
Brad Bishopfeb19ef2019-11-07 18:02:16 -050038build_tests = get_option('tests')
Andrew Jefferyab8b0452024-01-11 09:55:51 +103039gpiodcxx = dependency(
40 'libgpiodcxx',
Patrick Williams3911b822021-08-27 14:31:50 -050041 default_options: ['bindings=cxx'],
42)
Andrew Jeffery2d66c242021-05-27 12:57:50 +093043
44# i2c-tools doesn't ship a pkg-config file for libi2c
Brad Bishopfeb19ef2019-11-07 18:02:16 -050045i2c = meson.get_compiler('cpp').find_library('i2c')
Andrew Jeffery2d66c242021-05-27 12:57:50 +093046
Andrew Jefferyab8b0452024-01-11 09:55:51 +103047sdbusplus = dependency('sdbusplus', required: false, include_type: 'system')
Ed Tanous16966b52021-09-15 15:06:59 -070048if not sdbusplus.found()
Andrew Jefferyab8b0452024-01-11 09:55:51 +103049 sdbusplus_proj = subproject('sdbusplus', required: true)
50 sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep')
51 sdbusplus = sdbusplus.as_system('system')
Ed Tanous16966b52021-09-15 15:06:59 -070052endif
53
Patrick Williams3f556a82022-03-21 11:25:15 -050054phosphor_logging_dep = dependency('phosphor-logging')
Patrick Williamsab570a62023-12-07 14:49:43 -060055nlohmann_json_dep = dependency('nlohmann_json', include_type: 'system')
Patrick Williams1889ebf2021-08-27 14:38:52 -050056
Brad Bishopfeb19ef2019-11-07 18:02:16 -050057systemd = dependency('systemd')
Andrew Jefferyfbf92542021-05-27 15:00:47 +093058systemd_system_unit_dir = systemd.get_variable(
Patrick Williamse46b4442023-04-12 08:01:11 -050059 'systemdsystemunitdir',
Andrew Jefferyab8b0452024-01-11 09:55:51 +103060 pkgconfig_define: ['prefix', get_option('prefix')],
61)
Brad Bishopfeb19ef2019-11-07 18:02:16 -050062threads = dependency('threads')
63
Andrew Jefferyab8b0452024-01-11 09:55:51 +103064boost = dependency(
65 'boost',
66 version: '>=1.79.0',
67 required: false,
68 include_type: 'system',
69)
Ed Tanous16966b52021-09-15 15:06:59 -070070if not boost.found()
Andrew Jefferyab8b0452024-01-11 09:55:51 +103071 subproject('boost', required: false)
72 boost_inc = include_directories(
73 'subprojects/boost_1_79_0/',
74 is_system: true,
75 )
76 boost = declare_dependency(include_directories: boost_inc)
77 boost = boost.as_system('system')
Ed Tanous16966b52021-09-15 15:06:59 -070078endif
79
Andrew Jefferyab8b0452024-01-11 09:55:51 +103080uring = dependency('liburing', required: false, include_type: 'system')
Ed Tanous16966b52021-09-15 15:06:59 -070081if not uring.found()
Andrew Jefferyab8b0452024-01-11 09:55:51 +103082 uring_proj = subproject('liburing', required: true)
83 uring = uring_proj.get_variable('uring')
84 uring = uring.as_system('system')
Ed Tanous16966b52021-09-15 15:06:59 -070085endif
86
Patrick Williams302a61a2021-08-27 15:40:08 -050087default_deps = [
Ed Tanous16966b52021-09-15 15:06:59 -070088 boost,
Patrick Williamsab570a62023-12-07 14:49:43 -060089 nlohmann_json_dep,
Patrick Williams0c42f402021-08-27 16:05:45 -050090 phosphor_logging_dep,
Patrick Williams302a61a2021-08-27 15:40:08 -050091 sdbusplus,
Ed Tanous16966b52021-09-15 15:06:59 -070092 uring,
Patrick Williams302a61a2021-08-27 15:40:08 -050093]
94
Brad Bishopfeb19ef2019-11-07 18:02:16 -050095subdir('service_files')
96subdir('src')
97
98if not build_tests.disabled()
99 subdir('tests')
100endif