Commit 1e6c10f4 authored by Chia-I Wu's avatar Chia-I Wu

egl: Use SConscript for Windows build.

Fix several portability issues and add SConscript for Windows build.
parent 0d820fc2
...@@ -49,7 +49,7 @@ else: ...@@ -49,7 +49,7 @@ else:
opts = Variables('config.py') opts = Variables('config.py')
common.AddOptions(opts) common.AddOptions(opts)
opts.Add(ListVariable('statetrackers', 'state trackers to build', default_statetrackers, 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, opts.Add(ListVariable('drivers', 'pipe drivers to build', default_drivers,
['softpipe', 'failover', 'svga', 'i915', 'i965', 'trace', 'r300', 'r600', 'identity', 'llvmpipe', 'nouveau', 'nv50', 'nvfx'])) ['softpipe', 'failover', 'svga', 'i915', 'i965', 'trace', 'r300', 'r600', 'identity', 'llvmpipe', 'nouveau', 'nv50', 'nvfx']))
opts.Add(ListVariable('winsys', 'winsys drivers to build', default_winsys, opts.Add(ListVariable('winsys', 'winsys drivers to build', default_winsys,
......
...@@ -3,6 +3,9 @@ Import('*') ...@@ -3,6 +3,9 @@ Import('*')
SConscript('glsl/SConscript') SConscript('glsl/SConscript')
SConscript('mapi/glapi/SConscript') SConscript('mapi/glapi/SConscript')
if 'egl' in env['statetrackers']:
SConscript('egl/main/SConscript')
if 'mesa' in env['statetrackers']: if 'mesa' in env['statetrackers']:
SConscript('mesa/SConscript') SConscript('mesa/SConscript')
......
#######################################################################
# 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')
...@@ -56,6 +56,8 @@ ...@@ -56,6 +56,8 @@
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include <string.h> #include <string.h>
#include "eglstring.h"
#include "eglcontext.h" #include "eglcontext.h"
#include "egldisplay.h" #include "egldisplay.h"
#include "egltypedefs.h" #include "egltypedefs.h"
...@@ -284,7 +286,7 @@ eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor) ...@@ -284,7 +286,7 @@ eglInitialize(EGLDisplay dpy, EGLint *major, EGLint *minor)
disp->APImajor = major_int; disp->APImajor = major_int;
disp->APIminor = minor_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); "%d.%d (%s)", major_int, minor_int, drv->Name);
/* limit to APIs supported by core */ /* limit to APIs supported by core */
......
...@@ -7,6 +7,8 @@ ...@@ -7,6 +7,8 @@
#include <string.h> #include <string.h>
#include <stdio.h> #include <stdio.h>
#include <stdlib.h> #include <stdlib.h>
#include "eglstring.h"
#include "eglconfig.h" #include "eglconfig.h"
#include "eglcontext.h" #include "eglcontext.h"
#include "egldefines.h" #include "egldefines.h"
...@@ -36,8 +38,8 @@ ...@@ -36,8 +38,8 @@
/* XXX Need to decide how to do dynamic name lookup on Windows */ /* XXX Need to decide how to do dynamic name lookup on Windows */
static const char DefaultDriverNames[] = { static const char *DefaultDriverNames[] = {
"TBD", "egl_gdi_swrast"
}; };
typedef HMODULE lib_handle; typedef HMODULE lib_handle;
...@@ -411,7 +413,7 @@ _eglGetSearchPath(void) ...@@ -411,7 +413,7 @@ _eglGetSearchPath(void)
#endif /* _EGL_PLATFORM_POSIX */ #endif /* _EGL_PLATFORM_POSIX */
if (p) { if (p) {
ret = snprintf(buffer, sizeof(buffer), ret = _eglsnprintf(buffer, sizeof(buffer),
"%s:%s", p, _EGL_DRIVER_SEARCH_DIR); "%s:%s", p, _EGL_DRIVER_SEARCH_DIR);
if (ret > 0 && ret < sizeof(buffer)) if (ret > 0 && ret < sizeof(buffer))
search_path = buffer; search_path = buffer;
...@@ -483,7 +485,7 @@ _eglPreloadDisplayDrivers(void) ...@@ -483,7 +485,7 @@ _eglPreloadDisplayDrivers(void)
if (!dpy || !dpy[0]) if (!dpy || !dpy[0])
return EGL_FALSE; 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)) if (ret < 0 || ret >= sizeof(prefix))
return EGL_FALSE; return EGL_FALSE;
......
...@@ -11,6 +11,7 @@ ...@@ -11,6 +11,7 @@
#include <string.h> #include <string.h>
#include "egllog.h" #include "egllog.h"
#include "eglstring.h"
#include "eglmutex.h" #include "eglmutex.h"
#define MAXSTRING 1000 #define MAXSTRING 1000
...@@ -116,7 +117,7 @@ _eglInitLogger(void) ...@@ -116,7 +117,7 @@ _eglInitLogger(void)
log_env = getenv("EGL_LOG_LEVEL"); log_env = getenv("EGL_LOG_LEVEL");
if (log_env) { if (log_env) {
for (i = 0; level_strings[i]; i++) { 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; level = i;
break; break;
} }
......
...@@ -45,7 +45,7 @@ static EGLint ...@@ -45,7 +45,7 @@ static EGLint
_eglAppendExtension(char **str, const char *ext) _eglAppendExtension(char **str, const char *ext)
{ {
char *s = *str; char *s = *str;
EGLint len = strlen(ext); size_t len = strlen(ext);
if (s) { if (s) {
memcpy(s, ext, len); memcpy(s, ext, len);
...@@ -58,7 +58,7 @@ _eglAppendExtension(char **str, const char *ext) ...@@ -58,7 +58,7 @@ _eglAppendExtension(char **str, const char *ext)
len++; len++;
} }
return len; return (EGLint) len;
} }
......
...@@ -11,7 +11,7 @@ char * ...@@ -11,7 +11,7 @@ char *
_eglstrdup(const char *s) _eglstrdup(const char *s)
{ {
if (s) { if (s) {
int l = strlen(s); size_t l = strlen(s);
char *s2 = malloc(l + 1); char *s2 = malloc(l + 1);
if (s2) if (s2)
strcpy(s2, s); strcpy(s2, s);
......
#ifndef EGLSTRING_INCLUDED #ifndef EGLSTRING_INCLUDED
#define 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 * extern char *
_eglstrdup(const char *s); _eglstrdup(const char *s);
......
...@@ -3,15 +3,16 @@ Import('*') ...@@ -3,15 +3,16 @@ Import('*')
# Compatibility with old build scripts: # Compatibility with old build scripts:
# #
if 'xlib' in env['winsys']: if 'mesa' in env['statetrackers']:
SConscript([ if 'xlib' in env['winsys']:
'libgl-xlib/SConscript', SConscript([
]) 'libgl-xlib/SConscript',
])
if 'gdi' in env['winsys']: if 'gdi' in env['winsys']:
SConscript([ SConscript([
'libgl-gdi/SConscript', 'libgl-gdi/SConscript',
]) ])
if not 'graw-xlib' in env['targets'] and not env['msvc']: if not 'graw-xlib' in env['targets'] and not env['msvc']:
# XXX: disable until MSVC can link correctly # XXX: disable until MSVC can link correctly
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment