From a045ae3b64ffb44086cc7e29dea5b7d9e6fc2975 Mon Sep 17 00:00:00 2001 From: FlightlessMango Date: Thu, 30 Jan 2020 18:29:51 +0100 Subject: [PATCH] Don't build with nvml for non-nvidia --- src/cpu_gpu.h | 20 +++++++++++--------- src/meson.build | 8 ++++++-- 2 files changed, 17 insertions(+), 11 deletions(-) diff --git a/src/cpu_gpu.h b/src/cpu_gpu.h index eb23660f..c164babb 100644 --- a/src/cpu_gpu.h +++ b/src/cpu_gpu.h @@ -191,15 +191,17 @@ void *cpuInfo(void *){ } void *getNvidiaGpuInfo(void *){ - if (!nvmlSuccess) - checkNvidia(); - - if (nvmlSuccess){ - getNvidiaInfo(); - gpuLoad = nvidiaUtilization.gpu; - gpuLoadDisplay = gpuLoad; - gpuTemp = nvidiaTemp; - } + #ifdef HAVE_NVML + if (!nvmlSuccess) + checkNvidia(); + + if (nvmlSuccess){ + getNvidiaInfo(); + gpuLoad = nvidiaUtilization.gpu; + gpuLoadDisplay = gpuLoad; + gpuTemp = nvidiaTemp; + } + #endif pthread_detach(nvidiaSmiThread); return NULL; diff --git a/src/meson.build b/src/meson.build index b3d9a760..74730fe2 100644 --- a/src/meson.build +++ b/src/meson.build @@ -35,10 +35,14 @@ vklayer_files = files( 'overlay.cpp', 'overlay_params.c', 'font_unispace.c', - 'nvml.c', ) -dep_nvml = cc.find_library('nvidia-ml') +dep_nvml = cc.find_library('nvidia-ml', required: false) +if dep_nvml.found() + vklayer_files += 'nvml.c' + pre_args += '-DHAVE_NVML' +endif + vklayer_mesa_overlay = shared_library( 'MangoHud', util_files,