[Mesa-dev] [PATCH 2/3] meson: Add lmsensors support

Eric Engestrom eric.engestrom at imgtec.com
Wed Nov 29 14:41:32 UTC 2017


On Tuesday, 2017-11-28 16:56:38 -0800, Dylan Baker wrote:
> Signed-off-by: Dylan Baker <dylanx.c.baker at intel.com>
> ---
>  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 e3c201d7b87..e797f04eade 100644
> --- a/meson.build
> +++ b/meson.build
> @@ -919,6 +919,17 @@ endif
>  if get_option('gallium-extra-hud')
>    pre_args += '-DHAVE_GALLIUM_EXTRA_HUD=1'
>  endif
> +_sensors = get_option('lmsensors')
> +if _sensors == 'auto'
> +  dep_lmsensors = cc.find_library('libsensors', required : false)
> +  if dep_lmsensors.found()
> +    pre_args += '-DHAVE_LIBSENSORS=1'
> +  endif
> +elif _sensors == 'true'
> +  dep_lmsensors = cc.find_library('libsensors')
> +  pre_args += '-DHAVE_LIBSENSORS=1'
> +endif

I'd write it like this maybe?

  _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
  endif

With or without my suggestion, this series is:
Reviewed-by: Eric Engestrom <eric.engestrom at imgtec.com>

(and this series made me look at these two macros in gallium/hud,
I'll send a patch to s/#if/#ifdef/ them in a minute)

> +
>  
>  # TODO: nine
>  
> 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 b9c5e47d197..d7ac128cb4f 100644
> --- a/src/gallium/drivers/etnaviv/meson.build
> +++ b/src/gallium/drivers/etnaviv/meson.build
> @@ -92,6 +92,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.15.0
> 
> _______________________________________________
> mesa-dev mailing list
> mesa-dev at lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/mesa-dev


More information about the mesa-dev mailing list