IntelCPUSensor: Use libpeci when communicating via peci-legacy
When using peci-legacy the general approach is to use libpeci as
the middleware to communicate with peci core from userspace.
Integrate libpeci with IntelCPUSensor and use library functions to issue
peci commands where necessary.
Tested: hwmons are succesfully created in the same way
they were created using ioctl.
Change-Id: I4ecd70e604d447a4066dc5fb8d902992cb97cadf
Signed-off-by: Oleksandr Shulzhenko <oleksandr.shulzhenko.viktorovych@intel.com>
diff --git a/src/meson.build b/src/meson.build
index 665517a..0adbabc 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -60,6 +60,17 @@
peci_incdirs = ['../include']
endif
+if get_option('intel-cpu').enabled()
+ peci_dep = meson.get_compiler('cpp').find_library('libpeci', required : false)
+ if not peci_dep.found()
+ cmake = import('cmake')
+ opt = cmake.subproject_options()
+ opt.append_compile_args('c', '-Wno-pedantic')
+ peci_proj = cmake.subproject('libpeci', options : opt)
+ peci_dep = peci_proj.dependency('peci')
+ endif
+endif
+
if get_option('adc').enabled()
executable(
'adcsensor',
@@ -86,6 +97,7 @@
gpiodcxx,
thresholds_dep,
utils_dep,
+ peci_dep,
],
include_directories: peci_incdirs,
install: true,