1project( 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( 38 pkgconfig: 'systemdsystemunitdir', 39 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', 100 'pid/ec/stepwise.cpp', 101 'pid/fancontroller.cpp', 102 'pid/thermalcontroller.cpp', 103 'pid/pidcontroller.cpp', 104 'pid/stepwisecontroller.cpp', 105 'pid/builder.cpp', 106 'pid/buildjson.cpp', 107 'pid/zone.cpp', 108 'pid/util.cpp', 109 'pid/pidloop.cpp', 110 'pid/tuning.cpp', 111 'buildjson/buildjson.cpp', 112 'experiments/drive.cpp', 113] 114 115libmanualcmds_sources = [ 116 'ipmi/main_ipmi.cpp', 117 'ipmi/manualcmds.cpp', 118 'ipmi/dbus_mode.cpp', 119] 120 121libmanualcmds = library( 122 'manualcmds', 123 libmanualcmds_sources, 124 implicit_include_directories: false, 125 dependencies: deps, 126 version: meson.project_version(), 127 override_options: ['b_lundef=false'], 128 install: true, 129 install_dir: get_option('libdir') / 'ipmid-providers') 130 131executable( 132 'swampd', 133 libswampd_sources, 134 implicit_include_directories: false, 135 include_directories: root_inc, 136 dependencies: deps, 137 install: true, 138 install_dir: get_option('bindir') 139) 140 141executable( 142 'setsensor', 143 setsensor_sources, 144 implicit_include_directories: true, 145 dependencies: deps, 146 install: true, 147 install_dir: get_option('bindir') 148) 149 150if not get_option('tests').disabled() 151 subdir('test') 152endif 153