diff options
Diffstat (limited to 'include/epoxy')
-rw-r--r-- | include/epoxy/Makefile.am | 1 | ||||
-rw-r--r-- | include/epoxy/common.h | 40 | ||||
-rw-r--r-- | include/epoxy/egl.h | 12 | ||||
-rw-r--r-- | include/epoxy/gl.h | 12 | ||||
-rw-r--r-- | include/epoxy/glx.h | 10 | ||||
-rw-r--r-- | include/epoxy/meson.build | 4 | ||||
-rw-r--r-- | include/epoxy/wgl.h | 12 |
7 files changed, 62 insertions, 29 deletions
diff --git a/include/epoxy/Makefile.am b/include/epoxy/Makefile.am index b5b94a6..494c96e 100644 --- a/include/epoxy/Makefile.am +++ b/include/epoxy/Makefile.am @@ -22,6 +22,7 @@ epoxyincludedir = $(includedir)/epoxy epoxyinclude_HEADERS = \ + common.h \ gl.h \ $(EGL_INCLUDES) \ $(GLX_INCLUDES) \ diff --git a/include/epoxy/common.h b/include/epoxy/common.h new file mode 100644 index 0000000..04ff63f --- /dev/null +++ b/include/epoxy/common.h @@ -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 */ diff --git a/include/epoxy/egl.h b/include/epoxy/egl.h index f1c3f56..a084f00 100644 --- a/include/epoxy/egl.h +++ b/include/epoxy/egl.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 */ diff --git a/include/epoxy/gl.h b/include/epoxy/gl.h index 0be3a66..5963013 100644 --- a/include/epoxy/gl.h +++ b/include/epoxy/gl.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 */ diff --git a/include/epoxy/glx.h b/include/epoxy/glx.h index 8df33b8..dac327e 100644 --- a/include/epoxy/glx.h +++ b/include/epoxy/glx.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 */ diff --git a/include/epoxy/meson.build b/include/epoxy/meson.build index 38fe4ad..4f88923 100644 --- a/include/epoxy/meson.build +++ b/include/epoxy/meson.build @@ -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', diff --git a/include/epoxy/wgl.h b/include/epoxy/wgl.h index fdd7b4f..df629f6 100644 --- a/include/epoxy/wgl.h +++ b/include/epoxy/wgl.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 */ |