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:
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,
......
......@@ -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')
......
#######################################################################
# 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 @@
#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 */
......
......@@ -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;
......
......@@ -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;
}
......
......@@ -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;
}
......
......@@ -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);
......
#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);
......
......@@ -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
......
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