From cbdf722dd6b9e217ce2a85332cb82e7f1ad9b3aa Mon Sep 17 00:00:00 2001 From: Connor McLaughlin Date: Mon, 1 Feb 2021 01:45:30 +1000 Subject: [PATCH] GL/ContextEGL: Fix compiling with both DRM/KMS and X11 enabled --- src/common/CMakeLists.txt | 5 +++++ src/common/gl/context.cpp | 8 ++++---- 2 files changed, 9 insertions(+), 4 deletions(-) diff --git a/src/common/CMakeLists.txt b/src/common/CMakeLists.txt index e216ad60c..6766f848a 100644 --- a/src/common/CMakeLists.txt +++ b/src/common/CMakeLists.txt @@ -162,6 +162,11 @@ if(USE_EGL) gl/context_egl_x11.cpp gl/context_egl_x11.h ) + + # We set EGL_NO_X11 because otherwise X comes in with its macros and breaks + # a bunch of files from compiling, if we include the EGL headers. This just + # makes the data types opaque, we can still use it with X11 if needed. + target_compile_definitions(common PRIVATE "-DEGL_NO_X11=1") endif() if(ANDROID AND USE_EGL) target_sources(common PRIVATE diff --git a/src/common/gl/context.cpp b/src/common/gl/context.cpp index 2370f986b..d88de11e7 100644 --- a/src/common/gl/context.cpp +++ b/src/common/gl/context.cpp @@ -16,16 +16,16 @@ Log_SetChannel(GL::Context); #endif #ifdef USE_EGL -#if defined(USE_X11) || defined(USE_WAYLAND) || defined(USE_GBM) -#if defined(USE_X11) -#include "context_egl_x11.h" -#endif +#if defined(USE_WAYLAND) || defined(USE_GBM) || defined(USE_X11) #if defined(USE_WAYLAND) #include "context_egl_wayland.h" #endif #if defined(USE_GBM) #include "context_egl_gbm.h" #endif +#if defined(USE_X11) +#include "context_egl_x11.h" +#endif #elif defined(ANDROID) #include "context_egl_android.h" #else