From 05b02d6b3e2c3621e620a467effa22818541cbdc Mon Sep 17 00:00:00 2001 From: Erwin Coumans Date: Thu, 22 Feb 2018 09:08:10 -0800 Subject: [PATCH] fix glx include --- build3/findOpenGLGlewGlut.lua | 17 +++++++++++++---- build3/premake4.lua | 6 ++++++ examples/OpenGLWindow/X11OpenGLWindow.cpp | 2 +- 3 files changed, 20 insertions(+), 5 deletions(-) diff --git a/build3/findOpenGLGlewGlut.lua b/build3/findOpenGLGlewGlut.lua index 230424021..4e44e0556 100644 --- a/build3/findOpenGLGlewGlut.lua +++ b/build3/findOpenGLGlewGlut.lua @@ -63,13 +63,22 @@ if os.is("Linux") then configuration{"Linux"} - print("Using glad and dynamic loading of glx functions") - defines { "GLEW_STATIC","GLEW_DYNAMIC_LOAD_ALL_GLX_FUNCTIONS=1"} + if _OPTIONS["enable_system_glx"] then --# and (os.isdir("/usr/include") and os.isfile("/usr/include/GL/glx.h")) then + links{"X11","pthread"} + print("Using system GL/glx.h") + else + print("Using glad_glx") + defines { "GLEW_DYNAMIC_LOAD_ALL_GLX_FUNCTIONS=1"} + files { + projectRootDir .. "examples/ThirdPartyLibs/glad/glad_glx.c"} + end + + print("Using glad and dynamic loading of GL functions") + defines { "GLEW_STATIC"} includedirs { projectRootDir .. "examples/ThirdPartyLibs/glad" } - files { projectRootDir .. "examples/ThirdPartyLibs/glad/glad.c", - projectRootDir .. "examples/ThirdPartyLibs/glad/glad_glx.c"} + files { projectRootDir .. "examples/ThirdPartyLibs/glad/glad.c"} links {"dl"} end diff --git a/build3/premake4.lua b/build3/premake4.lua index e0aa42acd..a39e926e5 100644 --- a/build3/premake4.lua +++ b/build3/premake4.lua @@ -28,6 +28,12 @@ description = "Enable iOS target (requires xcode4)" } + newoption + { + trigger = "enable_system_glx", + description = "Try to link against system glx instead of using glad_glx (default)" + } + newoption { trigger = "enable_system_opengl", diff --git a/examples/OpenGLWindow/X11OpenGLWindow.cpp b/examples/OpenGLWindow/X11OpenGLWindow.cpp index 72d7b4589..3fcb51454 100644 --- a/examples/OpenGLWindow/X11OpenGLWindow.cpp +++ b/examples/OpenGLWindow/X11OpenGLWindow.cpp @@ -15,7 +15,7 @@ #ifdef GLEW_DYNAMIC_LOAD_ALL_GLX_FUNCTIONS #include "glad/glad_glx.h" #else -#include "GL/glx.h" +#include #endif // GLEW_DYNAMIC_LOAD_ALL_GLX_FUNCTIONS #include