[libadwaita/vulkan-dep] src/meson.build: Look for Vulkan as well




commit af59ff212f70cc5e82238eec35bcfcf0f1defecb
Author: Chun-wei Fan <fanchunwei src gnome org>
Date:   Mon Aug 15 11:37:51 2022 +0800

    src/meson.build: Look for Vulkan as well
    
    Vulkan support may have been enabled for GTK but is only pulled in with the
    GTK dependency when it is found via pkg-config, which will break the build
    if Vulkan was found via other methods, which is typical on Windows as the
    LunarG SDK sets envars instead of installing pkg-config files.
    
    This will ensure that libadwaita continues to build properly in this case
    so that the Vulkan headers can be found during the build, which are pulled in
    by the GTK headers when it is built with Vulkan support.

 src/meson.build | 13 +++++++++++++
 1 file changed, 13 insertions(+)
---
diff --git a/src/meson.build b/src/meson.build
index 54664c1e..cd622256 100644
--- a/src/meson.build
+++ b/src/meson.build
@@ -241,6 +241,15 @@ gtk_min_version = '>= 4.5.0'
 gio_dep = dependency('gio-2.0', version: glib_min_version)
 gtk_dep = dependency('gtk4', version: gtk_min_version)
 
+# Vulkan may have been enabled for GTK but it may not have
+# been found via pkg-config, and we currently don't have a
+# way to query the GTK dep to see whether Vulkan support is
+# built-in in such scenarios, ending up in build failures
+# where the Vulkan headers are not found, as the GTK headers
+# do pull in the Vulkan headers in such cases.  For the pkg-config
+# case, the GTK pkg-config files will pull in Vulkan.
+vulkan_dep = dependency('vulkan', required: false)
+
 libadwaita_deps = [
   dependency('glib-2.0', version: glib_min_version),
   dependency('fribidi'),
@@ -254,6 +263,10 @@ libadwaita_public_deps = [
   gtk_dep,
 ]
 
+if vulkan_dep.found() and vulkan_dep.type_name() != 'pkgconfig'
+  libadwaita_deps += vulkan_dep
+endif
+
 libadwaita_c_args = [
   '-DG_LOG_DOMAIN="Adwaita"',
 ]


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]