Add x11/wayland feature switches, rename 'use_xnvctrl' to 'with_xnvctrl'

This commit is contained in:
Danilo Spinella 2020-02-11 22:29:29 +01:00 committed by jackun
parent 59113b3ae2
commit 0373383581
No known key found for this signature in database
GPG Key ID: 119DB3F1D05A9ED3
3 changed files with 14 additions and 9 deletions

View File

@ -92,20 +92,23 @@ endforeach
vulkan_wsi_args = [] vulkan_wsi_args = []
vulkan_wsi_deps = [] vulkan_wsi_deps = []
with_platform_x11 = true dep_x11 = dependency('x11', required: get_option('with_x11'))
with_platform_wayland = false dep_wayland_client = dependency('wayland-client',
required: get_option('with_wayland'), version : '>=1.11')
if with_platform_x11 if dep_x11.found()
dep_x11 = dependency('x11')
vulkan_wsi_args += ['-DVK_USE_PLATFORM_XLIB_KHR'] vulkan_wsi_args += ['-DVK_USE_PLATFORM_XLIB_KHR']
vulkan_wsi_deps += dep_x11 vulkan_wsi_deps += dep_x11
endif endif
if with_platform_wayland if dep_wayland_client.found()
dep_wayland_client = dependency('wayland-client', version : '>=1.11')
vulkan_wsi_args += ['-DVK_USE_PLATFORM_WAYLAND_KHR'] vulkan_wsi_args += ['-DVK_USE_PLATFORM_WAYLAND_KHR']
vulkan_wsi_deps += dep_wayland_client vulkan_wsi_deps += dep_wayland_client
endif 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 = [ inc_common = [
include_directories('include'), include_directories('include'),
] ]

View File

@ -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('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('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('include_doc', type : 'boolean', value : true, description: 'Include the example config')
option('use_xnvctrl', type : 'feature', value : 'enabled', description: 'Enable XNVCtrl support') 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')

View File

@ -63,7 +63,7 @@ opengl_files = files(
'gl/gl3w/GL/gl3w.c', 'gl/gl3w/GL/gl3w.c',
) )
if get_option('use_xnvctrl').enabled() if get_option('with_xnvctrl').enabled()
pre_args += '-DHAVE_XNVCTRL' pre_args += '-DHAVE_XNVCTRL'
vklayer_files += files( vklayer_files += files(
'loaders/loader_nvctrl.cpp', 'loaders/loader_nvctrl.cpp',
@ -132,4 +132,4 @@ if get_option('include_doc')
install_dir : join_paths(get_option('datadir'), 'doc', 'mangohud'), install_dir : join_paths(get_option('datadir'), 'doc', 'mangohud'),
rename : ['MangoHud.conf.example'] rename : ['MangoHud.conf.example']
) )
endif endif