diff options
author | Chia-I Wu <[email protected]> | 2010-05-31 11:47:58 +0800 |
---|---|---|
committer | Chia-I Wu <[email protected]> | 2010-05-31 13:27:41 +0800 |
commit | 1e6c10f4be9e36cc052a6b47fb2cb1eae60caa00 (patch) | |
tree | c9c14d9520bb4fce651652be3dba76342df46817 /src | |
parent | 0d820fc203e06d5264430de7262d2c35a8ff1e75 (diff) |
egl: Use SConscript for Windows build.
Fix several portability issues and add SConscript for Windows build.
Diffstat (limited to 'src')
-rw-r--r-- | src/SConscript | 3 | ||||
-rw-r--r-- | src/egl/main/SConscript | 49 | ||||
-rw-r--r-- | src/egl/main/eglapi.c | 4 | ||||
-rw-r--r-- | src/egl/main/egldriver.c | 10 | ||||
-rw-r--r-- | src/egl/main/egllog.c | 3 | ||||
-rw-r--r-- | src/egl/main/eglmisc.c | 4 | ||||
-rw-r--r-- | src/egl/main/eglstring.c | 2 | ||||
-rw-r--r-- | src/egl/main/eglstring.h | 9 | ||||
-rw-r--r-- | src/gallium/targets/SConscript | 17 |
9 files changed, 84 insertions, 17 deletions
diff --git a/src/SConscript b/src/SConscript index b72491d96f2..b8a0024812b 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 00000000000..f3fe9966b3e --- /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 1a533e0880b..9912043e06c 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 2f42e64fbe0..631a8710ac5 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 11a9bf7275c..8f3bae2243d 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 e62a9e7de8c..4652969659b 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 ba7406158c4..e4ab19136fb 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 10468636e87..bebb758dd82 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 9077cbf6a45..519dbff7fd3 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 |