blob: 1b355d537dfe621f7be882a95305917dd4add338 [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',
28 '-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',
34 language: 'cpp',
35)
36
Patrick Williams1889ebf2021-08-27 14:38:52 -050037cpp = meson.get_compiler('cpp')
38
Brad Bishopfeb19ef2019-11-07 18:02:16 -050039build_tests = get_option('tests')
Patrick Williams3f556a82022-03-21 11:25:15 -050040gpiodcxx = dependency('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
Ed Tanous16966b52021-09-15 15:06:59 -070047sdbusplus = dependency('sdbusplus', required : false, include_type: 'system')
48if not sdbusplus.found()
49 sdbusplus_proj = subproject('sdbusplus', required: true)
50 sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep')
51 sdbusplus = sdbusplus.as_system('system')
52endif
53
Patrick Williams3f556a82022-03-21 11:25:15 -050054phosphor_logging_dep = dependency('phosphor-logging')
Patrick Williams08d684a2021-08-27 15:15:34 -050055
Patrick Williams1889ebf2021-08-27 14:38:52 -050056if cpp.has_header('nlohmann/json.hpp')
57 nlohmann_json = declare_dependency()
58else
Patrick Williams3f556a82022-03-21 11:25:15 -050059 nlohmann_json = dependency('nlohmann_json')
Patrick Williams1889ebf2021-08-27 14:38:52 -050060endif
61
Brad Bishopfeb19ef2019-11-07 18:02:16 -050062systemd = dependency('systemd')
Andrew Jefferyfbf92542021-05-27 15:00:47 +093063systemd_system_unit_dir = systemd.get_variable(
64 pkgconfig: 'systemdsystemunitdir',
65 pkgconfig_define: ['prefix', get_option('prefix')])
Brad Bishopfeb19ef2019-11-07 18:02:16 -050066threads = dependency('threads')
67
Ed Tanous16966b52021-09-15 15:06:59 -070068boost = dependency('boost',version : '>=1.79.0', required : false, include_type: 'system')
69if not boost.found()
70 subproject('boost', required: false)
71 boost_inc = include_directories('subprojects/boost_1_79_0/', is_system:true)
72 boost = declare_dependency(include_directories : boost_inc)
73 boost = boost.as_system('system')
74endif
75
76uring = dependency('liburing', required : false, include_type: 'system')
77if not uring.found()
78 uring_proj = subproject('liburing', required: true)
79 uring = uring_proj.get_variable('uring')
80 uring = uring.as_system('system')
81endif
82
Patrick Williams302a61a2021-08-27 15:40:08 -050083default_deps = [
Ed Tanous16966b52021-09-15 15:06:59 -070084 boost,
Patrick Williams302a61a2021-08-27 15:40:08 -050085 nlohmann_json,
Patrick Williams0c42f402021-08-27 16:05:45 -050086 phosphor_logging_dep,
Patrick Williams302a61a2021-08-27 15:40:08 -050087 sdbusplus,
Ed Tanous16966b52021-09-15 15:06:59 -070088 uring,
Patrick Williams302a61a2021-08-27 15:40:08 -050089]
90
Brad Bishopfeb19ef2019-11-07 18:02:16 -050091thresholds_a = static_library(
92 'thresholds_a',
93 'src/Thresholds.cpp',
Patrick Williams302a61a2021-08-27 15:40:08 -050094 dependencies: default_deps,
Brad Bishopfeb19ef2019-11-07 18:02:16 -050095 implicit_include_directories: false,
96 include_directories: 'include',
97)
98
Patrick Williams8b8f6062021-08-27 14:53:50 -050099thresholds_dep = declare_dependency(
100 link_with: [ thresholds_a ],
Patrick Williams302a61a2021-08-27 15:40:08 -0500101 dependencies: default_deps,
Patrick Williams8b8f6062021-08-27 14:53:50 -0500102)
103
Brad Bishopfeb19ef2019-11-07 18:02:16 -0500104utils_a = static_library(
105 'utils_a',
Ed Tanous73030632022-01-14 10:09:47 -0800106 [
107 'src/FileHandle.cpp',
108 'src/SensorPaths.cpp',
109 'src/Utils.cpp',
110 ],
Patrick Williams302a61a2021-08-27 15:40:08 -0500111 dependencies: default_deps,
Brad Bishopfeb19ef2019-11-07 18:02:16 -0500112 implicit_include_directories: false,
113 include_directories: 'include',
114)
115
Patrick Williams8b8f6062021-08-27 14:53:50 -0500116utils_dep = declare_dependency(
117 link_with: [ utils_a ],
118 dependencies: [ sdbusplus ],
119)
120
Zev Weissdabd48d2022-08-03 15:43:17 -0700121devicemgmt_a = static_library(
122 'devicemgmt_a',
123 [
124 'src/DeviceMgmt.cpp',
125 ],
126 dependencies: default_deps,
127 implicit_include_directories: false,
128 include_directories: 'include',
129)
130
131devicemgmt_dep = declare_dependency(
132 link_with: [ devicemgmt_a ],
133 dependencies: default_deps,
134)
135
Brad Bishopfeb19ef2019-11-07 18:02:16 -0500136pwmsensor_a = static_library(
137 'pwmsensor_a',
138 'src/PwmSensor.cpp',
Patrick Williams302a61a2021-08-27 15:40:08 -0500139 dependencies: [ default_deps, thresholds_dep ],
Brad Bishopfeb19ef2019-11-07 18:02:16 -0500140 implicit_include_directories: false,
141 include_directories: 'include',
142)
143
Patrick Williams8b8f6062021-08-27 14:53:50 -0500144pwmsensor_dep = declare_dependency(
145 link_with: [ pwmsensor_a ],
Patrick Williams302a61a2021-08-27 15:40:08 -0500146 dependencies: [ default_deps, thresholds_dep ],
Patrick Williams8b8f6062021-08-27 14:53:50 -0500147)
148
Bruce Lee1263c3d2021-06-04 15:16:33 +0800149subdir('include')
Brad Bishopfeb19ef2019-11-07 18:02:16 -0500150subdir('service_files')
151subdir('src')
152
153if not build_tests.disabled()
154 subdir('tests')
155endif