Harvey.Wu | b1225b2 | 2022-10-28 17:42:07 +0800 | [diff] [blame] | 1 | project( |
| 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 | |
| 12 | conf_data = configuration_data() |
| 13 | |
| 14 | bindir = get_option('prefix') / get_option('bindir') |
| 15 | conf_data.set('BINDIR', bindir) |
| 16 | conf_data.set('SYSTEMD_TARGET', get_option('systemd_target')) |
| 17 | conf_data.set('STRICT_FAILSAFE_PWM', get_option('strict-failsafe-pwm')) |
| 18 | |
| 19 | configure_file(output: 'config.h', |
| 20 | configuration: conf_data |
| 21 | ) |
| 22 | |
| 23 | if 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] |
| 32 | else |
| 33 | dynamic_linker = [] |
| 34 | endif |
| 35 | |
| 36 | systemd = dependency('systemd') |
| 37 | systemd_system_unit_dir = systemd.get_variable( |
Patrick Williams | 7e6130a | 2023-04-12 08:01:19 -0500 | [diff] [blame] | 38 | 'systemdsystemunitdir', |
Harvey.Wu | b1225b2 | 2022-10-28 17:42:07 +0800 | [diff] [blame] | 39 | pkgconfig_define: ['prefix', get_option('prefix')]) |
| 40 | |
| 41 | configure_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 | |
| 47 | phosphor_dbus_interfaces_dep = dependency('phosphor-dbus-interfaces') |
| 48 | phosphor_logging_dep = dependency('phosphor-logging') |
| 49 | sdbusplus_dep = dependency('sdbusplus') |
| 50 | libsystemd_dep = dependency('libsystemd') |
| 51 | ipmid_dep = dependency('libipmid') |
| 52 | |
| 53 | deps = [ |
| 54 | phosphor_dbus_interfaces_dep, |
| 55 | phosphor_logging_dep, |
| 56 | sdbusplus_dep, |
| 57 | libsystemd_dep, |
| 58 | ipmid_dep, |
| 59 | ] |
| 60 | |
| 61 | root_inc = include_directories( |
| 62 | '.', |
| 63 | 'buildjson', |
| 64 | 'dbus', |
| 65 | 'errors', |
| 66 | 'experiments', |
| 67 | 'ipmi', |
| 68 | 'notimpl', |
| 69 | 'pid', |
| 70 | 'sensors', |
| 71 | 'sysfs', |
| 72 | ) |
| 73 | |
| 74 | setsensor_sources = [ |
| 75 | 'setsensor.cpp' |
| 76 | ] |
| 77 | |
| 78 | libswampd_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 Lehan | de74542 | 2020-11-07 02:14:09 -0800 | [diff] [blame] | 100 | 'pid/ec/logging.cpp', |
Harvey.Wu | b1225b2 | 2022-10-28 17:42:07 +0800 | [diff] [blame] | 101 | '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 | |
| 116 | libmanualcmds_sources = [ |
| 117 | 'ipmi/main_ipmi.cpp', |
| 118 | 'ipmi/manualcmds.cpp', |
| 119 | 'ipmi/dbus_mode.cpp', |
| 120 | ] |
| 121 | |
| 122 | libmanualcmds = 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 | |
| 132 | executable( |
| 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 | |
| 142 | executable( |
| 143 | 'setsensor', |
| 144 | setsensor_sources, |
| 145 | implicit_include_directories: true, |
| 146 | dependencies: deps, |
| 147 | install: true, |
| 148 | install_dir: get_option('bindir') |
| 149 | ) |
| 150 | |
| 151 | if not get_option('tests').disabled() |
| 152 | subdir('test') |
| 153 | endif |