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