From bb770af3a59e5935c108c05ee45490fc5668d4a3 Mon Sep 17 00:00:00 2001
From: Chia-I Wu <olv@lunarg.com>
Date: Fri, 14 Jan 2011 17:50:29 +0800
Subject: scons: Add support for GLES.

GLES can be enabled by running scons with

  $ scons gles=yes

When gles=yes is given, the build is changed in three ways.  First,
libmesa.a will be built with FEATURE_ES1 and FEATURE_ES2.  This makes
DRI drivers and libEGL support and advertise GLES support.  Second, GLES
libraries will be created.  They are libGLESv1_CM, libGLESv2, and
libglapi.  Last, libGL or opengl32 will link to libglapi.  This change
is required as _glapi_* will be declared as __declspec(dllimport) in
libmesa.a on windows.  libmesa.a expects those symbols to be defined in
another DLL.  Due to this change to GL, GLES support is marked
experimental.

Note that GLES requires libxml2-python to generate some of its sources.
---
 src/mapi/glapi/SConscript | 5 +++++
 src/mapi/glapi/glapi.h    | 5 -----
 2 files changed, 5 insertions(+), 5 deletions(-)

(limited to 'src/mapi/glapi')

diff --git a/src/mapi/glapi/SConscript b/src/mapi/glapi/SConscript
index 4057991ec8..276b216024 100644
--- a/src/mapi/glapi/SConscript
+++ b/src/mapi/glapi/SConscript
@@ -17,6 +17,11 @@ if env['platform'] != 'winddk':
             '_GDI32_', # prevent gl* being declared __declspec(dllimport) in MS headers
             'BUILD_GL32', # declare gl* as __declspec(dllexport) in Mesa headers
         ])
+        if env['gles']:
+            env.Append(CPPDEFINES = ['_GLAPI_DLL_EXPORTS'])
+        else:
+            # prevent _glapi_* from being declared __declspec(dllimport)
+            env.Append(CPPDEFINES = ['_GLAPI_NO_EXPORTS'])
 
     env.Append(CPPPATH = [
         '#/src/mapi',
diff --git a/src/mapi/glapi/glapi.h b/src/mapi/glapi/glapi.h
index 8cca50487c..e909cf892a 100644
--- a/src/mapi/glapi/glapi.h
+++ b/src/mapi/glapi/glapi.h
@@ -45,11 +45,6 @@
 #define _GLAPI_H
 
 
-/* opengl.dll does not export _glapi_* */
-#if defined(_WIN32)
-#define _GLAPI_NO_EXPORTS
-#endif
-
 #ifdef _GLAPI_NO_EXPORTS
 #  define _GLAPI_EXPORT
 #else /* _GLAPI_NO_EXPORTS */
-- 
cgit v1.2.3