meson.build: Fix Vulkan library detection on Visual Studio

The Vulkan .lib file that is supplied by the LunarG Vulkan SDK is
vulkan-1.lib, not vulkan.lib, so make sure we look for the right
libraries when building on Visual Studio (I am not sure whether the
LunarG SDK will work for MinGW/mingw-w64 builds, as only Visual Studio
.lib files are provided).

Note that this will require one to set LIB and INCLUDE appropriately to
find the Vulkan .lib and header files, and possibly PATH if one's video
drivers do not contain the Vulkan runtime DLL.

https://bugzilla.gnome.org/show_bug.cgi?id=785210
This commit is contained in:
Chun-wei Fan 2017-08-11 17:05:55 +08:00
parent 60297b9fc7
commit 0b783f6750

View File

@ -508,12 +508,19 @@ cdata.set('HAVE_GIO_UNIX', giounix_dep.found())
# TODO: move to gsk subfolder maybe? Or will it be used elsewhere too?
have_vulkan = false
vulkan_lib = []
if cc.get_id() == 'msvc'
vulkan_libname = 'vulkan-1'
else
vulkan_libname = 'vulkan'
endif
enable_vulkan = get_option('enable-vulkan')
if enable_vulkan != 'no'
vulkan_lib = cc.find_library('vulkan', required: false)
vulkan_lib = cc.find_library(vulkan_libname, required: false)
if vulkan_lib.found() and cc.has_function('vkCreateInstance', dependencies: vulkan_lib) and cc.has_header('vulkan/vulkan.h')
have_vulkan = true
pc_gdk_extra_libs += ['-lvulkan']
pc_gdk_extra_libs += ['-l@0@'.format(vulkan_libname)]
elif enable_vulkan == 'yes'
error('Vulkan support not found, but was explicitly requested.')
endif