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