diff options
author | Emmanuele Bassi <ebassi@gnome.org> | 2018-02-05 11:42:02 +0000 |
---|---|---|
committer | Emmanuele Bassi <ebassi@gnome.org> | 2018-02-05 14:01:59 +0000 |
commit | 3b0e6720af4b92d900f0ee2dd8937b360ffbf052 (patch) | |
tree | a55760a678db9352d288629d3b3af181bb9191d0 /meson.build | |
parent | bfcb9780791c4ca00b054874c03d9a3722771ea8 (diff) | |
download | gtk+-3b0e6720af4b92d900f0ee2dd8937b360ffbf052.tar.gz |
build: Use pkg-config to find Vulkan
The standard Vulkan SDK ships with a pkg-config file, like a modern
library should.
We should fall back to finding the library and header only for platforms
where pkg-config is not really a thing.
Based on a patch by: Daniel Stone <daniels@collabora.com>
https://bugzilla.gnome.org/show_bug.cgi?id=793181
Diffstat (limited to 'meson.build')
-rw-r--r-- | meson.build | 40 |
1 files changed, 26 insertions, 14 deletions
diff --git a/meson.build b/meson.build index 1b46d3eacd..d7e7a72bde 100644 --- a/meson.build +++ b/meson.build @@ -550,27 +550,35 @@ endif # Check for Vulkan support # 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 +vulkan_pkg_found = false +vulkan_dep = [] enable_vulkan = get_option('enable-vulkan') -if enable_vulkan != 'no' - 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') +if enable_vulkan == 'no' + message('Vulkan support explicitly disabled') +else + vulkan_dep = dependency('vulkan', required: false) + if vulkan_dep.found() have_vulkan = true - pc_gdk_extra_libs += ['-l@0@'.format(vulkan_libname)] - elif enable_vulkan == 'yes' + vulkan_pkg_found = true + else + if cc.get_id() == 'msvc' + vulkan_libname = 'vulkan-1' + else + vulkan_libname = 'vulkan' + endif + vulkan_dep = 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 += ['-l@0@'.format(vulkan_libname)] + endif + endif + if enable_vulkan == 'yes' and not have_vulkan error('Vulkan support not found, but was explicitly requested.') endif -else - message('Vulkan support explicitly disabled') endif + if cloudproviders_enabled cloudproviders_dep = dependency('cloudproviders', required: true) if cloudproviders_dep.found() @@ -624,6 +632,10 @@ if cairogobj_pkg_found gdk_packages += ' '.join([ ' cairo-gobject', cairo_req ]) endif +if vulkan_pkg_found + gdk_packages += 'vulkan' +endif + pkgconf.set('GDK_PACKAGES', gdk_packages) pkgconf.set('GSK_PACKAGES', ' '.join([ 'graphene-gobject-1.0', graphene_req ])) |