From faaec5166675fc695220c0d84c716b5b2a7dbb0a Mon Sep 17 00:00:00 2001 From: kimci86 Date: Mon, 27 Jun 2022 22:59:11 +0200 Subject: [PATCH] Fix compilation on Linux with SFML_OPENGL_ES option --- src/SFML/Window/CMakeLists.txt | 29 ++++++++++++++++------------- src/SFML/Window/DRM/DRMContext.cpp | 1 - src/SFML/Window/DRM/DRMContext.hpp | 1 - src/SFML/Window/EglContext.hpp | 1 + src/SFML/Window/GlContext.cpp | 12 ++++++------ 5 files changed, 23 insertions(+), 21 deletions(-) diff --git a/src/SFML/Window/CMakeLists.txt b/src/SFML/Window/CMakeLists.txt index ebfa23d5..b6f117e3 100644 --- a/src/SFML/Window/CMakeLists.txt +++ b/src/SFML/Window/CMakeLists.txt @@ -91,18 +91,9 @@ if(SFML_OS_WINDOWS) # make sure that we use the Unicode version of the Win API functions add_definitions(-DUNICODE -D_UNICODE) elseif(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OS_OPENBSD OR SFML_OS_NETBSD) - if(SFML_OPENGL_ES) - set(PLATFORM_SRC - ${PLATFORM_SRC} - ${SRCROOT}/EGLCheck.cpp - ${SRCROOT}/EGLCheck.hpp - ${SRCROOT}/EglContext.cpp - ${SRCROOT}/EglContext.hpp - ) - elseif(SFML_USE_DRM) + if(SFML_USE_DRM) add_definitions(-DSFML_USE_DRM) set(PLATFORM_SRC - ${PLATFORM_SRC} ${SRCROOT}/EGLCheck.cpp ${SRCROOT}/EGLCheck.hpp ${SRCROOT}/DRM/CursorImpl.hpp @@ -121,7 +112,6 @@ elseif(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OS_OPENBSD OR SFML_OS_NETBSD) ) else() set(PLATFORM_SRC - ${PLATFORM_SRC} ${SRCROOT}/Unix/CursorImpl.hpp ${SRCROOT}/Unix/CursorImpl.cpp ${SRCROOT}/Unix/ClipboardImpl.hpp @@ -132,14 +122,27 @@ elseif(SFML_OS_LINUX OR SFML_OS_FREEBSD OR SFML_OS_OPENBSD OR SFML_OS_NETBSD) ${SRCROOT}/Unix/SensorImpl.hpp ${SRCROOT}/Unix/Display.cpp ${SRCROOT}/Unix/Display.hpp - ${SRCROOT}/Unix/GlxContext.cpp - ${SRCROOT}/Unix/GlxContext.hpp ${SRCROOT}/Unix/VideoModeImpl.cpp ${SRCROOT}/Unix/VulkanImplX11.cpp ${SRCROOT}/Unix/VulkanImplX11.hpp ${SRCROOT}/Unix/WindowImplX11.cpp ${SRCROOT}/Unix/WindowImplX11.hpp ) + if(SFML_OPENGL_ES) + set(PLATFORM_SRC + ${PLATFORM_SRC} + ${SRCROOT}/EGLCheck.cpp + ${SRCROOT}/EGLCheck.hpp + ${SRCROOT}/EglContext.cpp + ${SRCROOT}/EglContext.hpp + ) + else() + set(PLATFORM_SRC + ${PLATFORM_SRC} + ${SRCROOT}/Unix/GlxContext.cpp + ${SRCROOT}/Unix/GlxContext.hpp + ) + endif() endif() if(SFML_OS_LINUX) set(PLATFORM_SRC diff --git a/src/SFML/Window/DRM/DRMContext.cpp b/src/SFML/Window/DRM/DRMContext.cpp index 7936aaaa..d7340941 100644 --- a/src/SFML/Window/DRM/DRMContext.cpp +++ b/src/SFML/Window/DRM/DRMContext.cpp @@ -28,7 +28,6 @@ //////////////////////////////////////////////////////////// #include #include -#include #include #include #include diff --git a/src/SFML/Window/DRM/DRMContext.hpp b/src/SFML/Window/DRM/DRMContext.hpp index dbd2ca0f..f302a0a7 100644 --- a/src/SFML/Window/DRM/DRMContext.hpp +++ b/src/SFML/Window/DRM/DRMContext.hpp @@ -33,7 +33,6 @@ #include #include #include -#include #include #include #include diff --git a/src/SFML/Window/EglContext.hpp b/src/SFML/Window/EglContext.hpp index 7945c2ee..c02e89d4 100644 --- a/src/SFML/Window/EglContext.hpp +++ b/src/SFML/Window/EglContext.hpp @@ -36,6 +36,7 @@ #include #if defined(SFML_SYSTEM_LINUX) && !defined(SFML_USE_DRM) #include + #include #endif namespace sf diff --git a/src/SFML/Window/GlContext.cpp b/src/SFML/Window/GlContext.cpp index 2ad165ef..5e897b89 100644 --- a/src/SFML/Window/GlContext.cpp +++ b/src/SFML/Window/GlContext.cpp @@ -59,16 +59,16 @@ #elif defined(SFML_SYSTEM_LINUX) || defined(SFML_SYSTEM_FREEBSD) || defined(SFML_SYSTEM_OPENBSD) || defined(SFML_SYSTEM_NETBSD) - #if defined(SFML_OPENGL_ES) - - #include - typedef sf::priv::EglContext ContextType; - - #elif defined(SFML_USE_DRM) + #if defined(SFML_USE_DRM) #include typedef sf::priv::DRMContext ContextType; + #elif defined(SFML_OPENGL_ES) + + #include + typedef sf::priv::EglContext ContextType; + #else #include