From 5e71efef44b992b5d70bbc1872ff230ae211141d Mon Sep 17 00:00:00 2001 From: Dylan Baker Date: Tue, 28 Nov 2017 16:42:37 -0800 Subject: [PATCH] meson: Add lmsensors support v2: - Make -Dlmsensors=false work - Simplify auto and true cases Signed-off-by: Dylan Baker Reviewed-by: Eric Engestrom --- meson.build | 11 +++++++++++ meson_options.txt | 7 +++++++ src/gallium/drivers/etnaviv/meson.build | 2 +- src/gallium/drivers/freedreno/meson.build | 1 + src/gallium/drivers/nouveau/meson.build | 2 +- src/gallium/drivers/r300/meson.build | 4 +++- src/gallium/targets/dri/meson.build | 2 +- 7 files changed, 25 insertions(+), 4 deletions(-) diff --git a/meson.build b/meson.build index 2115871931d..65c6b98609e 100644 --- a/meson.build +++ b/meson.build @@ -926,6 +926,17 @@ if get_option('gallium-extra-hud') pre_args += '-DHAVE_GALLIUM_EXTRA_HUD=1' endif +_sensors = get_option('lmsensors') +if _sensors != 'false' + dep_lmsensors = cc.find_library('libsensors', required : _sensors == 'true') + if dep_lmsensors.found() + pre_args += '-DHAVE_LIBSENSORS=1' + endif +else + dep_lmsensors = [] +endif + + # TODO: nine # TODO: clover diff --git a/meson_options.txt b/meson_options.txt index fb1b63331ca..bcd63cc374f 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -157,6 +157,13 @@ option( choices : ['auto', 'true', 'false'], description : 'Use libunwind for stack-traces' ) +option( + 'lmsensors', + type : 'combo', + value : 'auto', + choices : ['auto', 'true', 'false'], + description : 'Enable HUD lmsensors support.' +) option( 'build-tests', type : 'boolean', diff --git a/src/gallium/drivers/etnaviv/meson.build b/src/gallium/drivers/etnaviv/meson.build index ac0231ea0e8..01cb45240fc 100644 --- a/src/gallium/drivers/etnaviv/meson.build +++ b/src/gallium/drivers/etnaviv/meson.build @@ -97,6 +97,6 @@ etnaviv_compiler = executable( 'etnaviv_compiler_cmdline.c', include_directories : [inc_include, inc_src, inc_gallium, inc_gallium_aux], link_with : [libmesa_util, libgallium, libetnaviv], - dependencies : dep_libdrm_etnaviv, + dependencies : [dep_libdrm_etnaviv, dep_lmsensors], build_by_default : false, ) diff --git a/src/gallium/drivers/freedreno/meson.build b/src/gallium/drivers/freedreno/meson.build index 01b5836be29..8dd2cc2e8fe 100644 --- a/src/gallium/drivers/freedreno/meson.build +++ b/src/gallium/drivers/freedreno/meson.build @@ -218,6 +218,7 @@ ir3_compiler = executable( dep_libdrm, dep_libdrm_freedreno, dependency('threads'), + dep_lmsensors, ], link_with : [ libfreedreno, diff --git a/src/gallium/drivers/nouveau/meson.build b/src/gallium/drivers/nouveau/meson.build index 59fecfc5255..b62494b2966 100644 --- a/src/gallium/drivers/nouveau/meson.build +++ b/src/gallium/drivers/nouveau/meson.build @@ -217,7 +217,7 @@ nouveau_compiler = executable( 'nouveau_compiler', 'nouveau_compiler.c', include_directories : [inc_src, inc_include, inc_gallium, inc_gallium_aux], - dependencies : [dep_libdrm, dep_libdrm_nouveau], + dependencies : [dep_libdrm, dep_libdrm_nouveau, dep_lmsensors], link_with : [libnouveau, libgallium, libmesa_util], build_by_default : false, ) diff --git a/src/gallium/drivers/r300/meson.build b/src/gallium/drivers/r300/meson.build index 0d525d8d1b3..dac0bc833e5 100644 --- a/src/gallium/drivers/r300/meson.build +++ b/src/gallium/drivers/r300/meson.build @@ -150,7 +150,9 @@ if with_tests include_directories('compiler'), ], link_with : [libr300, libgallium, libmesa_util], - dependencies : [dep_m, dep_clock, dep_dl, dep_thread, dep_unwind], + dependencies : [ + dep_m, dep_clock, dep_dl, dep_thread, dep_unwind, dep_lmsensors, + ], ) ) endif diff --git a/src/gallium/targets/dri/meson.build b/src/gallium/targets/dri/meson.build index 323b337266f..c23b47216ea 100644 --- a/src/gallium/targets/dri/meson.build +++ b/src/gallium/targets/dri/meson.build @@ -163,7 +163,7 @@ libgallium_dri = shared_library( ], dependencies : [ gallium_dri_depends, dep_selinux, dep_expat, dep_libdrm, dep_llvm, - dep_thread, + dep_thread, dep_lmsensors, ], ) -- 2.30.2