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 105cf32e0b)
This commit is contained in:
Camilla Löwy 2020-05-26 23:35:40 +02:00
parent 37a86f24f0
commit 78ad4e8f36

View File

@ -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__)