Fix several portability issues and add SConscript for Windows build.
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,
SConscript('glsl/SConscript')
SConscript('mapi/glapi/SConscript')
+if 'egl' in env['statetrackers']:
+ SConscript('egl/main/SConscript')
+
if 'mesa' in env['statetrackers']:
SConscript('mesa/SConscript')
--- /dev/null
+#######################################################################
+# 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')
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
+
+#include "eglstring.h"
#include "eglcontext.h"
#include "egldisplay.h"
#include "egltypedefs.h"
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 */
#include <string.h>
#include <stdio.h>
#include <stdlib.h>
+
+#include "eglstring.h"
#include "eglconfig.h"
#include "eglcontext.h"
#include "egldefines.h"
/* 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;
#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;
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;
#include <string.h>
#include "egllog.h"
+#include "eglstring.h"
#include "eglmutex.h"
#define MAXSTRING 1000
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;
}
_eglAppendExtension(char **str, const char *ext)
{
char *s = *str;
- EGLint len = strlen(ext);
+ size_t len = strlen(ext);
if (s) {
memcpy(s, ext, len);
len++;
}
- return len;
+ return (EGLint) len;
}
_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);
#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);
# 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