From 2dd3ea21825f3eaa22ffe6993ab31d96740c46c4 Mon Sep 17 00:00:00 2001 From: Bill Currie Date: Sat, 25 Mar 2023 18:39:46 +0900 Subject: [PATCH] [vulkan] Respect the VULKAN_SDK environment variable Thanks to Peter for the report and help in getting it working (I hope I got all the changes right). --- Makefile.am | 2 +- config.d/vulkan.m4 | 13 ++++++++++++- libs/video/renderer/vulkan/vkgen/Makemodule.am | 3 +-- 3 files changed, 14 insertions(+), 4 deletions(-) diff --git a/Makefile.am b/Makefile.am index 48847d9d2..5276ac096 100644 --- a/Makefile.am +++ b/Makefile.am @@ -26,7 +26,7 @@ NOCONV_DIST= \ BUILT_SOURCES = $(top_srcdir)/.version #AM_CFLAGS= @PREFER_NON_PIC@ -AM_CPPFLAGS= -I$(top_srcdir)/include $(PTHREAD_CFLAGS) $(FNM_FLAGS) $(NCURSES_CFLAGS) $(FREETYPE_CFLAGS) $(HARFBUZZ_CFLAGS) +AM_CPPFLAGS= -I$(top_srcdir)/include $(PTHREAD_CFLAGS) $(FNM_FLAGS) $(NCURSES_CFLAGS) $(FREETYPE_CFLAGS) $(HARFBUZZ_CFLAGS) $(VULKAN_CPPFLAGS) common_ldflags= -export-dynamic @STATIC@ @PTHREAD_LDFLAGS@ diff --git a/config.d/vulkan.m4 b/config.d/vulkan.m4 index e4a26581b..e175d1528 100644 --- a/config.d/vulkan.m4 +++ b/config.d/vulkan.m4 @@ -9,13 +9,24 @@ if test "x$HAVE_VULKAN" != xno; then LDFLAGS="$LDFLAGS -L$VULKAN_SDK/lib" glslangvalidator="$VULKAN_SDK/bin/glslangValidator" ], [glslangvalidator="glslangValidator"]) - AC_CHECK_HEADER([vulkan/vulkan.h], [HAVE_VULKAN=yes], [HAVE_VULKAN=no]) + AC_CHECK_HEADER([vulkan/vulkan.h], [ + HAVE_VULKAN=yes + AS_IF([test x"$VULKAN_SDK" != x], [ + VULKAN_CPPFLAGS="-I$VULKAN_SDK/include" + VULKAN_QCFLAGS="-I$VULKAN_SDK/include" + VULKAN_LDFLAGS="-L$VULKAN_SDK/lib" + ],[ + VULKAN_QCFLAGS="-I/usr/include" + ]) + ], [HAVE_VULKAN=no]) CPPFLAGS="$save_CPPFLAGS" fi if test "x$HAVE_VULKAN" = xyes; then AC_DEFINE([HAVE_VULKAN], [1], [Define if yhou have the Vulkan libs]) fi AC_SUBST(VULKAN_LIBS) +AC_SUBST(VULKAN_CPPFLAGS) +AC_SUBST(VULKAN_QCFLAGS) AC_SUBST(GLSLANGVALIDATOR, [$glslangvalidator]) AM_CONDITIONAL(X11_VULKAN, test "x$HAVE_VULKAN" = "xyes") diff --git a/libs/video/renderer/vulkan/vkgen/Makemodule.am b/libs/video/renderer/vulkan/vkgen/Makemodule.am index 8d8e11f4e..a96a627bc 100644 --- a/libs/video/renderer/vulkan/vkgen/Makemodule.am +++ b/libs/video/renderer/vulkan/vkgen/Makemodule.am @@ -21,8 +21,7 @@ vkgen_dat_src= \ libs/video/renderer/vulkan/vkgen/vktype.r \ libs/video/renderer/vulkan/vkgen/vulkan.r -VKGENUSRINC = /usr/include -VKGENFLAGS = -I$(top_srcdir)/libs/video/renderer/vulkan/vkgen -I$(VKGENUSRINC) +VKGENFLAGS = -I$(top_srcdir)/libs/video/renderer/vulkan/vkgen $(VULKAN_QCFLAGS) vkgen_dat_SOURCES=$(vkgen_dat_src) vkgen_obj=$(vkgen_dat_SOURCES:.r=.o)