From f860418e7e51e8918f998426087db375cff99806 Mon Sep 17 00:00:00 2001 From: Stephan Lachnit Date: Fri, 10 Apr 2020 11:33:58 +0200 Subject: [PATCH] Allow system NVML to be used Signed-off-by: Stephan Lachnit --- meson.build | 6 ++++++ meson_options.txt | 1 + src/loaders/loader_nvml.h | 4 ++++ src/meson.build | 3 ++- 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/meson.build b/meson.build index 2a171328..2685a8b2 100644 --- a/meson.build +++ b/meson.build @@ -212,5 +212,11 @@ util_files = files( 'src/mesa/util/os_time.c', ) +if get_option('use_system_nvml') + cpp_nvml_args = '-DUSE_SYSTEM_NVML' +else + cpp_nvml_args = [] +endif + subdir('modules/ImGui') subdir('src') diff --git a/meson_options.txt b/meson_options.txt index f3166bf4..fdd0c439 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -1,5 +1,6 @@ option('glibcxx_asserts', type : 'boolean', value : false) option('use_system_vulkan', type : 'feature', value : 'disabled', description: 'Use system vulkan headers instead of the provided ones') +option('use_system_nvml', type : 'boolean', value : false, description : 'Use system nvml headers instead of the provided ones') option('mangohud_prefix', type : 'string', value : '', description: 'Add prefix to cross-compiled library, like "lib32-".') option('append_libdir_mangohud', type : 'boolean', value : true, description: 'Append "mangohud" to libdir path or not.') option('include_doc', type : 'boolean', value : true, description: 'Include the example config') diff --git a/src/loaders/loader_nvml.h b/src/loaders/loader_nvml.h index dfb65d26..eeeeff7b 100644 --- a/src/loaders/loader_nvml.h +++ b/src/loaders/loader_nvml.h @@ -4,7 +4,11 @@ #ifndef LIBRARY_LOADER_NVML_H #define LIBRARY_LOADER_NVML_H +#if USE_SYSTEM_NVML +#include +#else #include "nvml.h" +#endif #define LIBRARY_LOADER_NVML_H_DLOPEN #include diff --git a/src/meson.build b/src/meson.build index 157a7dc1..aba4f65b 100644 --- a/src/meson.build +++ b/src/meson.build @@ -82,6 +82,7 @@ vklayer_mesa_overlay = shared_library( cpp_args : [ pre_args, cpp_vis_args, + cpp_nvml_args, vulkan_wsi_args ], dependencies : [ @@ -123,4 +124,4 @@ if get_option('include_doc') install_dir : join_paths(get_option('datadir'), 'doc', 'mangohud'), rename : ['MangoHud.conf.example'] ) -endif \ No newline at end of file +endif