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,