Don't link to libGL at compile time

Get all OpenGL functions using SDL_GL_GetProcAddress(). This makes it
easier to cross-arch compile on Linux and add support for OpenGL ES
in the future.

Users still have to supply their own libSDL2 for cross-arch compiling
on Linux. But now the user does not have to re-install libgl1-mesa-dev
package for i386 or amd64 on Debian when switching between compiling
ioquake3 for x86 and x86_64.
This commit is contained in:
Zack Middleton 2017-10-01 18:59:01 -05:00
parent 51e9aa2df0
commit 20573bce43
4 changed files with 163 additions and 348 deletions

View file

@ -381,7 +381,7 @@ ifneq (,$(findstring "$(PLATFORM)", "linux" "gnu_kfreebsd" "kfreebsd-gnu" "gnu")
AUTOUPDATER_LIBS += -ldl
CLIENT_LIBS=$(SDL_LIBS)
RENDERER_LIBS = $(SDL_LIBS) -lGL
RENDERER_LIBS = $(SDL_LIBS)
ifeq ($(USE_OPENAL),1)
ifneq ($(USE_OPENAL_DLOPEN),1)
@ -613,7 +613,7 @@ ifdef MINGW
CLIENT_LDFLAGS += -mwindows
endif
CLIENT_LIBS = -lgdi32 -lole32
RENDERER_LIBS = -lgdi32 -lole32 -lopengl32 -static-libgcc
RENDERER_LIBS = -lgdi32 -lole32 -static-libgcc
ifeq ($(USE_FREETYPE),1)
FREETYPE_CFLAGS = -Ifreetype2
@ -699,7 +699,7 @@ ifeq ($(PLATFORM),freebsd)
CLIENT_LIBS =
CLIENT_LIBS += $(SDL_LIBS)
RENDERER_LIBS = $(SDL_LIBS) -lGL
RENDERER_LIBS = $(SDL_LIBS)
# optional features/libraries
ifeq ($(USE_OPENAL),1)
@ -790,7 +790,7 @@ ifeq ($(PLATFORM),openbsd)
CLIENT_LIBS =
CLIENT_LIBS += $(SDL_LIBS)
RENDERER_LIBS = $(SDL_LIBS) -lGL
RENDERER_LIBS = $(SDL_LIBS)
ifeq ($(USE_OPENAL),1)
ifneq ($(USE_OPENAL_DLOPEN),1)
@ -853,7 +853,7 @@ ifeq ($(PLATFORM),irix64)
# FIXME: The X libraries probably aren't necessary?
CLIENT_LIBS=-L/usr/X11/$(LIB) $(SDL_LIBS) \
-lX11 -lXext -lm
RENDERER_LIBS = $(SDL_LIBS) -lGL
RENDERER_LIBS = $(SDL_LIBS)
else # ifeq IRIX
@ -909,7 +909,7 @@ ifeq ($(PLATFORM),sunos)
BOTCFLAGS=-O0
CLIENT_LIBS +=$(SDL_LIBS) -lX11 -lXext -liconv -lm
RENDERER_LIBS = $(SDL_LIBS) -lGL
RENDERER_LIBS = $(SDL_LIBS)
else # ifeq sunos