summaryrefslogtreecommitdiff
path: root/drivers/gl_context
diff options
context:
space:
mode:
authorRémi Verschelde <rverschelde@gmail.com>2016-06-07 19:59:33 +0200
committerRémi Verschelde <rverschelde@gmail.com>2016-06-08 00:16:27 +0200
commit768e9252714b57421b5c893a8258469a14630a30 (patch)
treeab2299c7533af5dc207b2c43d14a3c242cd0974b /drivers/gl_context
parent4c658dc52303ece088a245ede2835a68b78530b2 (diff)
GLEW: Define static + enabled and includes via SCons
This allows us not to have to hack our definitions in the upstream files, making it easier to upgrade to newer versions in the future. For the include paths to work, the headers are moved to a GL subfolder to match their upstream location.
Diffstat (limited to 'drivers/gl_context')
-rw-r--r--drivers/gl_context/GL/glew.h (renamed from drivers/gl_context/glew.h)2
-rw-r--r--drivers/gl_context/GL/glxew.h (renamed from drivers/gl_context/glxew.h)4
-rw-r--r--drivers/gl_context/GL/wglew.h (renamed from drivers/gl_context/wglew.h)2
-rw-r--r--drivers/gl_context/SCsub10
-rw-r--r--drivers/gl_context/glew.c9
5 files changed, 12 insertions, 15 deletions
diff --git a/drivers/gl_context/glew.h b/drivers/gl_context/GL/glew.h
index 39c8162dea..3de3e86a4f 100644
--- a/drivers/gl_context/glew.h
+++ b/drivers/gl_context/GL/glew.h
@@ -80,8 +80,6 @@
#define __glew_h__
#define __GLEW_H__
-#define GLEW_STATIC
-
#if defined(__gl_h_) || defined(__GL_H__) || defined(__X_GL_H)
#error gl.h included before glew.h
#endif
diff --git a/drivers/gl_context/glxew.h b/drivers/gl_context/GL/glxew.h
index 985c946d83..ab4d03da41 100644
--- a/drivers/gl_context/glxew.h
+++ b/drivers/gl_context/GL/glxew.h
@@ -80,8 +80,6 @@
#define __glxew_h__
#define __GLXEW_H__
-#define GLEW_STATIC
-
#ifdef __glxext_h_
#error glxext.h included before glxew.h
#endif
@@ -99,7 +97,7 @@
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <X11/Xmd.h>
-#include "drivers/gl_context/glew.h"
+#include <GL/glew.h>
#ifdef __cplusplus
extern "C" {
diff --git a/drivers/gl_context/wglew.h b/drivers/gl_context/GL/wglew.h
index a6722748be..ae06b0cba9 100644
--- a/drivers/gl_context/wglew.h
+++ b/drivers/gl_context/GL/wglew.h
@@ -56,8 +56,6 @@
#define __wglew_h__
#define __WGLEW_H__
-#define GLEW_STATIC
-
#ifdef __wglext_h_
#error wglext.h included before wglew.h
#endif
diff --git a/drivers/gl_context/SCsub b/drivers/gl_context/SCsub
index 7cf8629fe1..dac27c0125 100644
--- a/drivers/gl_context/SCsub
+++ b/drivers/gl_context/SCsub
@@ -1,5 +1,11 @@
Import('env')
-Export('env');
env.add_source_files(env.drivers_sources,"*.cpp")
-env.add_source_files(env.drivers_sources,"*.c")
+
+if (env.get('glew') == 'yes'):
+ env.add_source_files(env.drivers_sources,"glew.c")
+ env.Append(CPPFLAGS = ['-DGLEW_ENABLED'])
+ env.Append(CPPFLAGS = ['-DGLEW_STATIC'])
+ env.Append(CPPPATH = ['.'])
+
+Export('env')
diff --git a/drivers/gl_context/glew.c b/drivers/gl_context/glew.c
index fc0aa28a72..df824f3c71 100644
--- a/drivers/gl_context/glew.c
+++ b/drivers/gl_context/glew.c
@@ -1,4 +1,3 @@
-#ifdef GLEW_ENABLED
/*
** The OpenGL Extension Wrangler Library
** Copyright (C) 2002-2008, Milan Ikits <milan ikits[]ieee org>
@@ -30,11 +29,11 @@
** THE POSSIBILITY OF SUCH DAMAGE.
*/
-#include "drivers/gl_context/glew.h"
+#include <GL/glew.h>
#if defined(_WIN32)
-# include "drivers/gl_context/wglew.h"
+# include <GL/wglew.h>
#elif !defined(__APPLE__) || defined(GLEW_APPLE_GLX)
-# include "drivers/gl_context/glxew.h"
+# include <GL/glxew.h>
#endif
/*
@@ -15156,5 +15155,3 @@ GLboolean glxewIsSupported (const char* name)
}
#endif /* _WIN32 */
-
-#endif