From 906d5b6e3a4f7cbb239a237ca20aa71d5306a340 Mon Sep 17 00:00:00 2001 From: Eric Anholt Date: Fri, 6 Dec 2013 12:21:54 -0800 Subject: [PATCH] Conditionalize building the EGL and GLX dispatch code. --- configure.ac | 2 ++ src/Makefile.am | 12 +++++++++++- src/dispatch_common.c | 5 +++++ src/dispatch_common.h | 15 ++++++++++++++- 4 files changed, 32 insertions(+), 2 deletions(-) diff --git a/configure.ac b/configure.ac index 90c5f76..440059c 100644 --- a/configure.ac +++ b/configure.ac @@ -96,4 +96,6 @@ AC_CONFIG_FILES([ ]) AC_OUTPUT +echo " EGL: $build_egl" +echo " GLX: $build_glx" echo " PYTHON: $PYTHON" diff --git a/src/Makefile.am b/src/Makefile.am index d28eb0f..9479415 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -88,9 +88,19 @@ CLEANFILES = $(BUILT_SOURCES) libepoxy_la_SOURCES = \ dispatch_common.c \ dispatch_common.h \ - $(BUILT_SOURCES) + $(GENERATED_GL) \ + $(BUILD_GENERATED_EGL) \ + $(BUILD_GENERATED_GLX) \ $() +if BUILD_EGL +BUILD_GENERATED_EGL = $(GENERATED_EGL) +endif + +if BUILD_GLX +BUILD_GENERATED_GLX = $(GENERATED_GLX) +endif + # These are generated alongside the .c file. $(GENERATED_GL_INCLUDES): $(GENERATED_GL_SOURCE) $(GENERATED_GLX_INCLUDES): $(GENERATED_GLX_SOURCE) diff --git a/src/dispatch_common.c b/src/dispatch_common.c index 77d7979..0ce0218 100644 --- a/src/dispatch_common.c +++ b/src/dispatch_common.c @@ -95,9 +95,14 @@ #include #include #include + #include "epoxy/gl.h" +#if PLATFORM_HAS_GLX #include "epoxy/glx.h" +#endif +#if PLATFORM_HAS_EGL #include "epoxy/egl.h" +#endif #include "dispatch_common.h" struct api { diff --git a/src/dispatch_common.h b/src/dispatch_common.h index f66f165..c7b6944 100644 --- a/src/dispatch_common.h +++ b/src/dispatch_common.h @@ -22,9 +22,22 @@ */ #include + +#ifdef _WIN32 +#define PLATFORM_HAS_EGL 0 +#define PLATFORM_HAS_GLX 0 +#else +#define PLATFORM_HAS_EGL 1 +#define PLATFORM_HAS_GLX 1 +#endif + #include "epoxy/gl.h" -#include "epoxy/egl.h" +#if PLATFORM_HAS_GLX #include "epoxy/glx.h" +#endif +#if PLATFORM_HAS_EGL +#include "epoxy/egl.h" +#endif #ifndef PUBLIC # if (defined(__GNUC__) && __GNUC__ >= 4) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))