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