diff --git a/Makefile b/Makefile index 16dd008..1da7eac 100644 --- a/Makefile +++ b/Makefile @@ -89,6 +89,7 @@ all debug: glew.lib glew.bin LIB.LDFLAGS := $(LDFLAGS.EXTRA) $(LDFLAGS.GL) LIB.LIBS := $(GL_LDFLAGS) +LIB.SHARED.DIR ?= lib LIB.SRCS := src/glew.c LIB.SRCS.NAMES := $(notdir $(LIB.SRCS)) @@ -100,7 +101,7 @@ LIB.SOBJS := $(LIB.SOBJS:.c=.o) glew.lib: glew.lib.shared glew.lib.static -glew.lib.shared: lib lib/$(LIB.SHARED) glew.pc +glew.lib.shared: lib $(LIB.SHARED.DIR) $(LIB.SHARED.DIR)/$(LIB.SHARED) glew.pc glew.lib.static: lib lib/$(LIB.STATIC) glew.pc .PHONY: glew.lib glew.lib.shared glew.lib.static @@ -118,11 +119,11 @@ ifneq ($(STRIP),) $(STRIP) -x $@ endif -lib/$(LIB.SHARED): $(LIB.SOBJS) +$(LIB.SHARED.DIR)/$(LIB.SHARED): $(LIB.SOBJS) $(LD) $(LDFLAGS.SO) -o $@ $^ $(LIB.LDFLAGS) $(LIB.LIBS) ifneq ($(LN),) - $(LN) $(LIB.SHARED) lib/$(LIB.SONAME) - $(LN) $(LIB.SHARED) lib/$(LIB.DEVLNK) + $(LN) $(LIB.SHARED) $(LIB.SHARED.DIR)/$(LIB.SONAME) + $(LN) $(LIB.SHARED) $(LIB.SHARED.DIR)/$(LIB.DEVLNK) endif ifneq ($(STRIP),) $(STRIP) -x $@ @@ -178,13 +179,13 @@ endif bin: mkdir bin -bin/$(GLEWINFO.BIN): $(GLEWINFO.BIN.OBJ) lib/$(LIB.SHARED) +bin/$(GLEWINFO.BIN): $(GLEWINFO.BIN.OBJ) $(LIB.SHARED.DIR)/$(LIB.SHARED) $(CC) $(CFLAGS) -o $@ $(GLEWINFO.BIN.OBJ) $(BIN.LIBS) ifneq ($(STRIP),) $(STRIP) -x $@ endif -bin/$(VISUALINFO.BIN): $(VISUALINFO.BIN.OBJ) lib/$(LIB.SHARED) +bin/$(VISUALINFO.BIN): $(VISUALINFO.BIN.OBJ) $(LIB.SHARED.DIR)/$(LIB.SHARED) $(CC) $(CFLAGS) -o $@ $(VISUALINFO.BIN.OBJ) $(BIN.LIBS) ifneq ($(STRIP),) $(STRIP) -x $@ @@ -209,9 +210,9 @@ install.lib: glew.lib # runtime ifeq ($(filter-out mingw% cygwin,$(SYSTEM)),) $(INSTALL) -d -m 0755 "$(DESTDIR)$(BINDIR)" - $(INSTALL) -m 0755 lib/$(LIB.SHARED) "$(DESTDIR)$(BINDIR)/" + $(INSTALL) -m 0755 $(LIB.SHARED.DIR)/$(LIB.SHARED) "$(DESTDIR)$(BINDIR)/" else - $(INSTALL) -m 0644 lib/$(LIB.SHARED) "$(DESTDIR)$(LIBDIR)/" + $(INSTALL) -m 0644 $(LIB.SHARED.DIR)/$(LIB.SHARED) "$(DESTDIR)$(LIBDIR)/" endif ifneq ($(LN),) $(LN) $(LIB.SHARED) "$(DESTDIR)$(LIBDIR)/$(LIB.SONAME)" diff --git a/README.md b/README.md index 4461bff..948c984 100644 --- a/README.md +++ b/README.md @@ -27,18 +27,24 @@ Windows binaries for [32-bit and 64-bit](https://sourceforge.net/projects/glew/f Snapshots may contain new features, bug-fixes or new OpenGL extensions ahead of tested, official releases. +[glew-20190928.tgz](https://sourceforge.net/projects/glew/files/glew/snapshots/glew-20190928.tgz/download) *GLEW 2.2.0 RC2: New extensions, bug fixes* + [glew-20181010.tgz](https://sourceforge.net/projects/glew/files/glew/snapshots/glew-20181010.tgz/download) *GLEW 2.2.0 RC1: New extensions, bug fixes* ## Build It is highly recommended to build from a tgz or zip release snapshot. The code generation workflow is a complex brew of gnu make, perl and python, that works best on Linux or Mac. +The code generation is known to work on Windows using [MSYS2](https://www.msys2.org/). For most end-users of GLEW the official releases are the best choice, with first class support. ### Linux and Mac #### Using GNU Make +GNU make is the primary build system for GLEW, historically. +It includes targets for building the sources and headers, for maintenance purposes. + ##### Install build tools Debian/Ubuntu/Mint: `$ sudo apt-get install build-essential libxmu-dev libxi-dev libgl-dev` @@ -77,6 +83,10 @@ _Note: you may need to call `make` in the **auto** folder first_ #### Using cmake +The cmake build is mostly contributer maintained. +Due to the multitude of use cases this is maintained on a _best effort_ basis. +Pull requests are welcome. + *CMake 2.8.12 or higher is required.* ##### Install build tools @@ -134,7 +144,7 @@ Available from [Msys2](http://msys2.github.io/) and/or [Mingw-w64](http://mingw- Requirements: bash, make, gcc - $ pacman -S gcc make mingw-w64-i686-gcc mingw-w64-x86_64-gcc + $ pacman -S gcc make mingw-w64-i686-gcc mingw-w64-x86_64-gcc $ make $ make install $ make install.all @@ -181,10 +191,6 @@ download a pre-generated (unsupported) snapshot: https://sourceforge.net/projects/glew/files/glew/snapshots/ -Travis-built snapshots are also available: - -https://glew.s3.amazonaws.com/index.html - ## Authors GLEW is currently maintained by [Nigel Stewart](https://github.com/nigels-com) @@ -211,7 +217,7 @@ Be sure to mention platform and compiler toolchain details when filing a bug report. The output of `glewinfo` can be quite useful for discussion also. -Generally GLEW is released once a year, around the time of the Siggraph +Generally GLEW is usually released once a year, around the time of the Siggraph computer graphics conference. If you're not using the current release version of GLEW, be sure to check if the issue or bug is fixed there. diff --git a/auto/src/glew_init_gl.c b/auto/src/glew_init_gl.c index b28013f..d3b0914 100644 --- a/auto/src/glew_init_gl.c +++ b/auto/src/glew_init_gl.c @@ -79,7 +79,6 @@ static GLenum GLEWAPIENTRY glewContextInit () const GLubyte* s; GLuint dot; GLint major, minor; - size_t n; #ifdef _WIN32 getString = glGetString; @@ -130,8 +129,11 @@ static GLenum GLEWAPIENTRY glewContextInit () GLEW_VERSION_1_1 = GLEW_VERSION_1_2 == GL_TRUE || ( major == 1 && minor >= 1 ) ? GL_TRUE : GL_FALSE; } - for (n = 0; n < sizeof(_glewExtensionString) / sizeof(_glewExtensionString[0]); ++n) - _glewExtensionString[n] = GL_FALSE; + { + size_t i; + for (i = 0; i < sizeof(_glewExtensionString) / sizeof(_glewExtensionString[0]); ++i) + _glewExtensionString[i] = GL_FALSE; + } if (GLEW_VERSION_3_0) { diff --git a/build/cmake/CMakeLists.txt b/build/cmake/CMakeLists.txt index 6865d30..0310fcc 100644 --- a/build/cmake/CMakeLists.txt +++ b/build/cmake/CMakeLists.txt @@ -121,6 +121,8 @@ if (MSVC) target_compile_options (glew_s PRIVATE -GS-) # remove stdlib dependency target_link_libraries (glew LINK_PRIVATE -nodefaultlib -noentry) + target_link_libraries (glew LINK_PRIVATE libvcruntime.lib) + target_link_libraries (glew LINK_PRIVATE msvcrt.lib ) string(REGEX REPLACE "/RTC(su|[1su])" "" CMAKE_C_FLAGS_DEBUG ${CMAKE_C_FLAGS_DEBUG}) elseif (WIN32 AND ((CMAKE_C_COMPILER_ID MATCHES "GNU") OR (CMAKE_C_COMPILER_ID MATCHES "Clang"))) # remove stdlib dependency on windows with GCC and Clang (for similar reasons diff --git a/build/vc15/glew_shared.vcxproj b/build/vc15/glew_shared.vcxproj index 5f0a843..59f3089 100644 --- a/build/vc15/glew_shared.vcxproj +++ b/build/vc15/glew_shared.vcxproj @@ -117,7 +117,7 @@ $(OutDir)$(TargetName)$(TargetExt) $(LIB_DIR)\$(Configuration)\$(PlatformName)\$(TargetName).lib 0x62AA0000 - opengl32.lib;%(AdditionalDependencies) + opengl32.lib;libvcruntime.lib;msvcrt.lib;%(AdditionalDependencies) /ignore:4089 @@ -157,7 +157,7 @@ $(OutDir)$(TargetName)$(TargetExt) $(LIB_DIR)\$(Configuration)\$(PlatformName)\$(TargetName).lib 0x62AA0000 - opengl32.lib;%(AdditionalDependencies) + opengl32.lib;libvcruntime.lib;msvcrt.lib;%(AdditionalDependencies) /ignore:4089 diff --git a/build/vc15/glewinfo.vcxproj b/build/vc15/glewinfo.vcxproj index 3ccae20..3ee607c 100644 --- a/build/vc15/glewinfo.vcxproj +++ b/build/vc15/glewinfo.vcxproj @@ -191,7 +191,8 @@ true Console $(OutDir)$(TargetName)$(TargetExt) - glew32s.lib;opengl32.lib;%(AdditionalDependencies) + glew32s.lib;opengl32.lib;libvcruntime.lib;msvcrt.lib;%(AdditionalDependencies) + libcmt $(LIB_DIR)\$(Configuration)\$(PlatformName)\ @@ -220,7 +221,8 @@ true Console $(OutDir)$(TargetName)$(TargetExt) - glew32s.lib;opengl32.lib;%(AdditionalDependencies) + glew32s.lib;opengl32.lib;libvcruntime.lib;msvcrt.lib;%(AdditionalDependencies) + libcmt $(LIB_DIR)\$(Configuration)\$(PlatformName)\ diff --git a/build/vc15/visualinfo.vcxproj b/build/vc15/visualinfo.vcxproj index 0b61d30..e53e338 100644 --- a/build/vc15/visualinfo.vcxproj +++ b/build/vc15/visualinfo.vcxproj @@ -190,7 +190,8 @@ true Console $(OutDir)$(TargetName)$(TargetExt) - glew32s.lib;glu32.lib;opengl32.lib;%(AdditionalDependencies) + glew32s.lib;glu32.lib;opengl32.lib;libvcruntime.lib;msvcrt.lib;%(AdditionalDependencies) + libcmt $(LIB_DIR)\$(Configuration)\$(PlatformName)\ @@ -219,7 +220,8 @@ true Console $(OutDir)$(TargetName)$(TargetExt) - glew32s.lib;glu32.lib;opengl32.lib;%(AdditionalDependencies) + glew32s.lib;glu32.lib;opengl32.lib;libvcruntime.lib;msvcrt.lib;%(AdditionalDependencies) + libcmt $(LIB_DIR)\$(Configuration)\$(PlatformName)\ diff --git a/config/Makefile.linux b/config/Makefile.linux index 5263ada..694a98d 100644 --- a/config/Makefile.linux +++ b/config/Makefile.linux @@ -23,7 +23,9 @@ LDFLAGS.GL = -lGL -lX11 LDFLAGS.STATIC = -Wl,-Bstatic LDFLAGS.DYNAMIC = -Wl,-Bdynamic NAME = GLEW -WARN = -Wall -W +WARN += -Wall -W +WARN += -Wshadow +WARN += -pedantic POPT = -O2 CFLAGS.EXTRA += -fPIC CFLAGS.EXTRA += -Wcast-qual diff --git a/config/Makefile.msys b/config/Makefile.msys index b5187af..d6fc680 100644 --- a/config/Makefile.msys +++ b/config/Makefile.msys @@ -7,13 +7,14 @@ CFLAGS.EXTRA += -D_WIN32 LDFLAGS.GL = -lopengl32 -lgdi32 -luser32 -lkernel32 LDFLAGS.EXTRA = CFLAGS.EXTRA += -fno-builtin -fno-stack-protector -LDFLAGS.EXTRA += -nostdlib LIBDIR = $(GLEW_DEST)/bin -WARN = -Wall -W +WARN += -Wall -W +WARN += -Wno-cast-function-type POPT = -O2 BIN.SUFFIX = .exe LIB.SONAME = lib$(NAME).dll LIB.DEVLNK = lib$(NAME).dll.a # for mingw this is the dll import lib LIB.SHARED = $(NAME).dll +LIB.SHARED.DIR = bin LIB.STATIC = lib$(NAME).a # the static lib will be broken LDFLAGS.SO = -shared -Wl,-soname,$(LIB.SONAME) -Wl,--out-implib,lib/$(LIB.DEVLNK) diff --git a/src/visualinfo.c b/src/visualinfo.c index 99e8c63..6879f78 100644 --- a/src/visualinfo.c +++ b/src/visualinfo.c @@ -4,7 +4,7 @@ ** Copyright (C) Nate Robins, 1997 ** Michael Wimmer, 1999 ** Milan Ikits, 2002-2008 -** Nigel Stewart, 2008-2013 +** Nigel Stewart, 2008-2019 ** ** visualinfo is a small utility that displays all available visuals, ** aka. pixelformats, in an OpenGL system along with renderer version @@ -592,7 +592,7 @@ VisualInfoGDI (GLContext* ctx) || (drawableonly && !(pfd.dwFlags & PFD_DRAW_TO_WINDOW))) continue; fprintf(file, "Visual ID: %2d depth=%d class=%s\n", i, pfd.cDepthBits, pfd.cColorBits <= 8 ? "PseudoColor" : "TrueColor"); - fprintf(file, " bufferSize=%d level=%d renderType=%s doubleBuffer=%ld stereo=%ld\n", pfd.cColorBits, pfd.bReserved, pfd.iPixelType == PFD_TYPE_RGBA ? "rgba" : "ci", pfd.dwFlags & PFD_DOUBLEBUFFER, pfd.dwFlags & PFD_STEREO); + fprintf(file, " bufferSize=%d level=%d renderType=%s doubleBuffer=%ld stereo=%ld\n", pfd.cColorBits, pfd.bReserved, pfd.iPixelType == PFD_TYPE_RGBA ? "rgba" : "ci", (long) (pfd.dwFlags & PFD_DOUBLEBUFFER), (long) (pfd.dwFlags & PFD_STEREO)); fprintf(file, " generic=%d generic accelerated=%d\n", (pfd.dwFlags & PFD_GENERIC_FORMAT) == PFD_GENERIC_FORMAT, (pfd.dwFlags & PFD_GENERIC_ACCELERATED) == PFD_GENERIC_ACCELERATED); fprintf(file, " rgba: redSize=%d greenSize=%d blueSize=%d alphaSize=%d\n", pfd.cRedBits, pfd.cGreenBits, pfd.cBlueBits, pfd.cAlphaBits); fprintf(file, " auxBuffers=%d depthSize=%d stencilSize=%d\n", pfd.cAuxBuffers, pfd.cDepthBits, pfd.cStencilBits);