Unite defenitions "PUBLIC" and "EPOXY_IMPORTEXPORT" and add it where appropriate. Fix tests build errors.

macos/v1.5.9
Yaron Cohen-Tal 9 years ago
parent 773dd02f59
commit 90c6158d61
  1. 5
      README.md
  2. 62
      include/epoxy/common.h
  3. 9
      include/epoxy/egl.h
  4. 10
      include/epoxy/gl.h
  5. 12
      include/epoxy/glx.h
  6. 7
      include/epoxy/wgl.h
  7. 1
      src/Makefile.am
  8. 2
      src/Makefile.vc
  9. 10
      src/dispatch_common.c
  10. 14
      src/dispatch_common.h
  11. 4
      src/dispatch_egl.c
  12. 4
      src/dispatch_glx.c
  13. 12
      src/dispatch_wgl.c
  14. 2
      src/gen_dispatch.py

@ -62,11 +62,16 @@ It should be as easy as replacing:
#include <GL/gl.h>
#include <GL/glx.h>
#include <GL/glext.h>
#include <EGL/egl.h>
#include <EGL/eglext.h>
#include <windows.h> // for WGL
with:
#include <epoxy/gl.h>
#include <epoxy/glx.h>
#include <epoxy/egl.h>
#include <epoxy/wgl.h>
As long as epoxy's headers appear first, you should be ready to go.
Additionally, some new helpers become available, so you don't have to

@ -0,0 +1,62 @@
/*
* Copyright © 2013 Intel Corporation
*
* Permission is hereby granted, free of charge, to any person obtaining a
* copy of this software and associated documentation files (the "Software"),
* to deal in the Software without restriction, including without limitation
* the rights to use, copy, modify, merge, publish, distribute, sublicense,
* and/or sell copies of the Software, and to permit persons to whom the
* Software is furnished to do so, subject to the following conditions:
*
* The above copyright notice and this permission notice (including the next
* paragraph) shall be included in all copies or substantial portions of the
* Software.
*
* THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
* IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
* FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL
* THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
* LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING
* FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS
* IN THE SOFTWARE.
*/
/** @file common.h
*
* Provides basic definitions for Epoxy. Included by all other Epoxy files.
*/
#ifndef EPOXY_COMMON_H
#define EPOXY_COMMON_H
#ifdef __cplusplus
extern "C" {
#endif
#if defined _WIN32 || defined __CYGWIN__
#ifdef EPOXY_EXPORTS
#ifdef __GNUC__
#define EPOXY_IMPORTEXPORT __attribute__ ((dllexport))
#else
#define EPOXY_IMPORTEXPORT __declspec(dllexport)
#endif
#else
#ifdef __GNUC__
#define EPOXY_IMPORTEXPORT __attribute__ ((dllimport))
#else
#define EPOXY_IMPORTEXPORT __declspec(dllimport)
#endif
#endif
#else
#if __GNUC__ >= 4
#define EPOXY_IMPORTEXPORT __attribute__ ((visibility ("default")))
#else
#define EPOXY_IMPORTEXPORT
#endif
#endif
#ifdef __cplusplus
}
#endif
#endif /* EPOXY_COMMON_H */

@ -30,12 +30,13 @@
#ifndef EPOXY_EGL_H
#define EPOXY_EGL_H
#include <epoxy/common.h>
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <stdbool.h>
#if defined(__egl_h_) || defined(__eglext_h_)
#error epoxy/egl.h must be included before (or in place of) GL/egl.h
#else
@ -45,8 +46,8 @@ extern "C" {
#include "epoxy/egl_generated.h"
PUBLIC bool epoxy_has_egl_extension(EGLDisplay dpy, const char *extension);
PUBLIC int epoxy_egl_version(EGLDisplay dpy);
EPOXY_IMPORTEXPORT bool epoxy_has_egl_extension(EGLDisplay dpy, const char *extension);
EPOXY_IMPORTEXPORT int epoxy_egl_version(EGLDisplay dpy);
#ifdef __cplusplus
} /* extern "C" */

@ -30,12 +30,13 @@
#ifndef EPOXY_GL_H
#define EPOXY_GL_H
#include <epoxy/common.h>
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <stdbool.h>
#if defined(__gl_h_) || defined(__glext_h_)
#error epoxy/gl.h must be included before (or in place of) GL/gl.h
#else
@ -51,7 +52,6 @@ extern "C" {
/* APIENTRY and GLAPIENTRY are not used on Linux or Mac. */
#define APIENTRY
#define GLAPIENTRY
#define EPOXY_IMPORTEXPORT
#define EPOXY_CALLSPEC
#define GLAPI
#define KHRONOS_APIENTRY
@ -70,10 +70,6 @@ extern "C" {
#define EPOXY_CALLSPEC __stdcall
#endif
#ifndef EPOXY_IMPORTEXPORT
#define EPOXY_IMPORTEXPORT __declspec(dllimport)
#endif
#ifndef GLAPI
#define GLAPI extern
#endif

@ -30,15 +30,15 @@
#ifndef EPOXY_GLX_H
#define EPOXY_GLX_H
#ifdef __cplusplus
extern "C" {
#endif
#include <epoxy/gl.h>
#include <X11/Xlib.h>
#include <X11/Xutil.h>
#include <stdbool.h>
#ifdef __cplusplus
extern "C" {
#endif
#if defined(GLX_H) || defined(__glxext_h_)
#error epoxy/glx.h must be included before (or in place of) GL/glx.h
#else
@ -48,8 +48,8 @@ extern "C" {
#include "epoxy/glx_generated.h"
bool epoxy_has_glx_extension(Display *dpy, int screen, const char *extension);
int epoxy_glx_version(Display *dpy, int screen);
EPOXY_IMPORTEXPORT bool epoxy_has_glx_extension(Display *dpy, int screen, const char *extension);
EPOXY_IMPORTEXPORT int epoxy_glx_version(Display *dpy, int screen);
#ifdef __cplusplus
} /* extern "C" */

@ -30,13 +30,14 @@
#ifndef EPOXY_WGL_H
#define EPOXY_WGL_H
#include <epoxy/common.h>
#include <stdbool.h>
#include <windows.h>
#ifdef __cplusplus
extern "C" {
#endif
#include <stdbool.h>
#include <windows.h>
#undef wglUseFontBitmaps
#undef wglUseFontOutlines

@ -29,6 +29,7 @@ AM_CFLAGS = \
$(VISIBILITY_CFLAGS) \
$(X11_CFLAGS) \
$(EGL_CFLAGS) \
-DEPOXY_EXPORTS \
$()
epoxyincludedir = $(includedir)/epoxy

@ -46,7 +46,7 @@ EPOXY_DLL_BASENAME = $(EPOXY_BASENAME)-vs$(VSVER)
all: $(EPOXY_DLL_BASENAME).dll
$(EPOXY_DLL_BASENAME).dll: ../$(GL_GEN_HEADER) ../$(WGL_GEN_HEADER) ../$(EGL_GEN_HEADER) $(GENERATED_GL_SOURCE) $(GENERATED_WGL_SOURCE) $(GENERATED_EGL_SOURCE) $(EPOXY_C_SRC) $(EPOXY_WGL_C_SRC) $(EPOXY_EGL_C_SRC)
$(CC) $(CFLAGS_ADD) $(CFLAGS_C99_COMPAT) $(EPOXY_C_SRC) $(EPOXY_WGL_C_SRC) $(EPOXY_EGL_C_SRC) $(GENERATED_GL_SOURCE) $(GENERATED_WGL_SOURCE) $(GENERATED_EGL_SOURCE) /I c:\opt\Imagination-3_5\PowerVR_Graphics\PowerVR_SDK\SDK_3.5\Builds\Include \
$(CC) $(CFLAGS_ADD) $(CFLAGS_C99_COMPAT) $(EPOXY_C_SRC) $(EPOXY_WGL_C_SRC) $(EPOXY_EGL_C_SRC) $(GENERATED_GL_SOURCE) $(GENERATED_WGL_SOURCE) $(GENERATED_EGL_SOURCE) /DEPOXY_EXPORTS \
/link /DLL /DEBUG $(EXTRA_LDFLAGS) /pdb:$(EPOXY_DLL_BASENAME).pdb /out:$@ /implib:$(EPOXY_BASENAME).lib
@if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2

@ -265,7 +265,7 @@ do_dlsym(void **handle, const char *lib_name, const char *name,
return result;
}
PUBLIC bool
EPOXY_IMPORTEXPORT bool
epoxy_is_desktop_gl(void)
{
const char *es_prefix = "OpenGL ES";
@ -329,7 +329,7 @@ epoxy_internal_gl_version(int error_version)
return 10 * major + minor;
}
PUBLIC int
EPOXY_IMPORTEXPORT int
epoxy_gl_version(void)
{
return epoxy_internal_gl_version(0);
@ -452,7 +452,7 @@ epoxy_current_context_is_glx(void)
* \sa epoxy_has_egl_extension()
* \sa epoxy_has_glx_extension()
*/
PUBLIC bool
EPOXY_IMPORTEXPORT bool
epoxy_has_gl_extension(const char *ext)
{
return epoxy_internal_has_gl_extension(ext, false);
@ -703,5 +703,5 @@ WRAPPER(epoxy_glEnd)(void)
#endif
}
PUBLIC PFNGLBEGINPROC epoxy_glBegin = epoxy_glBegin_wrapped;
PUBLIC PFNGLENDPROC epoxy_glEnd = epoxy_glEnd_wrapped;
EPOXY_IMPORTEXPORT PFNGLBEGINPROC epoxy_glBegin = epoxy_glBegin_wrapped;
EPOXY_IMPORTEXPORT PFNGLENDPROC epoxy_glEnd = epoxy_glEnd_wrapped;

@ -27,32 +27,18 @@
#define PLATFORM_HAS_EGL 1
#define PLATFORM_HAS_GLX 0
#define PLATFORM_HAS_WGL 1
#define EPOXY_IMPORTEXPORT __declspec(dllexport)
#elif defined(__APPLE__)
#define PLATFORM_HAS_EGL 0
#define PLATFORM_HAS_GLX 0
#define PLATFORM_HAS_WGL 0
#define EPOXY_IMPORTEXPORT
#elif defined(ANDROID)
#define PLATFORM_HAS_EGL 1
#define PLATFORM_HAS_GLX 0
#define PLATFORM_HAS_WGL 0
#define EPOXY_IMPORTEXPORT
#else
#define PLATFORM_HAS_EGL 1
#define PLATFORM_HAS_GLX 1
#define PLATFORM_HAS_WGL 0
#define EPOXY_IMPORTEXPORT
#endif
#ifndef PUBLIC
# ifdef _WIN32
# define PUBLIC __declspec(dllexport)
# elif (defined(__GNUC__) && __GNUC__ >= 4) || (defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590))
# define PUBLIC __attribute__((visibility("default")))
# else
# define PUBLIC
# endif
#endif
#if PLATFORM_HAS_WGL

@ -38,7 +38,7 @@ epoxy_conservative_egl_version(void)
return epoxy_egl_version(dpy);
}
PUBLIC int
EPOXY_IMPORTEXPORT int
epoxy_egl_version(EGLDisplay dpy)
{
int major, minor;
@ -62,7 +62,7 @@ epoxy_conservative_has_egl_extension(const char *ext)
return epoxy_has_egl_extension(dpy, ext);
}
PUBLIC bool
EPOXY_IMPORTEXPORT bool
epoxy_has_egl_extension(EGLDisplay dpy, const char *ext)
{
return epoxy_extension_in_string(eglQueryString(dpy, EGL_EXTENSIONS), ext);

@ -47,7 +47,7 @@ epoxy_conservative_glx_version(void)
return epoxy_glx_version(dpy, screen);
}
PUBLIC int
EPOXY_IMPORTEXPORT int
epoxy_glx_version(Display *dpy, int screen)
{
int server_major, server_minor;
@ -92,7 +92,7 @@ epoxy_conservative_has_glx_extension(const char *ext)
return epoxy_has_glx_extension(dpy, screen, ext);
}
PUBLIC bool
EPOXY_IMPORTEXPORT bool
epoxy_has_glx_extension(Display *dpy, int screen, const char *ext)
{
/* No, you can't just use glXGetClientString or

@ -46,7 +46,7 @@ epoxy_conservative_has_wgl_extension(const char *ext)
return epoxy_has_wgl_extension(hdc, ext);
}
PUBLIC bool
EPOXY_IMPORTEXPORT bool
epoxy_has_wgl_extension(HDC hdc, const char *ext)
{
PFNWGLGETEXTENSIONSSTRINGARBPROC getext;
@ -72,7 +72,7 @@ epoxy_has_wgl_extension(HDC hdc, const char *ext)
* table per context and reuse it when the context is made current
* again.
*/
PUBLIC void
EPOXY_IMPORTEXPORT void
epoxy_handle_external_wglMakeCurrent(void)
{
if (!first_context_current) {
@ -190,7 +190,7 @@ WRAPPER(epoxy_wglMakeAssociatedContextCurrentAMD)(HGLRC hglrc)
return ret;
}
PUBLIC PFNWGLMAKECURRENTPROC epoxy_wglMakeCurrent = epoxy_wglMakeCurrent_wrapped;
PUBLIC PFNWGLMAKECONTEXTCURRENTEXTPROC epoxy_wglMakeContextCurrentEXT = epoxy_wglMakeContextCurrentEXT_wrapped;
PUBLIC PFNWGLMAKECONTEXTCURRENTARBPROC epoxy_wglMakeContextCurrentARB = epoxy_wglMakeContextCurrentARB_wrapped;
PUBLIC PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC epoxy_wglMakeAssociatedContextCurrentEXT = epoxy_wglMakeAssociatedContextCurrentAMD_wrapped;
EPOXY_IMPORTEXPORT PFNWGLMAKECURRENTPROC epoxy_wglMakeCurrent = epoxy_wglMakeCurrent_wrapped;
EPOXY_IMPORTEXPORT PFNWGLMAKECONTEXTCURRENTEXTPROC epoxy_wglMakeContextCurrentEXT = epoxy_wglMakeContextCurrentEXT_wrapped;
EPOXY_IMPORTEXPORT PFNWGLMAKECONTEXTCURRENTARBPROC epoxy_wglMakeContextCurrentARB = epoxy_wglMakeContextCurrentARB_wrapped;
EPOXY_IMPORTEXPORT PFNWGLMAKEASSOCIATEDCONTEXTCURRENTAMDPROC epoxy_wglMakeAssociatedContextCurrentEXT = epoxy_wglMakeAssociatedContextCurrentAMD_wrapped;

@ -77,7 +77,7 @@ class GLFunction(object):
self.public = ''
else:
self.wrapped_name = name
self.public = 'PUBLIC '
self.public = 'EPOXY_IMPORTEXPORT '
# This is the string of C code for passing through the
# arguments to the function.

Loading…
Cancel
Save