From 03733835813768e5adf56e88241c0c4f91dd7267 Mon Sep 17 00:00:00 2001 From: Danilo Spinella Date: Tue, 11 Feb 2020 22:29:29 +0100 Subject: [PATCH] Add x11/wayland feature switches, rename 'use_xnvctrl' to 'with_xnvctrl' --- meson.build | 15 +++++++++------ meson_options.txt | 4 +++- src/meson.build | 4 ++-- 3 files changed, 14 insertions(+), 9 deletions(-) diff --git a/meson.build b/meson.build index d3820e25..31985b4f 100644 --- a/meson.build +++ b/meson.build @@ -92,20 +92,23 @@ endforeach vulkan_wsi_args = [] vulkan_wsi_deps = [] -with_platform_x11 = true -with_platform_wayland = false +dep_x11 = dependency('x11', required: get_option('with_x11')) +dep_wayland_client = dependency('wayland-client', + required: get_option('with_wayland'), version : '>=1.11') -if with_platform_x11 - dep_x11 = dependency('x11') +if dep_x11.found() vulkan_wsi_args += ['-DVK_USE_PLATFORM_XLIB_KHR'] vulkan_wsi_deps += dep_x11 endif -if with_platform_wayland - dep_wayland_client = dependency('wayland-client', version : '>=1.11') +if dep_wayland_client.found() vulkan_wsi_args += ['-DVK_USE_PLATFORM_WAYLAND_KHR'] vulkan_wsi_deps += dep_wayland_client endif +if not dep_x11.found() and not dep_wayland_client.found() + error('At least one of "with_x11" and "with_wayland" should be enabled') +endif + inc_common = [ include_directories('include'), ] diff --git a/meson_options.txt b/meson_options.txt index b183bfe1..9c634547 100644 --- a/meson_options.txt +++ b/meson_options.txt @@ -3,4 +3,6 @@ option('use_system_vulkan', type : 'feature', value : 'disabled', description: ' 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') -option('use_xnvctrl', type : 'feature', value : 'enabled', description: 'Enable XNVCtrl support') \ No newline at end of file +option('with_xnvctrl', type : 'feature', value : 'enabled', description: 'Enable XNVCtrl support') +option('with_x11', type : 'feature', value : 'enabled') +option('with_wayland', type : 'feature', value : 'disabled') diff --git a/src/meson.build b/src/meson.build index f80a4312..0893c276 100644 --- a/src/meson.build +++ b/src/meson.build @@ -63,7 +63,7 @@ opengl_files = files( 'gl/gl3w/GL/gl3w.c', ) -if get_option('use_xnvctrl').enabled() +if get_option('with_xnvctrl').enabled() pre_args += '-DHAVE_XNVCTRL' vklayer_files += files( 'loaders/loader_nvctrl.cpp', @@ -132,4 +132,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