Mesa (master): egl: Use SConscript for Windows build.

Chia-I Wu olv at kemper.freedesktop.org
Mon May 31 05:28:54 UTC 2010


Module: Mesa
Branch: master
Commit: 1e6c10f4be9e36cc052a6b47fb2cb1eae60caa00
URL:    http://cgit.freedesktop.org/mesa/mesa/commit/?id=1e6c10f4be9e36cc052a6b47fb2cb1eae60caa00

Author: Chia-I Wu <olv at lunarg.com>
Date:   Mon May 31 11:47:58 2010 +0800

egl: Use SConscript for Windows build.

Fix several portability issues and add SConscript for Windows build.

---

 SConstruct                     |    2 +-
 src/SConscript                 |    3 ++
 src/egl/main/SConscript        |   49 ++++++++++++++++++++++++++++++++++++++++
 src/egl/main/eglapi.c          |    4 ++-
 src/egl/main/egldriver.c       |   10 +++++---
 src/egl/main/egllog.c          |    3 +-
 src/egl/main/eglmisc.c         |    4 +-
 src/egl/main/eglstring.c       |    2 +-
 src/egl/main/eglstring.h       |    9 +++++++
 src/gallium/targets/SConscript |   17 +++++++------
 10 files changed, 85 insertions(+), 18 deletions(-)

diff --git a/SConstruct b/SConstruct
index 1d41fc5..1c8a00c 100644
--- a/SConstruct
+++ b/SConstruct
@@ -49,7 +49,7 @@ else:
 opts = Variables('config.py')
 common.AddOptions(opts)
 opts.Add(ListVariable('statetrackers', 'state trackers to build', default_statetrackers,
-                     ['mesa', 'python', 'xorg']))
+                     ['mesa', 'python', 'xorg', 'egl']))
 opts.Add(ListVariable('drivers', 'pipe drivers to build', default_drivers,
                      ['softpipe', 'failover', 'svga', 'i915', 'i965', 'trace', 'r300', 'r600', 'identity', 'llvmpipe', 'nouveau', 'nv50', 'nvfx']))
 opts.Add(ListVariable('winsys', 'winsys drivers to build', default_winsys,
diff --git a/src/SConscript b/src/SConscript
index b72491d..b8a0024 100644
--- a/src/SConscript
+++ b/src/SConscript
@@ -3,6 +3,9 @@ Import('*')
 SConscript('glsl/SConscript')
 SConscript('mapi/glapi/SConscript')
 
+if 'egl' in env['statetrackers']:
+    SConscript('egl/main/SConscript')
+
 if 'mesa' in env['statetrackers']:
     SConscript('mesa/SConscript')
 
diff --git a/src/egl/main/SConscript b/src/egl/main/SConscript
new file mode 100644
index 0000000..f3fe996
--- /dev/null
+++ b/src/egl/main/SConscript
@@ -0,0 +1,49 @@
+#######################################################################
+# SConscript for EGL
+
+
+Import('*')
+
+if env['platform'] != 'winddk':
+
+	env = env.Clone()
+
+	env.Append(CPPDEFINES = [
+		'_EGL_DEFAULT_DISPLAY=\\"gdi\\"',
+		'_EGL_DRIVER_SEARCH_DIR=\\"\\"',
+		'_EGL_PLATFORM_WINDOWS',
+		'KHRONOS_DLL_EXPORTS',
+	])
+
+	env.Append(CPPPATH = [
+		'#/include',
+	])
+
+	egl_sources = [
+		'eglapi.c',
+		'eglconfig.c',
+		'eglconfigutil.c',
+		'eglcontext.c',
+		'eglcurrent.c',
+		'egldisplay.c',
+		'egldriver.c',
+		'eglglobals.c',
+		'eglimage.c',
+		'egllog.c',
+		'eglmisc.c',
+		'eglmode.c',
+		'eglscreen.c',
+		'eglstring.c',
+		'eglsurface.c',
+	]
+
+	egl = env.SharedLibrary(
+		target = 'libEGL',
+		source = egl_sources,
+	)
+
+	env.InstallSharedLibrary(egl, version=(1, 4, 0))
+
+	egl = [env.FindIxes(egl, 'LIBPREFIX', 'LIBSUFFIX')]
+
+	Export('egl')
diff --git a/src/egl/main/eglapi.c b/src/egl/main/eglapi.c
index 1a533e0..9912043 100644
--- a/src/egl/main/eglapi.c
+++ b/src/egl/main/eglapi.c
@@ -56,6 +56,8 @@
 #include <stdio.h>
 #include <stdlib.h>
 #include <string.h>
+
+#include "eglstring.h"
 #include "eglcontext.h"
 #include "egldisplay.h"
 #include "egltypedefs.h"
@@ -284,7 +286,7 @@ eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
 
       disp->APImajor = major_int;
       disp->APIminor = minor_int;
-      snprintf(disp->Version, sizeof(disp->Version),
+      _eglsnprintf(disp->Version, sizeof(disp->Version),
                "%d.%d (%s)", major_int, minor_int, drv->Name);
 
       /* limit to APIs supported by core */
diff --git a/src/egl/main/egldriver.c b/src/egl/main/egldriver.c
index 2f42e64..631a871 100644
--- a/src/egl/main/egldriver.c
+++ b/src/egl/main/egldriver.c
@@ -7,6 +7,8 @@
 #include <string.h>
 #include <stdio.h>
 #include <stdlib.h>
+
+#include "eglstring.h"
 #include "eglconfig.h"
 #include "eglcontext.h"
 #include "egldefines.h"
@@ -36,8 +38,8 @@
 
 
 /* XXX Need to decide how to do dynamic name lookup on Windows */
-static const char DefaultDriverNames[] = {
-   "TBD",
+static const char *DefaultDriverNames[] = {
+   "egl_gdi_swrast"
 };
 
 typedef HMODULE lib_handle;
@@ -411,7 +413,7 @@ _eglGetSearchPath(void)
 #endif /* _EGL_PLATFORM_POSIX */
 
       if (p) {
-         ret = snprintf(buffer, sizeof(buffer),
+         ret = _eglsnprintf(buffer, sizeof(buffer),
                "%s:%s", p, _EGL_DRIVER_SEARCH_DIR);
          if (ret > 0 && ret < sizeof(buffer))
             search_path = buffer;
@@ -483,7 +485,7 @@ _eglPreloadDisplayDrivers(void)
    if (!dpy || !dpy[0])
       return EGL_FALSE;
 
-   ret = snprintf(prefix, sizeof(prefix), "egl_%s_", dpy);
+   ret = _eglsnprintf(prefix, sizeof(prefix), "egl_%s_", dpy);
    if (ret < 0 || ret >= sizeof(prefix))
       return EGL_FALSE;
 
diff --git a/src/egl/main/egllog.c b/src/egl/main/egllog.c
index 11a9bf7..8f3bae2 100644
--- a/src/egl/main/egllog.c
+++ b/src/egl/main/egllog.c
@@ -11,6 +11,7 @@
 #include <string.h>
 
 #include "egllog.h"
+#include "eglstring.h"
 #include "eglmutex.h"
 
 #define MAXSTRING 1000
@@ -116,7 +117,7 @@ _eglInitLogger(void)
    log_env = getenv("EGL_LOG_LEVEL");
    if (log_env) {
       for (i = 0; level_strings[i]; i++) {
-         if (strcasecmp(log_env, level_strings[i]) == 0) {
+         if (_eglstrcasecmp(log_env, level_strings[i]) == 0) {
             level = i;
             break;
          }
diff --git a/src/egl/main/eglmisc.c b/src/egl/main/eglmisc.c
index e62a9e7..4652969 100644
--- a/src/egl/main/eglmisc.c
+++ b/src/egl/main/eglmisc.c
@@ -45,7 +45,7 @@ static EGLint
 _eglAppendExtension(char **str, const char *ext)
 {
    char *s = *str;
-   EGLint len = strlen(ext);
+   size_t len = strlen(ext);
 
    if (s) {
       memcpy(s, ext, len);
@@ -58,7 +58,7 @@ _eglAppendExtension(char **str, const char *ext)
       len++;
    }
 
-   return len;
+   return (EGLint) len;
 }
 
 
diff --git a/src/egl/main/eglstring.c b/src/egl/main/eglstring.c
index ba74061..e4ab191 100644
--- a/src/egl/main/eglstring.c
+++ b/src/egl/main/eglstring.c
@@ -11,7 +11,7 @@ char *
 _eglstrdup(const char *s)
 {
    if (s) {
-      int l = strlen(s);
+      size_t l = strlen(s);
       char *s2 = malloc(l + 1);
       if (s2)
          strcpy(s2, s);
diff --git a/src/egl/main/eglstring.h b/src/egl/main/eglstring.h
index 1046863..bebb758 100644
--- a/src/egl/main/eglstring.h
+++ b/src/egl/main/eglstring.h
@@ -1,6 +1,15 @@
 #ifndef EGLSTRING_INCLUDED
 #define EGLSTRING_INCLUDED
 
+#include <string.h>
+
+#ifdef _EGL_PLATFORM_WINDOWS
+#define _eglstrcasecmp _stricmp
+#define _eglsnprintf _snprintf
+#else
+#define _eglstrcasecmp strcasecmp
+#define _eglsnprintf snprintf
+#endif
 
 extern char *
 _eglstrdup(const char *s);
diff --git a/src/gallium/targets/SConscript b/src/gallium/targets/SConscript
index 9077cbf..519dbff 100644
--- a/src/gallium/targets/SConscript
+++ b/src/gallium/targets/SConscript
@@ -3,15 +3,16 @@ Import('*')
 	
 # Compatibility with old build scripts:
 #
-if 'xlib' in env['winsys']:
-	SConscript([
-		'libgl-xlib/SConscript',
-	])
+if 'mesa' in env['statetrackers']:
+	if 'xlib' in env['winsys']:
+		SConscript([
+			'libgl-xlib/SConscript',
+		])
 
-if 'gdi' in env['winsys']:
-	SConscript([
-		'libgl-gdi/SConscript',
-	])
+	if 'gdi' in env['winsys']:
+		SConscript([
+			'libgl-gdi/SConscript',
+		])
 
 if not 'graw-xlib' in env['targets'] and not env['msvc']:
         # XXX: disable until MSVC can link correctly




More information about the mesa-commit mailing list