blob: a102da5a624ef0397227443b938a0ee5f35557d7 [file] [log] [blame]
Harvey.Wub1225b22022-10-28 17:42:07 +08001project(
2 'phosphor-pid-control', 'cpp',
3 version : '1.0.0',
4 meson_version: '>=0.63.0',
5 default_options: [
6 'warning_level=3',
7 'werror=true',
8 'cpp_std=c++20',
9 ]
10)
11
12conf_data = configuration_data()
13
14bindir = get_option('prefix') / get_option('bindir')
15conf_data.set('BINDIR', bindir)
16conf_data.set('SYSTEMD_TARGET', get_option('systemd_target'))
17conf_data.set('STRICT_FAILSAFE_PWM', get_option('strict-failsafe-pwm'))
18
19configure_file(output: 'config.h',
20 configuration: conf_data
21)
22
23if get_option('oe-sdk').enabled()
24 OECORE_TARGET_SYSROOT = run_command('sh', '-c', 'echo $OECORE_TARGET_SYSROOT').stdout().strip()
25 if OECORE_TARGET_SYSROOT == ''
26 error('OECORE_TARGET_SYSROOT must be set with enable oe-sdk')
27 endif
28 message('Enabling OE-SDK at OECORE_TARGET_SYSROOT: ' + OECORE_TARGET_SYSROOT)
29 rpath = ':'.join([OECORE_TARGET_SYSROOT + '/lib', OECORE_TARGET_SYSROOT + '/usr/lib'])
30 ld_so = run_command('sh', '-c', 'find ' + OECORE_TARGET_SYSROOT + '/lib/ld-*.so | sort -r -n | head -n1').stdout().strip()
31 dynamic_linker = ['-Wl,-dynamic-linker,' + ld_so]
32else
33 dynamic_linker = []
34endif
35
36systemd = dependency('systemd')
37systemd_system_unit_dir = systemd.get_variable(
Patrick Williams7e6130a2023-04-12 08:01:19 -050038 'systemdsystemunitdir',
Harvey.Wub1225b22022-10-28 17:42:07 +080039 pkgconfig_define: ['prefix', get_option('prefix')])
40
41configure_file(input: 'phosphor-pid-control.service.in',
42 output: 'phosphor-pid-control.service',
43 configuration: conf_data,
44 install: true,
45 install_dir: systemd_system_unit_dir)
46
47phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces')
48phosphor_logging_dep = dependency('phosphor-logging')
49sdbusplus_dep = dependency('sdbusplus')
50libsystemd_dep = dependency('libsystemd')
51ipmid_dep = dependency('libipmid')
52
53deps = [
54 phosphor_dbus_interfaces_dep,
55 phosphor_logging_dep,
56 sdbusplus_dep,
57 libsystemd_dep,
58 ipmid_dep,
59]
60
61root_inc = include_directories(
62 '.',
63 'buildjson',
64 'dbus',
65 'errors',
66 'experiments',
67 'ipmi',
68 'notimpl',
69 'pid',
70 'sensors',
71 'sysfs',
72)
73
74setsensor_sources = [
75 'setsensor.cpp'
76]
77
78libswampd_sources = [
79 'main.cpp',
80 'util.cpp',
81 'notimpl/readonly.cpp',
82 'notimpl/writeonly.cpp',
83 'dbus/dbusconfiguration.cpp',
84 'dbus/dbusutil.cpp',
85 'dbus/dbushelper.cpp',
86 'dbus/dbuspassiveredundancy.cpp',
87 'dbus/dbuspassive.cpp',
88 'dbus/dbusactiveread.cpp',
89 'dbus/dbuswrite.cpp',
90 'sysfs/sysfsread.cpp',
91 'sysfs/sysfswrite.cpp',
92 'sysfs/util.cpp',
93 'sensors/pluggable.cpp',
94 'sensors/host.cpp',
95 'sensors/builder.cpp',
96 'sensors/buildjson.cpp',
97 'sensors/manager.cpp',
98 'sensors/build_utils.cpp',
99 'pid/ec/pid.cpp',
Josh Lehande745422020-11-07 02:14:09 -0800100 'pid/ec/logging.cpp',
Harvey.Wub1225b22022-10-28 17:42:07 +0800101 'pid/ec/stepwise.cpp',
102 'pid/fancontroller.cpp',
103 'pid/thermalcontroller.cpp',
104 'pid/pidcontroller.cpp',
105 'pid/stepwisecontroller.cpp',
106 'pid/builder.cpp',
107 'pid/buildjson.cpp',
108 'pid/zone.cpp',
109 'pid/util.cpp',
110 'pid/pidloop.cpp',
111 'pid/tuning.cpp',
112 'buildjson/buildjson.cpp',
113 'experiments/drive.cpp',
114]
115
116libmanualcmds_sources = [
117 'ipmi/main_ipmi.cpp',
118 'ipmi/manualcmds.cpp',
119 'ipmi/dbus_mode.cpp',
120]
121
122libmanualcmds = library(
123 'manualcmds',
124 libmanualcmds_sources,
125 implicit_include_directories: false,
126 dependencies: deps,
127 version: meson.project_version(),
128 override_options: ['b_lundef=false'],
129 install: true,
130 install_dir: get_option('libdir') / 'ipmid-providers')
131
132executable(
133 'swampd',
134 libswampd_sources,
135 implicit_include_directories: false,
136 include_directories: root_inc,
137 dependencies: deps,
138 install: true,
139 install_dir: get_option('bindir')
140)
141
142executable(
143 'setsensor',
144 setsensor_sources,
145 implicit_include_directories: true,
146 dependencies: deps,
147 install: true,
148 install_dir: get_option('bindir')
149)
150
151if not get_option('tests').disabled()
152 subdir('test')
153endif