From 5509e2e13e12969616599e7330bbcfba0c952085 Mon Sep 17 00:00:00 2001 From: Nigel Stewart Date: Fri, 27 Sep 2019 22:08:15 +1000 Subject: [PATCH 1/9] Resolve gcc -Wshadow / MS C4456 compilation warning(s) --- auto/src/glew_init_gl.c | 8 +++++--- config/Makefile.linux | 4 +++- 2 files changed, 8 insertions(+), 4 deletions(-) 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/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 From 3f91cd177a5ebd5d0bf7423dc11963a71fcbfc2d Mon Sep 17 00:00:00 2001 From: Nigel Stewart Date: Fri, 27 Sep 2019 23:31:32 +1000 Subject: [PATCH 2/9] For SYSTEM=msys put dll in bin directory --- Makefile | 17 +++++++++-------- config/Makefile.msys | 3 ++- config/Makefile.msys-win64 | 2 +- 3 files changed, 12 insertions(+), 10 deletions(-) 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/config/Makefile.msys b/config/Makefile.msys index b5187af..0c64c65 100644 --- a/config/Makefile.msys +++ b/config/Makefile.msys @@ -7,7 +7,7 @@ CFLAGS.EXTRA += -D_WIN32 LDFLAGS.GL = -lopengl32 -lgdi32 -luser32 -lkernel32 LDFLAGS.EXTRA = CFLAGS.EXTRA += -fno-builtin -fno-stack-protector -LDFLAGS.EXTRA += -nostdlib +#LDFLAGS.EXTRA += -nostdlib LIBDIR = $(GLEW_DEST)/bin WARN = -Wall -W POPT = -O2 @@ -15,5 +15,6 @@ 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/config/Makefile.msys-win64 b/config/Makefile.msys-win64 index c1c785a..4ca3cde 100644 --- a/config/Makefile.msys-win64 +++ b/config/Makefile.msys-win64 @@ -1,5 +1,5 @@ include config/Makefile.msys POPT := -mtune=generic -O2 -CFLAGS.EXTRA += -m64 +CFLAGS.EXTRA += -m64 -Wno-cast-function-type LDFLAGS.EXTRA += -m64 From 0831041e9ff426a958974cf2991705b81f4d7f1d Mon Sep 17 00:00:00 2001 From: Nigel Stewart Date: Fri, 27 Sep 2019 23:55:50 +1000 Subject: [PATCH 3/9] Refinements for SYSTEM=msys builds (MSYS2) --- config/Makefile.msys | 4 ++-- config/Makefile.msys-win64 | 2 +- src/visualinfo.c | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/config/Makefile.msys b/config/Makefile.msys index 0c64c65..d6fc680 100644 --- a/config/Makefile.msys +++ b/config/Makefile.msys @@ -7,9 +7,9 @@ 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 diff --git a/config/Makefile.msys-win64 b/config/Makefile.msys-win64 index 4ca3cde..c1c785a 100644 --- a/config/Makefile.msys-win64 +++ b/config/Makefile.msys-win64 @@ -1,5 +1,5 @@ include config/Makefile.msys POPT := -mtune=generic -O2 -CFLAGS.EXTRA += -m64 -Wno-cast-function-type +CFLAGS.EXTRA += -m64 LDFLAGS.EXTRA += -m64 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); From b374d9ad9366b3c7c05ee3d1c9be3f8d02bef9ed Mon Sep 17 00:00:00 2001 From: Nigel Stewart Date: Sat, 28 Sep 2019 11:45:01 +1000 Subject: [PATCH 4/9] Fix vc15 release build memset link problem for v142 toolchains --- build/vc15/glew_shared.vcxproj | 4 ++-- build/vc15/glewinfo.vcxproj | 4 ++-- build/vc15/visualinfo.vcxproj | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) 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..7abd37e 100644 --- a/build/vc15/glewinfo.vcxproj +++ b/build/vc15/glewinfo.vcxproj @@ -191,7 +191,7 @@ true Console $(OutDir)$(TargetName)$(TargetExt) - glew32s.lib;opengl32.lib;%(AdditionalDependencies) + glew32s.lib;opengl32.lib;libvcruntime.lib;msvcrt.lib;%(AdditionalDependencies) $(LIB_DIR)\$(Configuration)\$(PlatformName)\ @@ -220,7 +220,7 @@ true Console $(OutDir)$(TargetName)$(TargetExt) - glew32s.lib;opengl32.lib;%(AdditionalDependencies) + glew32s.lib;opengl32.lib;libvcruntime.lib;msvcrt.lib;%(AdditionalDependencies) $(LIB_DIR)\$(Configuration)\$(PlatformName)\ diff --git a/build/vc15/visualinfo.vcxproj b/build/vc15/visualinfo.vcxproj index 0b61d30..41b60be 100644 --- a/build/vc15/visualinfo.vcxproj +++ b/build/vc15/visualinfo.vcxproj @@ -190,7 +190,7 @@ true Console $(OutDir)$(TargetName)$(TargetExt) - glew32s.lib;glu32.lib;opengl32.lib;%(AdditionalDependencies) + glew32s.lib;glu32.lib;opengl32.lib;libvcruntime.lib;msvcrt.lib;%(AdditionalDependencies) $(LIB_DIR)\$(Configuration)\$(PlatformName)\ @@ -219,7 +219,7 @@ true Console $(OutDir)$(TargetName)$(TargetExt) - glew32s.lib;glu32.lib;opengl32.lib;%(AdditionalDependencies) + glew32s.lib;glu32.lib;opengl32.lib;libvcruntime.lib;msvcrt.lib;%(AdditionalDependencies) $(LIB_DIR)\$(Configuration)\$(PlatformName)\ From 68135131a9dc72d10ea28253300f289536a61d34 Mon Sep 17 00:00:00 2001 From: Nigel Stewart Date: Sat, 28 Sep 2019 11:54:27 +1000 Subject: [PATCH 5/9] Resolve visualinfo and glewinfo link warnings for vc15 build --- build/vc15/glewinfo.vcxproj | 2 ++ build/vc15/visualinfo.vcxproj | 2 ++ 2 files changed, 4 insertions(+) diff --git a/build/vc15/glewinfo.vcxproj b/build/vc15/glewinfo.vcxproj index 7abd37e..3ee607c 100644 --- a/build/vc15/glewinfo.vcxproj +++ b/build/vc15/glewinfo.vcxproj @@ -192,6 +192,7 @@ Console $(OutDir)$(TargetName)$(TargetExt) glew32s.lib;opengl32.lib;libvcruntime.lib;msvcrt.lib;%(AdditionalDependencies) + libcmt $(LIB_DIR)\$(Configuration)\$(PlatformName)\ @@ -221,6 +222,7 @@ Console $(OutDir)$(TargetName)$(TargetExt) 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 41b60be..e53e338 100644 --- a/build/vc15/visualinfo.vcxproj +++ b/build/vc15/visualinfo.vcxproj @@ -191,6 +191,7 @@ Console $(OutDir)$(TargetName)$(TargetExt) glew32s.lib;glu32.lib;opengl32.lib;libvcruntime.lib;msvcrt.lib;%(AdditionalDependencies) + libcmt $(LIB_DIR)\$(Configuration)\$(PlatformName)\ @@ -220,6 +221,7 @@ Console $(OutDir)$(TargetName)$(TargetExt) glew32s.lib;glu32.lib;opengl32.lib;libvcruntime.lib;msvcrt.lib;%(AdditionalDependencies) + libcmt $(LIB_DIR)\$(Configuration)\$(PlatformName)\ From 4bbe8aa2ab70a6eb847ee5751735422d0ba623cd Mon Sep 17 00:00:00 2001 From: Nigel Stewart Date: Sat, 28 Sep 2019 12:27:53 +1000 Subject: [PATCH 6/9] Visual Studio 16 release-mode cmake fixup: libvcruntime.lib, msvcrt.lib --- build/cmake/CMakeLists.txt | 2 ++ 1 file changed, 2 insertions(+) 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 From 2ed67686baeb2edd02063ee3933c014ae7821db4 Mon Sep 17 00:00:00 2001 From: Nigel Stewart Date: Sat, 28 Sep 2019 13:31:40 +1000 Subject: [PATCH 7/9] Updated README.md with mention of fresh snapshot (2.2.0 RC2) --- README.md | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index 4461bff..2d9a7c6 100644 --- a/README.md +++ b/README.md @@ -27,18 +27,23 @@ 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 +82,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 +143,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 @@ -211,7 +220,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. From 17761407dae3e56fdb3023ab3e909c8dca5d22ab Mon Sep 17 00:00:00 2001 From: Nigel Stewart Date: Sat, 28 Sep 2019 13:32:45 +1000 Subject: [PATCH 8/9] README.md touch-up --- README.md | 1 + 1 file changed, 1 insertion(+) diff --git a/README.md b/README.md index 2d9a7c6..09d23ea 100644 --- a/README.md +++ b/README.md @@ -28,6 +28,7 @@ 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 From d47097985ad5a92ae59b1c149aa0e170e668f0b2 Mon Sep 17 00:00:00 2001 From: Nigel Stewart Date: Sat, 28 Sep 2019 13:37:35 +1000 Subject: [PATCH 9/9] README.md touch-up - Travis index.html no longer available --- README.md | 4 ---- 1 file changed, 4 deletions(-) diff --git a/README.md b/README.md index 09d23ea..948c984 100644 --- a/README.md +++ b/README.md @@ -191,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)