Add -DSDL2 for Win32/OSX support (untested), print SDL2 usage on startup
The quake2 binary now gets -DSDL2 in the CFLAGS, so Win32/OSX can use different #include paths accordingly. This is also (ab)used to print which SDL version is used on startup. Don't use this for anything else, use #if SDL_VERSION_ATLEAST(2, 0, 0) instead. I haven't tested building on/for Win32 or OSX, there may be more work to do. Furthermore I added Copyright-Info about CalculateGammaRamp() in refresh.c (it's from SDL2)
This commit is contained in:
parent
628dff77a8
commit
d1ca122955
26
Makefile
26
Makefile
|
@ -163,7 +163,6 @@ endif
|
||||||
# Extra CFLAGS for SDL
|
# Extra CFLAGS for SDL
|
||||||
ifneq ($(OSTYPE), Windows)
|
ifneq ($(OSTYPE), Windows)
|
||||||
ifeq ($(OSTYPE), Darwin)
|
ifeq ($(OSTYPE), Darwin)
|
||||||
# TODO: set -I.../SDL2/ or /SDL/
|
|
||||||
SDLCFLAGS :=
|
SDLCFLAGS :=
|
||||||
else # not darwin
|
else # not darwin
|
||||||
ifeq ($(WITH_SDL2),yes)
|
ifeq ($(WITH_SDL2),yes)
|
||||||
|
@ -219,17 +218,24 @@ endif
|
||||||
|
|
||||||
# Extra LDFLAGS for SDL
|
# Extra LDFLAGS for SDL
|
||||||
ifeq ($(OSTYPE), Windows)
|
ifeq ($(OSTYPE), Windows)
|
||||||
# TODO: SDL2 for win/osx
|
ifeq ($(WITH_SDL2),yes)
|
||||||
|
SDLLDFLAGS := -lSDL2
|
||||||
|
else # not SDL2
|
||||||
SDLLDFLAGS := -lSDL
|
SDLLDFLAGS := -lSDL
|
||||||
|
endif # SDL2
|
||||||
else ifeq ($(OSTYPE), Darwin)
|
else ifeq ($(OSTYPE), Darwin)
|
||||||
|
ifeq ($(WITH_SDL2),yes)
|
||||||
|
SDLLDFLAGS := -framework SDL2 -framework OpenGL -framework Cocoa
|
||||||
|
else # not SDL2
|
||||||
SDLLDFLAGS := -framework SDL -framework OpenGL -framework Cocoa
|
SDLLDFLAGS := -framework SDL -framework OpenGL -framework Cocoa
|
||||||
else
|
endif # SDL2
|
||||||
|
else # not Darwin/Win
|
||||||
ifeq ($(WITH_SDL2),yes)
|
ifeq ($(WITH_SDL2),yes)
|
||||||
SDLLDFLAGS := $(shell sdl2-config --libs)
|
SDLLDFLAGS := $(shell sdl2-config --libs)
|
||||||
else
|
else # not SDL2
|
||||||
SDLLDFLAGS := $(shell sdl-config --libs)
|
SDLLDFLAGS := $(shell sdl-config --libs)
|
||||||
endif
|
endif # SDL2
|
||||||
endif
|
endif # Darwin/Win
|
||||||
|
|
||||||
# ----------
|
# ----------
|
||||||
|
|
||||||
|
@ -348,6 +354,10 @@ release/quake2.exe : CFLAGS += -DRETEXTURE
|
||||||
release/quake2.exe : LDFLAGS += -ljpeg
|
release/quake2.exe : LDFLAGS += -ljpeg
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(WITH_SDL2),yes)
|
||||||
|
release/quake2.exe : CFLAGS += -DSDL2
|
||||||
|
endif
|
||||||
|
|
||||||
release/quake2.exe : LDFLAGS += -mwindows -lopengl32
|
release/quake2.exe : LDFLAGS += -mwindows -lopengl32
|
||||||
else
|
else
|
||||||
client:
|
client:
|
||||||
|
@ -408,6 +418,10 @@ else
|
||||||
release/quake2 : LDFLAGS += -ljpeg
|
release/quake2 : LDFLAGS += -ljpeg
|
||||||
endif
|
endif
|
||||||
endif
|
endif
|
||||||
|
|
||||||
|
ifeq ($(WITH_SDL2),yes)
|
||||||
|
release/quake2 : CFLAGS += -DSDL2
|
||||||
|
endif
|
||||||
|
|
||||||
ifeq ($(OSTYPE), Darwin)
|
ifeq ($(OSTYPE), Darwin)
|
||||||
ifeq ($(OSX_APP), yes)
|
ifeq ($(OSX_APP), yes)
|
||||||
|
|
|
@ -29,13 +29,15 @@
|
||||||
#include "../../client/header/keyboard.h"
|
#include "../../client/header/keyboard.h"
|
||||||
#include "../generic/header/input.h"
|
#include "../generic/header/input.h"
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) || defined(__APPLE__)
|
||||||
|
#ifdef SDL2
|
||||||
|
#include <SDL2/SDL.h>
|
||||||
|
#else // SDL1.2
|
||||||
#include <SDL/SDL.h>
|
#include <SDL/SDL.h>
|
||||||
#elif defined(__APPLE__)
|
#endif //SDL2
|
||||||
#include <SDL/SDL.h>
|
#else // not _WIN32 || APPLE
|
||||||
#else
|
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#endif
|
#endif // _WIN32 || APPLE
|
||||||
|
|
||||||
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||||
#define SDLK_KP0 SDLK_KP_0
|
#define SDLK_KP0 SDLK_KP_0
|
||||||
|
|
|
@ -18,6 +18,11 @@
|
||||||
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
* Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA
|
||||||
* 02111-1307, USA.
|
* 02111-1307, USA.
|
||||||
*
|
*
|
||||||
|
* ----------------------------------------------------------------------
|
||||||
|
* CalculateGammaRamp() is derived from SDL2's SDL_CalculateGammaRamp()
|
||||||
|
* (C) 1997-2013 Sam Lantinga <slouken@libsdl.org>
|
||||||
|
* Published under zlib License: http://www.libsdl.org/license.php
|
||||||
|
*
|
||||||
* =======================================================================
|
* =======================================================================
|
||||||
*
|
*
|
||||||
* This file implements an OpenGL context via SDL
|
* This file implements an OpenGL context via SDL
|
||||||
|
@ -32,13 +37,15 @@
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) || defined(__APPLE__)
|
||||||
|
#ifdef SDL2
|
||||||
|
#include <SDL2/SDL.h>
|
||||||
|
#else // SDL1.2
|
||||||
#include <SDL/SDL.h>
|
#include <SDL/SDL.h>
|
||||||
#elif defined(__APPLE__)
|
#endif //SDL2
|
||||||
#include <SDL/SDL.h>
|
#else // not _WIN32 || APPLE
|
||||||
#else
|
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#endif
|
#endif // _WIN32 || APPLE
|
||||||
|
|
||||||
/* The window icon */
|
/* The window icon */
|
||||||
#include "icon/q2icon.xbm"
|
#include "icon/q2icon.xbm"
|
||||||
|
|
|
@ -34,13 +34,15 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* SDL includes */
|
/* SDL includes */
|
||||||
#ifdef _WIN32
|
#if defined(_WIN32) || defined(__APPLE__)
|
||||||
|
#ifdef SDL2
|
||||||
|
#include <SDL2/SDL.h>
|
||||||
|
#else // SDL1.2
|
||||||
#include <SDL/SDL.h>
|
#include <SDL/SDL.h>
|
||||||
#elif defined(__APPLE__)
|
#endif //SDL2
|
||||||
#include <SDL/SDL.h>
|
#else // not _WIN32 || APPLE
|
||||||
#else
|
|
||||||
#include <SDL.h>
|
#include <SDL.h>
|
||||||
#endif
|
#endif // _WIN32 || APPLE
|
||||||
|
|
||||||
/* Local includes */
|
/* Local includes */
|
||||||
#include "../../client/header/client.h"
|
#include "../../client/header/client.h"
|
||||||
|
|
|
@ -77,6 +77,12 @@ main(int argc, char **argv)
|
||||||
|
|
||||||
#ifndef DEDICATED_ONLY
|
#ifndef DEDICATED_ONLY
|
||||||
printf("Client build options:\n");
|
printf("Client build options:\n");
|
||||||
|
#ifdef SDL2
|
||||||
|
printf(" + SDL2\n");
|
||||||
|
#else
|
||||||
|
printf(" - SDL2 (using 1.2)\n");
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifdef CDA
|
#ifdef CDA
|
||||||
printf(" + CD audio\n");
|
printf(" + CD audio\n");
|
||||||
#else
|
#else
|
||||||
|
|
|
@ -712,6 +712,11 @@ WinMain(HINSTANCE hInstance, HINSTANCE hPrevInstance,
|
||||||
|
|
||||||
#ifndef DEDICATED_ONLY
|
#ifndef DEDICATED_ONLY
|
||||||
printf("Client build options:\n");
|
printf("Client build options:\n");
|
||||||
|
#ifdef SDL2
|
||||||
|
printf(" + SDL2\n");
|
||||||
|
#else
|
||||||
|
printf(" - SDL2 (using 1.2)\n");
|
||||||
|
#endif
|
||||||
#ifdef CDA
|
#ifdef CDA
|
||||||
printf(" + CD audio\n");
|
printf(" + CD audio\n");
|
||||||
#else
|
#else
|
||||||
|
|
Loading…
Reference in New Issue