Add common header

We're going to use this header to provide shared macros. Right now, we
can use it to replace the:

    #ifdef __cplusplus
    extern "C" {
    #endif

    …

    #ifdef __cplusplus
    }
    #endif

Stanzas for every installed header, with easier to read macros in the
same spirit of Cairo and GLib.
macos/v1.5.9
Emmanuele Bassi 8 years ago
parent 41bea9e0fb
commit 0625a74d69
  1. 1
      include/epoxy/Makefile.am
  2. 40
      include/epoxy/common.h
  3. 12
      include/epoxy/egl.h
  4. 12
      include/epoxy/gl.h
  5. 10
      include/epoxy/glx.h
  6. 4
      include/epoxy/meson.build
  7. 12
      include/epoxy/wgl.h

@ -22,6 +22,7 @@
epoxyincludedir = $(includedir)/epoxy
epoxyinclude_HEADERS = \
common.h \
gl.h \
$(EGL_INCLUDES) \
$(GLX_INCLUDES) \

@ -0,0 +1,40 @@
/*
* Copyright 2017 Emmanuele Bassi
*
* 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
*
* A common header file, used to define macros and shared symbols.
*/
#ifndef EPOXY_COMMON_H
#define EPOXY_COMMON_H
#ifdef __cplusplus
# define EPOXY_BEGIN_DECLS extern "C" {
# define EPOXY_END_DECLS }
#else
# define EPOXY_BEGIN_DECLS
# define EPOXY_END_DECLS
#endif
#endif /* EPOXY_COMMON_H */

@ -30,12 +30,10 @@
#ifndef EPOXY_EGL_H
#define EPOXY_EGL_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdbool.h>
#include "epoxy/common.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,11 +43,11 @@ extern "C" {
#include "epoxy/egl_generated.h"
EPOXY_BEGIN_DECLS
bool epoxy_has_egl_extension(EGLDisplay dpy, const char *extension);
int epoxy_egl_version(EGLDisplay dpy);
#ifdef __cplusplus
} /* extern "C" */
#endif
EPOXY_END_DECLS
#endif /* EPOXY_EGL_H */

@ -30,12 +30,10 @@
#ifndef EPOXY_GL_H
#define EPOXY_GL_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdbool.h>
#include "epoxy/common.h"
#if defined(__gl_h_) || defined(__glext_h_)
#error epoxy/gl.h must be included before (or in place of) GL/gl.h
#else
@ -93,12 +91,12 @@ extern "C" {
#include "epoxy/gl_generated.h"
EPOXY_BEGIN_DECLS
EPOXY_IMPORTEXPORT bool epoxy_has_gl_extension(const char *extension);
EPOXY_IMPORTEXPORT bool epoxy_is_desktop_gl(void);
EPOXY_IMPORTEXPORT int epoxy_gl_version(void);
#ifdef __cplusplus
} /* extern "C" */
#endif
EPOXY_END_DECLS
#endif /* EPOXY_GL_H */

@ -30,10 +30,6 @@
#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>
@ -49,11 +45,11 @@ extern "C" {
#include "epoxy/glx_generated.h"
EPOXY_BEGIN_DECLS
bool epoxy_has_glx_extension(Display *dpy, int screen, const char *extension);
int epoxy_glx_version(Display *dpy, int screen);
#ifdef __cplusplus
} /* extern "C" */
#endif
EPOXY_END_DECLS
#endif /* EPOXY_GLX_H */

@ -1,3 +1,5 @@
headers = [ 'common.h' ]
gl_generated = custom_target('gl_generated.h',
input: gl_registry,
output: [
@ -15,7 +17,7 @@ gl_generated = custom_target('gl_generated.h',
install_dir: join_paths(epoxy_includedir, 'epoxy'))
gen_headers = [ gl_generated ]
headers = [ 'gl.h', ]
headers += [ 'gl.h', ]
if build_egl
egl_generated = custom_target('egl_generated.h',

@ -30,13 +30,11 @@
#ifndef EPOXY_WGL_H
#define EPOXY_WGL_H
#ifdef __cplusplus
extern "C" {
#endif
#include <stdbool.h>
#include <windows.h>
#include "epoxy/common.h"
#undef wglUseFontBitmaps
#undef wglUseFontOutlines
@ -54,11 +52,11 @@ extern "C" {
#include "epoxy/wgl_generated.h"
EPOXY_BEGIN_DECLS
EPOXY_IMPORTEXPORT bool epoxy_has_wgl_extension(HDC hdc, const char *extension);
EPOXY_IMPORTEXPORT void epoxy_handle_external_wglMakeCurrent(void);
#ifdef __cplusplus
} /* extern "C" */
#endif
EPOXY_END_DECLS
#endif /* EPOXY_WGL_H */

Loading…
Cancel
Save