Added makefiles to build with MSVC 2013, and fixed errors and warnings.

macos/v1.5.9
Yaron Cohen-Tal 10 years ago
parent 8bbc0d40c6
commit 773dd02f59
  1. 12
      README.md
  2. 4
      include/epoxy/egl.h
  3. 100
      msvc/detectenv-msvc.mak
  4. 46
      src/Makefile.sources
  5. 73
      src/Makefile.vc
  6. 24
      src/dispatch_common.h
  7. 2
      src/gen_dispatch.py
  8. 73
      test/Makefile.sources
  9. 68
      test/Makefile.vc
  10. 2
      test/khronos_typedefs_nonepoxy.c

@ -23,8 +23,8 @@ Features
* EGL, GLX, and WGL support. * EGL, GLX, and WGL support.
* Can be mixed with non-epoxy GL usage. * Can be mixed with non-epoxy GL usage.
Building Building (Unix)
-------- ---------------
./autogen.sh ./autogen.sh
make make
@ -46,6 +46,14 @@ Dependencies for OS X (macports):
The test suite has additional dependencies depending on the platform. The test suite has additional dependencies depending on the platform.
(X11, EGL, a running X Server). (X11, EGL, a running X Server).
Building (MSVC 2013)
--------------------
1) Check src\Makefile.vc to ensure that PYTHONDIR is pointing to your Python installation, either a 32-bit or a 64-bit (x64) installation of Python will do.
2) Open an MSVC Command prompt and run "nmake Makefile.vc CFG=release" or "nmake Makefile.vc CFG=debug" in src\ for a release or debug build.
3) Optionally, add src\ into your PATH and run the previous step in test\. Run the tests by running the built .exe's.
4) Assuming you want to install in %INSTALL_DIR%, copy gl.h, gl_generated.h, wgl.h, wgl_generated.h, egl.h and egl_generated.h from include\epoxy\ to %INSTALL_DIR%\include\epoxy\, copy src\epoxy.lib to %INSTALL_DIR%\lib\ and copy epoxy-vs12.dll and epoxy-vs12.pdb (if you've built a debug build) from src\ to %INSTALL_DIR%\bin\. Create directories as needed.
5) To clean the project, repeat steps 2 and 3, adding " clean" to the commands.
Switching your code to using epoxy Switching your code to using epoxy
---------------------------------- ----------------------------------

@ -45,8 +45,8 @@ extern "C" {
#include "epoxy/egl_generated.h" #include "epoxy/egl_generated.h"
bool epoxy_has_egl_extension(EGLDisplay dpy, const char *extension); PUBLIC bool epoxy_has_egl_extension(EGLDisplay dpy, const char *extension);
int epoxy_egl_version(EGLDisplay dpy); PUBLIC int epoxy_egl_version(EGLDisplay dpy);
#ifdef __cplusplus #ifdef __cplusplus
} /* extern "C" */ } /* extern "C" */

@ -0,0 +1,100 @@
# Copyright © 2015 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.
# Check to see we are configured to build with MSVC (MSDEVDIR, MSVCDIR or
# VCINSTALLDIR) or with the MS Platform SDK (MSSDK or WindowsSDKDir)
!if !defined(VCINSTALLDIR) && !defined(WINDOWSSDKDIR)
MSG = ^
This Makefile is only for Visual Studio 2008 and later.^
You need to ensure that the Visual Studio Environment is properly set up^
before running this Makefile.
!error $(MSG)
!endif
ERRNUL = 2>NUL
_HASH=^#
!if ![echo VCVERSION=_MSC_VER > vercl.x] \
&& ![echo $(_HASH)if defined(_M_IX86) >> vercl.x] \
&& ![echo PLAT=Win32 >> vercl.x] \
&& ![echo $(_HASH)elif defined(_M_AMD64) >> vercl.x] \
&& ![echo PLAT=x64 >> vercl.x] \
&& ![echo $(_HASH)endif >> vercl.x] \
&& ![cl -nologo -TC -P vercl.x $(ERRNUL)]
!include vercl.i
!if ![echo VCVER= ^\> vercl.vc] \
&& ![set /a $(VCVERSION) / 100 - 6 >> vercl.vc]
!include vercl.vc
!endif
!endif
!if ![del $(ERRNUL) /q/f vercl.x vercl.i vercl.vc]
!endif
!if $(VCVERSION) > 1499 && $(VCVERSION) < 1600
VSVER = 9
C99_COMPAT_NEEDED = 1
!elseif $(VCVERSION) > 1599 && $(VCVERSION) < 1700
VSVER = 10
C99_COMPAT_NEEDED = 1
!elseif $(VCVERSION) > 1699 && $(VCVERSION) < 1800
VSVER = 11
C99_COMPAT_NEEDED = 1
!elseif $(VCVERSION) > 1799 && $(VCVERSION) < 1900
VSVER = 12
C99_COMPAT_NEEDED = 0
!else
VSVER = 0
!endif
!if "$(VSVER)" == "0"
MSG = ^
This NMake Makefile set supports Visual Studio^
9 (2008) through 12 (2013). Your Visual Studio^
version is not supported.
!error $(MSG)
!endif
VALID_CFGSET = FALSE
!if "$(CFG)" == "release" || "$(CFG)" == "debug"
VALID_CFGSET = TRUE
!endif
!if "$(VALID_CFGSET)" == "FALSE"
MSG = ^
You need to specify CFG=release or CFG=debug.
!error $(MSG)
!endif
!if "$(CFG)" == "release"
CFLAGS_ADD = /MD /O2 /Zi /I..\include /I..\..\vs$(VSVER)\$(PLAT)\include
EXTRA_LDFLAGS = /opt:ref
!else
CFLAGS_ADD = /MDd /Od /Zi /I..\include /I..\..\vs$(VSVER)\$(PLAT)\include
EXTRA_LDFLAGS =
!endif
!if "$(PLAT)" == "x64"
LDFLAGS_ARCH = /machine:x64
!else
LDFLAGS_ARCH = /machine:x86
!endif
CFLAGS_C99_COMPAT = /Dinline=__inline

@ -0,0 +1,46 @@
# Copyright © 2014 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.
GL_GEN_HEADER = include/epoxy/gl_generated.h
GLX_GEN_HEADER = include/epoxy/glx_generated.h
WGL_GEN_HEADER = include/epoxy/wgl_generated.h
EGL_GEN_HEADER = include/epoxy/egl_generated.h
GENERATED_GL_SOURCE = gl_generated_dispatch.c
GENERATED_GLX_SOURCE = glx_generated_dispatch.c
GENERATED_WGL_SOURCE = wgl_generated_dispatch.c
GENERATED_EGL_SOURCE = egl_generated_dispatch.c
EPOXY_C_SRC = dispatch_common.c
EPOXY_GLX_C_SRC = dispatch_glx.c
EPOXY_WGL_C_SRC = dispatch_wgl.c
EPOXY_EGL_C_SRC = dispatch_egl.c
EPOXY_SRC_HDR = dispatch_common.h

@ -0,0 +1,73 @@
# Copyright © 2015 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.
# Note: To build and use libepoxy for Visual Studio prior to Visual Studio 2013,
# you need to ensure that you have stdint.h, inttypes.h and stdbool.h
# that will work for your installation of Visual Studio, which can be
# found by the compiler. One possibility would be to use msinttypes
# and adapting gnulib's stdbool.h.in for your use.
# Adjust this to where your Python interpretor resides in
PYTHONDIR=c:\python27
# Choose whether libtool-style DLL names are desired (set as 1)
LIBTOOL_DLL_NAMING = 0
# Please don't change the following lines
EPOXY_BASENAME = epoxy
!if "$(LIBTOOL_DLL_NAMING)" == "1"
EPOXY_DLL_BASENAME = lib$(EPOXY_BASENAME)-0
!else
EPOXY_DLL_BASENAME = $(EPOXY_BASENAME)-vs$(VSVER)
!endif
!include ..\msvc\detectenv-msvc.mak
!include Makefile.sources
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 \
/link /DLL /DEBUG $(EXTRA_LDFLAGS) /pdb:$(EPOXY_DLL_BASENAME).pdb /out:$@ /implib:$(EPOXY_BASENAME).lib
@if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;2
..\$(GL_GEN_HEADER) $(GENERATED_GL_SOURCE): gen_dispatch.py
$(PYTHONDIR)\python.exe gen_dispatch.py --dir .. ..\registry\gl.xml
..\$(WGL_GEN_HEADER) $(GENERATED_WGL_SOURCE): gen_dispatch.py
$(PYTHONDIR)\python.exe gen_dispatch.py --dir .. ..\registry\wgl.xml
..\$(EGL_GEN_HEADER) $(GENERATED_EGL_SOURCE): gen_dispatch.py
$(PYTHONDIR)\python.exe gen_dispatch.py --dir .. ..\registry\egl.xml
clean:
@-del *.lib
@-del *.exp
@-del *.dll
@-if exist *.dll.manifest del *.dll.manifest
@-del *.ilk
@-del *.pdb
@-del *.obj
@-del ..\include\epoxy\*generated.h
@-del $(GENERATED_GL_SOURCE)
@-del $(GENERATED_WGL_SOURCE)
@-del $(GENERATED_EGL_SOURCE)

@ -24,7 +24,7 @@
#include <stdbool.h> #include <stdbool.h>
#ifdef _WIN32 #ifdef _WIN32
#define PLATFORM_HAS_EGL 0 #define PLATFORM_HAS_EGL 1
#define PLATFORM_HAS_GLX 0 #define PLATFORM_HAS_GLX 0
#define PLATFORM_HAS_WGL 1 #define PLATFORM_HAS_WGL 1
#define EPOXY_IMPORTEXPORT __declspec(dllexport) #define EPOXY_IMPORTEXPORT __declspec(dllexport)
@ -45,17 +45,6 @@
#define EPOXY_IMPORTEXPORT #define EPOXY_IMPORTEXPORT
#endif #endif
#include "epoxy/gl.h"
#if PLATFORM_HAS_GLX
#include "epoxy/glx.h"
#endif
#if PLATFORM_HAS_EGL
#include "epoxy/egl.h"
#endif
#if PLATFORM_HAS_WGL
#include "epoxy/wgl.h"
#endif
#ifndef PUBLIC #ifndef PUBLIC
# ifdef _WIN32 # ifdef _WIN32
# define PUBLIC __declspec(dllexport) # define PUBLIC __declspec(dllexport)
@ -66,6 +55,17 @@
# endif # endif
#endif #endif
#if PLATFORM_HAS_WGL
#include "epoxy/wgl.h"
#endif
#include "epoxy/gl.h"
#if PLATFORM_HAS_GLX
#include "epoxy/glx.h"
#endif
#if PLATFORM_HAS_EGL
#include "epoxy/egl.h"
#endif
#if defined(__GNUC__) #if defined(__GNUC__)
#define PACKED __attribute__((__packed__)) #define PACKED __attribute__((__packed__))
#else #else

@ -606,7 +606,7 @@ class Generator(object):
# #
# It also writes out the actual initialized global function # It also writes out the actual initialized global function
# pointer. # pointer.
if func.ret_type == 'void': if func.ret_type == 'void' or func.ret_type=='VOID':
self.outln('GEN_THUNKS({0}, ({1}), ({2}))'.format(func.wrapped_name, self.outln('GEN_THUNKS({0}, ({1}), ({2}))'.format(func.wrapped_name,
func.args_decl, func.args_decl,
func.args_list)) func.args_list))

@ -0,0 +1,73 @@
# Copyright © 2014 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.
EGL_TESTS_PROGS = \
egl_has_extension_nocontext \
egl_gl \
egl_gles1_without_glx \
egl_gles2_without_glx
EGL_GLX_TEST_PROGS = \
egl_and_glx_different_pointers_egl_glx \
egl_and_glx_different_pointers_egl \
egl_and_glx_different_pointers_glx
GLX_TEST_PROGS = \
glx_beginend \
glx_public_api \
glx_public_api_core \
glx_glxgetprocaddress_nocontext \
glx_has_extension_nocontext \
glx_static
GLX_NON_APPLE_PROGS = \
glx_alias_prefer_same_name \
glx_gles2
WGL_TEST_PROGS = \
wgl_core_and_exts$(EXEEXT) \
wgl_per_context_funcptrs$(EXEEXT) \
wgl_usefontbitmaps$(EXEEXT) \
wgl_usefontbitmaps_unicode$(EXEEXT)
GENERIC_TEST_PROGS = \
headerguards$(EXEEXT) \
miscdefines$(EXEEXT) \
khronos_typedefs$(EXEEXT)
DLWRAP_SRC = dlwrap.c dlwrap.h
KHRONOS_TYPEDEF_SRC = \
khronos_typedefs.c \
khronos_typedefs.h \
khronos_typedefs_nonepoxy.c
EGL_COMMON_SRC = \
egl_common.c \
egl_common.h
GLX_COMMON_SRC = \
glx_common.c \
glx_common.h
WGL_COMMON_SRC = \
wgl_common.c \
wgl_common.h

@ -0,0 +1,68 @@
# Copyright © 2015 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.
# Note: To build and use libepoxy for Visual Studio prior to Visual Studio 2013,
# you need to ensure that you have stdint.h, inttypes.h and stdbool.h
# that will work for your installation of Visual Studio, which can be
# found by the compiler. One possibility would be to use msinttypes
# and adapting gnulib's stdbool.h.in for your use.
!include ..\msvc\detectenv-msvc.mak
!include Makefile.sources
EXEEXT = .exe
all: config.h wgl_common.lib $(GENERIC_TEST_PROGS) $(WGL_TEST_PROGS)
LD_CFLAGS = /link
LDFLAGS = /libpath:..\src epoxy.lib gdi32.lib user32.lib $(EXTRA_LDFLAGS)
CFLAGS_INCLUDES_TESTS = /I.
khronos_typedefs.exe: $(KHRONOS_TYPEDEF_SRC) config.h
$(CC) $(CFLAGS_ADD) $(CFLAGS_INCLUDES_TESTS) $(CFLAGS_C99_COMPAT) khronos_typedefs.c khronos_typedefs_nonepoxy.c /c
link /DEBUG $(EXTRA_LDFLAGS) $*.obj $*_nonepoxy.obj /out:$@
@if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1
wgl_usefontbitmaps_unicode.exe: wgl_usefontbitmaps.c wgl_common.lib config.h
$(CC) $(CFLAGS_ADD) $(CFLAGS_INCLUDES_TESTS) $(CFLAGS_C99_COMPAT) /DUNICODE wgl_usefontbitmaps.c /Fe$@ $(LD_CFLAGS) $(LDFLAGS) wgl_common.lib
@if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1
wgl_common.lib: $(WGL_COMMON_SRC)
$(CC) $(CFLAGS_ADD) $(CFLAGS_INCLUDES_TESTS) $(CFLAGS_C99_COMPAT) /c wgl_common.c
lib wgl_common.obj /out:$@
.c$(EXEEXT):
$(CC) $(CFLAGS_ADD) $(CFLAGS_INCLUDES_TESTS) $(CFLAGS_C99_COMPAT) $< $(LD_CFLAGS) $(LDFLAGS) wgl_common.lib
@if exist $@.manifest mt /manifest $@.manifest /outputresource:$@;1
config.h:
@echo #define BUILD_WGL 1 > config.h
clean:
@-del *.lib
@-del *.exp
@-del *.exe
@-if exist *.exe.manifest del *.exe.manifest
@-del *.ilk
@-del *.pdb
@-del *.obj
@-del config.h

@ -56,8 +56,10 @@ get_system_typedef_sizes(uint32_t *sizes)
#else /* !HAVE_KHRPLATFORM_H */ #else /* !HAVE_KHRPLATFORM_H */
#ifndef _MSC_VER
/* Don't care -- this is a conditional case in test code. */ /* Don't care -- this is a conditional case in test code. */
#pragma GCC diagnostic ignored "-Wsuggest-attribute=noreturn" #pragma GCC diagnostic ignored "-Wsuggest-attribute=noreturn"
#endif
void void
get_system_typedef_sizes(uint32_t *sizes) get_system_typedef_sizes(uint32_t *sizes)

Loading…
Cancel
Save