forked from openbmc/dbus-sensors
-
Notifications
You must be signed in to change notification settings - Fork 3
/
Copy pathmeson.build
155 lines (133 loc) · 3.82 KB
/
meson.build
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
project(
'dbus-sensors',
'cpp',
default_options: [
'warning_level=3',
'werror=true',
'cpp_std=c++20'
],
license: 'Apache-2.0',
version: '0.1',
meson_version: '>=0.57.0',
)
# Note, there is currently an issue with CPUSensor when used in conjunction
# with io_uring. For the moment, we enable uring for all other daemons, but
# we'd like to enable it for all daemons.
# https://github.com/openbmc/dbus-sensors/issues/19
uring_args = [
'-DBOOST_ASIO_HAS_IO_URING',
'-DBOOST_ASIO_DISABLE_EPOLL',
'-DBOOST_ASIO_USE_TS_EXECUTOR_AS_DEFAULT',
]
add_project_arguments(
'-Wno-psabi',
'-Wuninitialized',
'-DBOOST_SYSTEM_NO_DEPRECATED',
'-DBOOST_ERROR_CODE_HEADER_ONLY',
'-DBOOST_NO_RTTI',
'-DBOOST_NO_TYPEID',
'-DBOOST_ALL_NO_LIB',
'-DBOOST_ASIO_DISABLE_THREADS',
'-DBOOST_ALLOW_DEPRECATED_HEADERS',
language: 'cpp',
)
cpp = meson.get_compiler('cpp')
build_tests = get_option('tests')
gpiodcxx = dependency('libgpiodcxx',
default_options: ['bindings=cxx'],
)
# i2c-tools doesn't ship a pkg-config file for libi2c
i2c = meson.get_compiler('cpp').find_library('i2c')
sdbusplus = dependency('sdbusplus', required : false, include_type: 'system')
if not sdbusplus.found()
sdbusplus_proj = subproject('sdbusplus', required: true)
sdbusplus = sdbusplus_proj.get_variable('sdbusplus_dep')
sdbusplus = sdbusplus.as_system('system')
endif
phosphor_logging_dep = dependency('phosphor-logging')
if cpp.has_header('nlohmann/json.hpp')
nlohmann_json = declare_dependency()
else
nlohmann_json = dependency('nlohmann_json')
endif
systemd = dependency('systemd')
systemd_system_unit_dir = systemd.get_variable(
pkgconfig: 'systemdsystemunitdir',
pkgconfig_define: ['prefix', get_option('prefix')])
threads = dependency('threads')
boost = dependency('boost',version : '>=1.79.0', required : false, include_type: 'system')
if not boost.found()
subproject('boost', required: false)
boost_inc = include_directories('subprojects/boost_1_79_0/', is_system:true)
boost = declare_dependency(include_directories : boost_inc)
boost = boost.as_system('system')
endif
uring = dependency('liburing', required : false, include_type: 'system')
if not uring.found()
uring_proj = subproject('liburing', required: true)
uring = uring_proj.get_variable('uring')
uring = uring.as_system('system')
endif
default_deps = [
boost,
nlohmann_json,
phosphor_logging_dep,
sdbusplus,
uring,
]
thresholds_a = static_library(
'thresholds_a',
'src/Thresholds.cpp',
dependencies: default_deps,
implicit_include_directories: false,
include_directories: 'include',
)
thresholds_dep = declare_dependency(
link_with: [ thresholds_a ],
dependencies: default_deps,
)
utils_a = static_library(
'utils_a',
[
'src/FileHandle.cpp',
'src/SensorPaths.cpp',
'src/Utils.cpp',
],
dependencies: default_deps,
implicit_include_directories: false,
include_directories: 'include',
)
utils_dep = declare_dependency(
link_with: [ utils_a ],
dependencies: [ sdbusplus ],
)
devicemgmt_a = static_library(
'devicemgmt_a',
[
'src/DeviceMgmt.cpp',
],
dependencies: default_deps,
implicit_include_directories: false,
include_directories: 'include',
)
devicemgmt_dep = declare_dependency(
link_with: [ devicemgmt_a ],
dependencies: default_deps,
)
pwmsensor_a = static_library(
'pwmsensor_a',
'src/PwmSensor.cpp',
dependencies: [ default_deps, thresholds_dep ],
implicit_include_directories: false,
include_directories: 'include',
)
pwmsensor_dep = declare_dependency(
link_with: [ pwmsensor_a ],
dependencies: [ default_deps, thresholds_dep ],
)
subdir('include')
subdir('service_files')
subdir('src')
if not build_tests.disabled()
subdir('tests')
endif