From 94f85114c5f24910e551620a4f461d18b502b917 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?J=C3=B3zef=20Kucia?= Date: Tue, 21 Aug 2018 18:08:03 +0200 Subject: [PATCH] build: Make libxcb optional. MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Signed-off-by: Józef Kucia Signed-off-by: Henri Verbeet Signed-off-by: Alexandre Julliard --- configure.ac | 19 ++++++++++++++----- libs/vkd3d-utils/vkd3d_utils_main.c | 2 ++ libs/vkd3d-utils/vkd3d_utils_private.h | 16 +++++++++------- 3 files changed, 25 insertions(+), 12 deletions(-) diff --git a/configure.ac b/configure.ac index ddc6c972..b5123b8d 100644 --- a/configure.ac +++ b/configure.ac @@ -8,6 +8,7 @@ AC_CONFIG_HEADERS(include/config.h) AC_ARG_VAR([WIDL], [widl IDL compiler]) AC_ARG_VAR([CROSSCC32], [32-bit Windows cross compiler]) AC_ARG_VAR([CROSSCC64], [64-bit Windows cross compiler]) +AC_ARG_WITH([xcb], AS_HELP_STRING([--with-xcb], [Build with XCB library (default: test)])) AC_ARG_WITH([spirv-tools], AS_HELP_STRING([--with-spirv-tools], [Build with SPIRV-Tools library (default: disabled)])) AC_ARG_ENABLE([demos], AS_HELP_STRING([--enable-demos], [Build demo programs (default: disabled)])) @@ -80,13 +81,17 @@ AC_CHECK_LIB([vulkan], [vkGetInstanceProcAddr], [VULKAN_LIBS="-lvulkan"], [AC_MSG_ERROR([libvulkan not found.])]) -HAVE_SPIRV_TOOLS=no AS_IF([test "x$with_spirv_tools" = "xyes"], [PKG_CHECK_MODULES([SPIRV_TOOLS], [SPIRV-Tools-shared], - [AC_DEFINE([HAVE_SPIRV_TOOLS], [1], [Define to 1 if you have SPIRV-Tools.]) - HAVE_SPIRV_TOOLS=yes])]) + [AC_DEFINE([HAVE_SPIRV_TOOLS], [1], [Define to 1 if you have SPIRV-Tools.])])], + [with_spirv_tools=no]) -PKG_CHECK_MODULES([XCB], [xcb xcb-keysyms]) +HAVE_XCB=no +AS_IF([test "x$with_xcb" != "xno"], + [PKG_CHECK_MODULES([XCB], [xcb xcb-keysyms], + [AC_DEFINE([HAVE_XCB], [1], [Define to 1 if you have libxcb.]) + HAVE_XCB=yes], + [HAVE_XCB=no])]) dnl Check for functions VKD3D_CHECK_FUNC([HAVE_BUILTIN_CLZ], [__builtin_clz], [__builtin_clz(0)]) @@ -96,7 +101,10 @@ VKD3D_CHECK_FUNC([HAVE_SYNC_SUB_AND_FETCH], [__sync_sub_and_fetch], [__sync_sub_ VKD3D_CHECK_PTHREAD_SETNAME_NP +dnl Makefiles AS_IF([test "x$enable_demos" != "xyes"], [enable_demos=no]) +AS_IF([test "x$enable_demos" = "xyes" -a "x$HAVE_XCB" != "xyes"], + [AC_MSG_ERROR([libxcb is required for demos.])]) AM_CONDITIONAL([BUILD_DEMOS], [test "x$enable_demos" = "xyes"]) AM_CONDITIONAL([HAVE_WIDL], [test "x$WIDL" != "xno"]) AM_CONDITIONAL([HAVE_CROSSTARGET32], [test "x$CROSSTARGET32" != "xno"]) @@ -112,7 +120,8 @@ AS_IF([test "x$CROSSTARGET32" != "xno" -o "x$CROSSTARGET64" != "xno"], AS_ECHO([" Configuration summary for $PACKAGE $VERSION - Have SPIRV-Tools: ${HAVE_SPIRV_TOOLS} + Have XCB: ${HAVE_XCB} + Have SPIRV-Tools: ${with_spirv_tools} Building demos: ${enable_demos} diff --git a/libs/vkd3d-utils/vkd3d_utils_main.c b/libs/vkd3d-utils/vkd3d_utils_main.c index 2c4d89a7..8c250378 100644 --- a/libs/vkd3d-utils/vkd3d_utils_main.c +++ b/libs/vkd3d-utils/vkd3d_utils_main.c @@ -34,7 +34,9 @@ HRESULT WINAPI D3D12CreateDevice(IUnknown *adapter, static const char * const instance_extensions[] = { VK_KHR_SURFACE_EXTENSION_NAME, +#ifdef HAVE_XCB VK_KHR_XCB_SURFACE_EXTENSION_NAME, +#endif }; static const char * const device_extensions[] = { diff --git a/libs/vkd3d-utils/vkd3d_utils_private.h b/libs/vkd3d-utils/vkd3d_utils_private.h index 6aa0df6e..55d5300d 100644 --- a/libs/vkd3d-utils/vkd3d_utils_private.h +++ b/libs/vkd3d-utils/vkd3d_utils_private.h @@ -19,16 +19,18 @@ #ifndef __VKD3D_UTILS_PRIVATE_H #define __VKD3D_UTILS_PRIVATE_H -#define VK_NO_PROTOTYPES -#define VK_USE_PLATFORM_XCB_KHR - -#include -#include +#include "vkd3d_memory.h" +#include #define COBJMACROS #define NONAMELESSUNION -#include "vkd3d_memory.h" -#include "vkd3d_utils.h" +#define VK_NO_PROTOTYPES +#ifdef HAVE_XCB +# define VK_USE_PLATFORM_XCB_KHR +#endif + +#include +#include struct vkd3d_event {