From 78ad4e8f3652b5483c5de868a4ce581ac534d80e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Camilla=20L=C3=B6wy?= Date: Tue, 26 May 2020 23:35:40 +0200 Subject: [PATCH] Fix desktop GL header not always being suppressed If an OpenGL ES header or the glcorearb header is included before the GLFW header (with no options defined), the legacy OpenGL header will be implicitly included and the compilation will fail. This disables the default behavior if we detect any known OpenGL, OpenGL ES or extension loader inclusion guard macro. Sources: - Khronos headers - Windows SDK - MinGW - MinGW-w64 - flextGL - glad - glad2 - GLEW - Galogen - gl3w - GLXW - glbinding - Epoxy - Glatter - glLoadGen - Regal - GLee - OpenGL.framework - Debian - FreeBSD - ANGLE - SwiftShader Related to #1695. (cherry picked from commit 105cf32e0b05e207d4cd5efa462887569ca2116a) --- include/GLFW/glfw3.h | 17 ++++++++++++++++- 1 file changed, 16 insertions(+), 1 deletion(-) diff --git a/include/GLFW/glfw3.h b/include/GLFW/glfw3.h index 88364263..bf854b07 100644 --- a/include/GLFW/glfw3.h +++ b/include/GLFW/glfw3.h @@ -193,7 +193,22 @@ extern "C" { #endif /*__APPLE__*/ -#elif !defined(GLFW_INCLUDE_NONE) +#elif !defined(GLFW_INCLUDE_NONE) && \ + !defined(__gl_h_) && \ + !defined(__gles1_gl_h_) && \ + !defined(__gles2_gl2_h_) && \ + !defined(__gles2_gl3_h_) && \ + !defined(__gles2_gl31_h_) && \ + !defined(__gles2_gl32_h_) && \ + !defined(__gl_glcorearb_h_) && \ + !defined(__gl2_h_) /*legacy*/ && \ + !defined(__gl3_h_) /*legacy*/ && \ + !defined(__gl31_h_) /*legacy*/ && \ + !defined(__gl32_h_) /*legacy*/ && \ + !defined(__glcorearb_h_) /*legacy*/ && \ + !defined(__GL_H__) /*non-standard*/ && \ + !defined(__gltypes_h_) /*non-standard*/ && \ + !defined(__glee_h_) /*non-standard*/ #if defined(__APPLE__)