Merge branch 'buildcleanup'

This commit is contained in:
Yamagi Burmeister 2018-08-15 17:48:30 +02:00
commit 25a1f08656
24 changed files with 148 additions and 387 deletions

View file

@ -1,14 +1,14 @@
cmake_minimum_required(VERSION 3.0 FATAL_ERROR)
# Enforce "Debug" as standard build type
# Enforce "Debug" as standard build type.
if(NOT CMAKE_BUILD_TYPE)
set(CMAKE_BUILD_TYPE "Debug" CACHE STRING "Choose the type of build, options are: Debug Release RelWithDebInfo MinSizeRel." FORCE)
endif()
# CMake project configuration
# CMake project configuration.
project(yquake2)
# Cmake module search path
# Cmake module search path.
set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/stuff/cmake/modules ${CMAKE_MODULE_PATH})
if(YQUAKE2LIBS)
@ -22,26 +22,32 @@ if(YQUAKE2LIBS)
set(ENV{SDL2DIR} ${YQUAKE2LIBS})
endif()
# Add extended path for FreeBSD and Homebrew on OS X
# Add extended path for FreeBSD and Homebrew on OS X.
list(APPEND CMAKE_PREFIX_PATH /usr/local)
# Enforce compiler flags (GCC / Clang compatible, yquake2
# won't build with another compiler anyways)
# Enforce compiler flags:
# -Wall -> More warnings
# -fno-strict-aliasing -> Quake 2 is far away from strict aliasing
# -fwrapv -> Make signed integer overflows defined
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -std=gnu99 -Wall -fno-strict-aliasing -fwrapv")
# Switch of some annoying warnings
if ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "Clang")
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-missing-braces")
elseif ("${CMAKE_CXX_COMPILER_ID}" STREQUAL "GNU")
if (CMAKE_CXX_COMPILER_VERSION GREATER_EQUAL 8.0)
set(CMAKE_C_FLAGS "${CMAKE_C_FLAGS} -Wno-format-truncation -Wno-format-overflow")
endif()
endif()
# Use -O2 as maximum optimization level. -O3 has it's problems with yquake2.
string(REPLACE "-O3" "-O2" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
# yquake2 compilation options
option(ZIP_SUPPORT "ZIP support" ON)
option(OGG_SUPPORT "OGG Vorbis playback support (Music)" ON)
# Compilation time options.
option(OPENAL_SUPPORT "OpenAL support" ON)
option(SYSTEMWIDE_SUPPORT "Enable systemwide installation of game assets" OFF)
# These variables will act as our list of include folders and linker flags
# These variables will act as our list of include folders and linker flags.
set(yquake2IncludeDirectories)
set(yquake2LinkerDirectories)
set(yquake2LinkerFlags)
@ -60,57 +66,54 @@ set(SERVER_SRC_DIR ${SOURCE_DIR}/server)
set(CLIENT_SRC_DIR ${SOURCE_DIR}/client)
set(REF_SRC_DIR ${SOURCE_DIR}/client/refresh)
# Operating system
# Operating system.
set(YQ2OSTYPE "${CMAKE_SYSTEM_NAME}" CACHE STRING "Override operation system type")
add_definitions(-DYQ2OSTYPE="${YQ2OSTYPE}")
# Architecture string
# Architecture string.
set(YQ2ARCH "${CMAKE_SYSTEM_PROCESSOR}" CACHE STRING "Override CPU architecture")
string(REGEX REPLACE "amd64" "x86_64" ARCH ${YQ2ARCH})
string(REGEX REPLACE "i.86" "i386" ARCH ${ARCH})
string(REGEX REPLACE "^arm.*" "arm" ARCH ${ARCH})
add_definitions(-DYQ2ARCH="${ARCH}")
# Systemwide installation of game assets
# Systemwide installation of game assets.
if(${SYSTEMWIDE_SUPPORT})
add_definitions(-DSYSTEMWIDE)
endif()
# We need to pass some options to minizip / unzip.
add_definitions(-DNOUNCRYPT)
if(NOT CMAKE_SYSTEM_NAME MATCHES "Linux" OR NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
add_definitions(-DIOAPI_NO_64)
endif()
# Required libraries to build the different components of the binaries. Find
# them and add the include/linker directories and flags (in case the package
# manager find it in a weird place)
# manager find it in a weird place).
find_package(SDL2 REQUIRED)
list(APPEND yquake2IncludeDirectories "${SDL2_INCLUDE_DIR}/..")
list(APPEND yquake2SDLLinkerFlags ${SDL2_LIBRARY})
# We need an OpenGL implementation.
set(OpenGL_GL_PREFERENCE GLVND)
find_package(OpenGL REQUIRED)
list(APPEND yquake2IncludeDirectories ${OPENGL_INCLUDE_DIR})
list(APPEND yquake2OpenGLLinkerFlags ${OPENGL_LIBRARIES})
# FreeBSD needs libexecinfo.
if(${CMAKE_HOST_SYSTEM_NAME} STREQUAL "FreeBSD")
find_library(EXECINFO_LIBRARIES execinfo /usr/lib /usr/local/lib)
list(APPEND yquake2ClientLinkerFlags ${EXECINFO_LIBRARIES})
list(APPEND yquake2ServerLinkerFlags ${EXECINFO_LIBRARIES})
endif()
if(${ZIP_SUPPORT})
add_definitions(-DZIP -DNOUNCRYPT)
if(NOT CMAKE_SYSTEM_NAME MATCHES "Linux" OR NOT CMAKE_SYSTEM_NAME MATCHES "Windows")
add_definitions(-DIOAPI_NO_64)
endif()
endif()
if(${OGG_SUPPORT})
add_definitions(-DOGG)
endif()
# OpenAL support.
if(${OPENAL_SUPPORT})
find_package(OpenAL)
# TODO: OS X is still missing here
if(${OPENAL_FOUND} AND NOT(${CMAKE_SYSTEM_NAME} MATCHES "Darwin"))
if(${OPENAL_FOUND})
list(APPEND yquake2IncludeDirectories "${OPENAL_INCLUDE_DIR}")
list(APPEND yquake2ClientLinkerFlags ${OPENAL_LIBRARY})
@ -126,6 +129,7 @@ if(${OPENAL_SUPPORT})
endif()
endif()
# General linker flags.
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
list(APPEND yquake2LinkerFlags "-lm -static-libgcc")
else()

View file

@ -8,7 +8,7 @@
===============================================================================
At this time there're no open tasks regaring Quake II. Nevertheless the hints
At this time there're no open tasks regaring Quake II. Nevertheless some hints
for working with the code:
- Sign up for a Github account and fork our yquake2 repository. This allows the
@ -22,7 +22,7 @@ for working with the code:
it's still a disaster. Therefore:
- Do only one change at a time!
- Test after each change (play at least through base1.bsp)
- Commit early and commit often to create a fine grained history. This helps
- Commit early and commit often to create a fine grained history. This helps
"git bisect" to find bugs and errors.
- Do not try to clean up things or even rewrite code that you do not
understand to 110%! Even small behavioral changes can introduce gameplay

175
Makefile
View file

@ -2,17 +2,17 @@
# Makefile for the "Yamagi Quake 2 Client" #
# #
# Just type "make" to compile the #
# - SDL Client (quake2) #
# - Client (quake2) #
# - Server (q2ded) #
# - Quake II Game (baseq2) #
# - Renderer libraries (gl1, gl3, soft) #
# #
# Base dependencies: #
# - SDL 2.0 #
# - libGL #
# #
# Further dependencies: #
# Optional dependencies: #
# - OpenAL #
# - zlib #
# #
# Platforms: #
# - FreeBSD #
@ -25,26 +25,12 @@
# User configurable options
# -------------------------
# Enables OGG/Vorbis support. OGG/Vorbis files can be
# used as a substitute of CD audio playback.
WITH_OGG:=yes
# Enables the optional OpenAL sound system.
# To use it your system needs libopenal.so.1
# or openal32.dll (we recommend openal-soft)
# installed
WITH_OPENAL:=yes
# Enables optional runtime loading of OpenAL (dlopen or
# similar). If set to "no", the library is linked in at
# compile time in the normal way. On Windows this option
# is ignored, OpenAL is always loaded at runtime.
DLOPEN_OPENAL:=yes
# Enables opening of ZIP files (also known as .pk3 paks).
# Adds a dependency to libz
WITH_ZIP:=yes
# Enable systemwide installation of game assets
WITH_SYSTEMWIDE:=no
@ -103,19 +89,22 @@ else
YQ2_ARCH ?= $(shell uname -m | sed -e 's/i.86/i386/' -e 's/amd64/x86_64/' -e 's/^arm.*/arm/')
endif
# On Windows / MinGW $(CC) is undefined by default.
ifeq ($(YQ2_OSTYPE),Windows)
CC := gcc
endif
# Detect the compiler
ifeq ($(shell $(CC) -v 2>&1 | grep -c "clang version"), 1)
COMPILER := clang
else ifeq ($(shell $(CC) -v 2>&1 | grep -c "gcc version"), 1)
COMPILERVER := $(shell $(CC) -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$$/&00/')
else ifeq ($(shell $(CC) -v 2>&1 | grep -c -E "(gcc version|gcc-Version)"), 1)
COMPILER := gcc
COMPILERVER := $(shell $(CC) -dumpversion | sed -e 's/\.\([0-9][0-9]\)/\1/g' -e 's/\.\([0-9]\)/0\1/g' -e 's/^[0-9]\{3,4\}$$/&00/')
else
COMPILER := unknown
endif
# Used to detect libraries. Override to foobar-linux-gnu-pkg-config when
# cross-compiling.
PKG_CONFIG ?= pkg-config
# ----------
# Base CFLAGS.
@ -135,6 +124,9 @@ PKG_CONFIG ?= pkg-config
#
# -MMD to generate header dependencies. (They cannot be
# generated if building universal binaries on OSX)
#
# -fwrapv for defined integer wrapping. MSVC6 did this
# and the game code requires it.
ifeq ($(YQ2_OSTYPE), Darwin)
CFLAGS := -O2 -fno-strict-aliasing -fomit-frame-pointer \
-Wall -pipe -g -fwrapv
@ -146,11 +138,28 @@ endif
# ----------
# Switch of some annoying warnings.
ifeq ($(COMPILER), clang)
# -Wno-missing-braces because otherwise clang complains
# about totally valid 'vec3_t bla = {0}' constructs.
CFLAGS += -Wno-missing-braces
else ifeq ($(COMPILER), gcc)
# GCC 8.0 or higher.
ifeq ($(shell test $(COMPILERVER) -ge 80000; echo $$?),0)
# -Wno-format-truncation and -Wno-format-overflow
# because GCC spams about 50 false positives.
CFLAGS += -Wno-format-truncation -Wno-format-overflow
endif
endif
# ----------
# Defines the operating system and architecture
CFLAGS += -DYQ2OSTYPE=\"$(YQ2_OSTYPE)\" -DYQ2ARCH=\"$(YQ2_ARCH)\"
# ----------
# Fore reproduceable builds, look here for details:
# https://reproducible-builds.org/specs/source-date-epoch/
ifdef SOURCE_DATE_EPOCH
CFLAGS += -DBUILD_DATE=\"$(shell date --utc --date="@${SOURCE_DATE_EPOCH}" +"%b %_d %Y" | sed -e 's/ /\\ /g')\"
@ -175,7 +184,7 @@ endif
# ----------
# Systemwide installation
# Systemwide installation.
ifeq ($(WITH_SYSTEMWIDE),yes)
CFLAGS += -DSYSTEMWIDE
ifneq ($(WITH_SYSTEMDIR),"")
@ -185,14 +194,6 @@ endif
# ----------
# On Windows / MinGW $(CC) is
# undefined by default.
ifeq ($(YQ2_OSTYPE),Windows)
CC := gcc
endif
# ----------
# Just set IOAPI_NO_64 on everything that's not Linux or Windows,
# otherwise minizip will use fopen64(), fseek64() and friends that
# may be unavailable. This is - of course - not really correct, in
@ -210,9 +211,12 @@ ZIPCFLAGS += -DIOAPI_NO_64
endif
endif
# We don't support encrypted ZIP files.
ZIPCFLAGS += -DNOUNCRYPT
# ----------
# Extra CFLAGS for SDL
# Extra CFLAGS for SDL.
SDLCFLAGS := $(shell sdl2-config --cflags)
# ----------
@ -230,7 +234,7 @@ endif
# ----------
# Extra includes for GLAD
# Local includes for GLAD.
GLAD_INCLUDE = -Isrc/client/refresh/gl3/glad/include
# ----------
@ -248,13 +252,16 @@ else ifeq ($(YQ2_OSTYPE), Darwin)
LDFLAGS := $(OSX_ARCH) -lm
endif
# Keep symbols hidden.
CFLAGS += -fvisibility=hidden
LDFLAGS += -fvisibility=hidden
ifneq ($(YQ2_OSTYPE), $(filter $(YQ2_OSTYPE), Darwin OpenBSD))
# for some reason the OSX & OpenBSD linker doesn't support this
ifneq ($(YQ2_OSTYPE), Darwin)
ifneq ($(YQ2_OSTYPE), OpenBSD)
# for some reason the OSX & OpenBSD linker doesn't support this...
LDFLAGS += -Wl,--no-undefined
endif
endif
# ----------
@ -265,11 +272,15 @@ else # not Darwin
SDLLDFLAGS := $(shell sdl2-config --libs)
endif # Darwin
# The renderer libs don't need libSDL2main, libmingw32 or -mwindows.
ifeq ($(YQ2_OSTYPE), Windows)
DLL_SDLLDFLAGS = $(subst -mwindows,,$(subst -lmingw32,,$(subst -lSDL2main,,$(SDLLDFLAGS))))
endif
# ----------
# When make is invoked by "make VERBOSE=1" print
# the compiler and linker commands.
ifdef VERBOSE
Q :=
else
@ -293,7 +304,6 @@ config:
@echo "Build configuration"
@echo "============================"
@echo "WITH_OPENAL = $(WITH_OPENAL)"
@echo "WITH_ZIP = $(WITH_ZIP)"
@echo "WITH_SYSTEMWIDE = $(WITH_SYSTEMWIDE)"
@echo "WITH_SYSTEMDIR = $(WITH_SYSTEMDIR)"
@echo "============================"
@ -301,8 +311,7 @@ config:
# ----------
# Special target to compile
# the icon on Windows
# Special target to compile the icon on Windows
ifeq ($(YQ2_OSTYPE), Windows)
icon:
@echo "===> WR build/icon/icon.res"
@ -335,22 +344,14 @@ client:
build/client/%.o: %.c
@echo "===> CC $<"
${Q}mkdir -p $(@D)
${Q}$(CC) -c $(CFLAGS) $(SDLCFLAGS) $(INCLUDE) -o $@ $<
ifeq ($(WITH_OGG),yes)
release/yquake2.exe : CFLAGS += -DOGG
endif
ifeq ($(WITH_OPENAL),yes)
release/yquake2.exe : CFLAGS += -DUSE_OPENAL -DDEFAULT_OPENAL_DRIVER='"openal32.dll"' -DDLOPEN_OPENAL
endif
ifeq ($(WITH_ZIP),yes)
release/yquake2.exe : CFLAGS += -DZIP -DNOUNCRYPT
endif
${Q}$(CC) -c $(CFLAGS) $(SDLCFLAGS) $(ZIPCFLAGS) $(INCLUDE) -o $@ $<
release/yquake2.exe : LDFLAGS += -mwindows
ifeq ($(WITH_OPENAL),yes)
release/yquake2.exe : CFLAGS += -DUSE_OPENAL -DDEFAULT_OPENAL_DRIVER='"openal32.dll"'
endif
else # not Windows
client:
@ -358,46 +359,33 @@ client:
${Q}mkdir -p release
$(MAKE) release/quake2
build/client/%.o: %.c
@echo "===> CC $<"
${Q}mkdir -p $(@D)
${Q}$(CC) -c $(CFLAGS) $(SDLCFLAGS) $(INCLUDE) -o $@ $<
ifeq ($(YQ2_OSTYPE), Darwin)
build/client/%.o : %.m
@echo "===> CC $<"
${Q}mkdir -p $(@D)
${Q}$(CC) $(OSX_ARCH) -x objective-c -c $< -o $@
else
build/client/%.o: %.c
@echo "===> CC $<"
${Q}mkdir -p $(@D)
${Q}$(CC) -c $(CFLAGS) $(SDLCFLAGS) $(ZIPCFLAGS) $(INCLUDE) -o $@ $<
endif
release/quake2 : CFLAGS += -Wno-unused-result
ifeq ($(WITH_OGG),yes)
release/quake2 : CFLAGS += -DOGG
endif
ifeq ($(WITH_OPENAL),yes)
ifeq ($(DLOPEN_OPENAL),yes)
ifeq ($(YQ2_OSTYPE), OpenBSD)
release/quake2 : CFLAGS += -DUSE_OPENAL -DDEFAULT_OPENAL_DRIVER='"libopenal.so"' -DDLOPEN_OPENAL
release/quake2 : CFLAGS += -DUSE_OPENAL -DDEFAULT_OPENAL_DRIVER='"libopenal.so"'
else ifeq ($(YQ2_OSTYPE), Darwin)
release/quake2 : CFLAGS += -DUSE_OPENAL -DDEFAULT_OPENAL_DRIVER='"libopenal.dylib"' -I/usr/local/opt/openal-soft/include -DDLOPEN_OPENAL
release/quake2 : CFLAGS += -DUSE_OPENAL -DDEFAULT_OPENAL_DRIVER='"libopenal.dylib"' -I/usr/local/opt/openal-soft/include
release/quake2 : LDFLAGS += -L/usr/local/opt/openal-soft/lib -rpath /usr/local/opt/openal-soft/lib
else
release/quake2 : CFLAGS += -DUSE_OPENAL -DDEFAULT_OPENAL_DRIVER='"libopenal.so.1"' -DDLOPEN_OPENAL
release/quake2 : CFLAGS += -DUSE_OPENAL -DDEFAULT_OPENAL_DRIVER='"libopenal.so.1"'
endif
endif
else # !DLOPEN_OPENAL
release/quake2 : CFLAGS += -DUSE_OPENAL
release/quake2 : LDFLAGS += -lopenal
ifeq ($(YQ2_OSTYPE), Darwin)
release/quake2 : CFLAGS += -I/usr/local/opt/openal-soft/include
release/quake2 : LDFLAGS += -L/usr/local/opt/openal-soft/lib -rpath /usr/local/opt/openal-soft/lib
endif # Darwin
endif # !DLOPEN_OPENAL
endif # WITH_OPENAL
ifeq ($(WITH_ZIP),yes)
release/quake2 : CFLAGS += $(ZIPCFLAGS) -DZIP -DNOUNCRYPT
ifeq ($(YQ2_OSTYPE), FreeBSD)
release/quake2 : LDFLAGS += -lexecinfo
endif
ifeq ($(YQ2_OSTYPE), FreeBSD)
@ -435,14 +423,12 @@ server:
build/server/%.o: %.c
@echo "===> CC $<"
${Q}mkdir -p $(@D)
${Q}$(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $<
${Q}$(CC) -c $(CFLAGS) $(ZIPCFLAGS) $(INCLUDE) -o $@ $<
release/q2ded.exe : CFLAGS += -DDEDICATED_ONLY
ifeq ($(WITH_ZIP),yes)
release/q2ded.exe : CFLAGS += -DZIP -DNOUNCRYPT
endif
else # not Windows
server:
@echo "===> Building q2ded"
${Q}mkdir -p release
@ -451,14 +437,10 @@ server:
build/server/%.o: %.c
@echo "===> CC $<"
${Q}mkdir -p $(@D)
${Q}$(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $<
${Q}$(CC) -c $(CFLAGS) $(ZIPCFLAGS) $(INCLUDE) -o $@ $<
release/q2ded : CFLAGS += -DDEDICATED_ONLY -Wno-unused-result
ifeq ($(WITH_ZIP),yes)
release/q2ded : CFLAGS += $(ZIPCFLAGS) -DZIP -DNOUNCRYPT
endif
ifeq ($(YQ2_OSTYPE), FreeBSD)
release/q2ded : LDFLAGS += -lexecinfo
endif
@ -476,10 +458,6 @@ ref_gl1:
release/ref_gl1.dll : LDFLAGS += -lopengl32 -shared
# don't want the dll to link against libSDL2main or libmingw32, and no -mwindows either
# that's for the .exe only
DLL_SDLLDFLAGS = $(subst -mwindows,,$(subst -lmingw32,,$(subst -lSDL2main,,$(SDLLDFLAGS))))
else ifeq ($(YQ2_OSTYPE), Darwin)
ref_gl1:
@ -499,7 +477,7 @@ ref_gl1:
release/ref_gl1.so : CFLAGS += -fPIC
release/ref_gl1.so : LDFLAGS += -shared -lGL
endif # OS specific ref_gl1 shit
endif # OS specific ref_gl1 stuff
build/ref_gl1/%.o: %.c
@echo "===> CC $<"
@ -537,7 +515,7 @@ ref_gl3:
release/ref_gl3.so : CFLAGS += -fPIC
release/ref_gl3.so : LDFLAGS += -shared
endif # OS specific ref_gl3 shit
endif # OS specific ref_gl3 stuff
build/ref_gl3/%.o: %.c
@echo "===> CC $<"
@ -573,7 +551,7 @@ ref_soft:
release/ref_soft.so : CFLAGS += -fPIC
release/ref_soft.so : LDFLAGS += -shared
endif # OS specific ref_soft shit
endif # OS specific ref_soft stuff
build/ref_soft/%.o: %.c
@echo "===> CC $<"
@ -595,7 +573,9 @@ build/baseq2/%.o: %.c
${Q}$(CC) -c $(CFLAGS) $(INCLUDE) -o $@ $<
release/baseq2/game.dll : LDFLAGS += -shared
else ifeq ($(YQ2_OSTYPE), Darwin)
game:
@echo "===> Building baseq2/game.dylib"
${Q}mkdir -p release/baseq2
@ -608,7 +588,9 @@ build/baseq2/%.o: %.c
release/baseq2/game.dylib : CFLAGS += -fPIC
release/baseq2/game.dylib : LDFLAGS += -shared
else # not Windows or Darwin
game:
@echo "===> Building baseq2/game.so"
${Q}mkdir -p release/baseq2
@ -911,7 +893,7 @@ endif
# ----------
# Rewrite pathes to our object directory
# Rewrite pathes to our object directory.
CLIENT_OBJS = $(patsubst %,build/client/%,$(CLIENT_OBJS_))
REFGL1_OBJS = $(patsubst %,build/ref_gl1/%,$(REFGL1_OBJS_))
REFGL3_OBJS = $(patsubst %,build/ref_gl3/%,$(REFGL3_OBJS_))
@ -921,7 +903,7 @@ GAME_OBJS = $(patsubst %,build/baseq2/%,$(GAME_OBJS_))
# ----------
# Generate header dependencies
# Generate header dependencies.
CLIENT_DEPS= $(CLIENT_OBJS:.o=.d)
REFGL1_DEPS= $(REFGL1_OBJS:.o=.d)
REFGL3_DEPS= $(REFGL3_OBJS:.o=.d)
@ -929,9 +911,7 @@ REFSOFT_DEPS= $(REFSOFT_OBJS:.o=.d)
SERVER_DEPS= $(SERVER_OBJS:.o=.d)
GAME_DEPS= $(GAME_OBJS:.o=.d)
# ----------
# Suck header dependencies in
# Suck header dependencies in.
-include $(CLIENT_DEPS)
-include $(REFGL1_DEPS)
-include $(REFGL3_DEPS)
@ -946,7 +926,6 @@ release/yquake2.exe : $(CLIENT_OBJS) icon
@echo "===> LD $@"
${Q}$(CC) build/icon/icon.res $(CLIENT_OBJS) $(LDFLAGS) $(SDLLDFLAGS) -o $@
$(Q)strip $@
# the wrappper, quick'n'dirty
release/quake2.exe : src/win-wrapper/wrapper.c icon
$(Q)$(CC) -Wall -mwindows build/icon/icon.res src/win-wrapper/wrapper.c -o $@
$(Q)strip $@

View file

@ -186,33 +186,26 @@ To compile Yamagi Quake II from source, you need the following dependencies,
including development headers:
- A GCC-compatible compiler like GCC, MinGW (see below) or Clang.
- GNU make or cmake.
- GNU make.
- A libGL implementation with OpenGL system headers.
- SDL 2.0.
- libogg, libvorbis and libvorbisfile.
- A OpenAL implementation, openal-soft is highly recommended.
- zlib.
Yamagi Quake II has 2 build systems:
- A classic GNU Makefile.
- A CMakeFile.
Both build system provide the same options and features, it's up to the user to
decide which one to use.
While Yamagi Quake II ships with an optional CMakeFile using GNU make for
release builds is highly recommended. The GNU Makefile offers more options
and is well tested.
#### On Linux distribution or BSD systems
On debian based distributions (including Ubuntu and Mint) the dependencies can
be installed with: `apt-get install build-essential libgl1-mesa-dev libsdl2-dev
libogg-dev libvorbis-dev libopenal-dev zlib1g-dev`
libopenal-dev`
On OS X we recommend using Homebrew - https://brew.sh - to install the
dependencies: `brew install sdl2 libvorbis libogg openal-soft`
dependencies: `brew install sdl2 openal-soft`
On FreeBSD you'll need something like: `pkg install gmake libGL sdl2 libogg
libvorbis openal-soft`
On FreeBSD you'll need something like: `pkg install gmake libGL sdl2 openal-soft`
#### On Windows

View file

@ -630,9 +630,7 @@ SCR_PlayCinematic(char *arg)
In_FlushQueue();
/* make sure background music is not playing */
#ifdef OGG
OGG_Stop();
#endif
cl.cinematicframe = 0;
dot = strstr(arg, ".");

View file

@ -906,9 +906,8 @@ CL_Shutdown(void)
Key_WriteConsoleHistory();
#ifdef OGG
OGG_Stop();
#endif
S_Shutdown();
IN_Shutdown();
VID_Shutdown();

View file

@ -321,9 +321,7 @@ CL_Disconnect(void)
SCR_StopCinematic();
#ifdef OGG
OGG_Stop();
#endif
if (cls.demorecording)
{

View file

@ -1078,7 +1078,6 @@ CL_ParseConfigString(void)
{
CL_SetLightstyle(i - CS_LIGHTS);
}
#ifdef OGG
else if (i == CS_CDTRACK)
{
if (cl.refresh_prepped)
@ -1086,7 +1085,6 @@ CL_ParseConfigString(void)
OGG_PlayTrack((int)strtol(cl.configstrings[CS_CDTRACK], (char **)NULL, 10));
}
}
#endif
else if ((i >= CS_MODELS) && (i < CS_MODELS + MAX_MODELS))
{
if (cl.refresh_prepped)

View file

@ -567,9 +567,8 @@ SCR_BeginLoadingPlaque(void)
{
S_StopAllSounds();
cl.sound_prepped = false; /* don't play ambients */
#ifdef OGG
OGG_Stop();
#endif
if (cls.disable_screen)
{

View file

@ -361,10 +361,9 @@ CL_PrepRefresh(void)
cl.refresh_prepped = true;
cl.force_refdef = true; /* make sure we have a valid refdef */
#if defined(OGG)
/* start the cd track */
int track = (int)strtol(cl.configstrings[CS_CDTRACK], (char **)NULL, 10);
/* start the cd track */
if (Cvar_VariableValue("ogg_shuffle"))
{
OGG_PlayTrack(track);
@ -373,7 +372,6 @@ CL_PrepRefresh(void)
{
OGG_PlayTrack(track);
}
#endif
}
float

View file

@ -1053,11 +1053,9 @@ static menulist_s s_options_lookstrafe_box;
static menulist_s s_options_crosshair_box;
static menuslider_s s_options_sfxvolume_slider;
static menuslider_s s_options_haptic_slider;
#if defined(OGG)
static menulist_s s_options_oggshuffle_box;
static menuslider_s s_options_oggvolume_slider;
static menulist_s s_options_oggenable_box;
#endif
static menulist_s s_options_quality_list;
static menulist_s s_options_console_action;
@ -1117,8 +1115,6 @@ static void
ControlsSetMenuItemValues(void)
{
s_options_sfxvolume_slider.curvalue = Cvar_VariableValue("s_volume") * 10;
#if defined(OGG)
s_options_oggshuffle_box.curvalue = (Cvar_VariableValue("ogg_shuffle") != 0);
s_options_oggvolume_slider.curvalue = Cvar_VariableValue("ogg_volume") * 10;
s_options_oggenable_box.curvalue = (Cvar_VariableValue("ogg_enable") != 0);
@ -1134,7 +1130,6 @@ ControlsSetMenuItemValues(void)
{
s_options_oggshuffle_box.curvalue = 0;
}
#endif
s_options_quality_list.curvalue = (Cvar_VariableValue("s_loadas8bit") == 0);
s_options_sensitivity_slider.curvalue = sensitivity->value * 2;
@ -1174,7 +1169,6 @@ UpdateVolumeFunc(void *unused)
Cvar_SetValue("s_volume", s_options_sfxvolume_slider.curvalue / 10);
}
#if defined(OGG)
static void
OGGShuffleFunc(void *unused)
{
@ -1223,7 +1217,6 @@ EnableOGGMusic(void *unused)
OGG_Shutdown();
}
}
#endif
extern void Key_ClearTyping(void);
@ -1280,8 +1273,6 @@ UpdateSoundQualityFunc(void *unused)
static void
Options_MenuInit(void)
{
#ifdef OGG
static const char *ogg_music_items[] =
{
"disabled",
@ -1295,7 +1286,6 @@ Options_MenuInit(void)
"enabled",
0
};
#endif
static const char *quality_items[] =
{
@ -1334,7 +1324,6 @@ Options_MenuInit(void)
s_options_sfxvolume_slider.minvalue = 0;
s_options_sfxvolume_slider.maxvalue = 10;
#ifdef OGG
s_options_oggvolume_slider.generic.type = MTYPE_SLIDER;
s_options_oggvolume_slider.generic.x = 0;
s_options_oggvolume_slider.generic.y = 10;
@ -1356,7 +1345,6 @@ Options_MenuInit(void)
s_options_oggshuffle_box.generic.name = "Shuffle";
s_options_oggshuffle_box.generic.callback = OGGShuffleFunc;
s_options_oggshuffle_box.itemnames = ogg_shuffle;
#endif
s_options_quality_list.generic.type = MTYPE_SPINCONTROL;
s_options_quality_list.generic.x = 0;
@ -1438,11 +1426,9 @@ Options_MenuInit(void)
Menu_AddItem(&s_options_menu, (void *)&s_options_sfxvolume_slider);
#ifdef OGG
Menu_AddItem(&s_options_menu, (void *)&s_options_oggvolume_slider);
Menu_AddItem(&s_options_menu, (void *)&s_options_oggenable_box);
Menu_AddItem(&s_options_menu, (void *)&s_options_oggshuffle_box);
#endif
Menu_AddItem(&s_options_menu, (void *)&s_options_quality_list);
Menu_AddItem(&s_options_menu, (void *)&s_options_sensitivity_slider);
Menu_AddItem(&s_options_menu, (void *)&s_options_alwaysrun_box);

View file

@ -1393,11 +1393,6 @@ RI_Init()
R_Printf(PRINT_ALL, "Refresh: " REF_VERSION "\n");
R_Printf(PRINT_ALL, "Client: " YQ2VERSION "\n\n");
/* Options */
R_Printf(PRINT_ALL, "Refresher build options:\n");
R_Printf(PRINT_ALL, " + Retexturing support\n");
Draw_GetPalette();
R_Register();

View file

@ -435,11 +435,6 @@ GL3_Init(void)
R_Printf(PRINT_ALL, "Refresh: " REF_VERSION "\n");
R_Printf(PRINT_ALL, "Client: " YQ2VERSION "\n\n");
/* Options */
R_Printf(PRINT_ALL, "Refresher build options:\n");
R_Printf(PRINT_ALL, " + Retexturing support\n\n");
if(sizeof(float) != sizeof(GLfloat))
{
// if this ever happens, things would explode because we feed vertex arrays and UBO data

View file

@ -22,16 +22,9 @@
* =======================================================================
*/
#ifdef OGG
#ifndef CL_SOUND_VORBIS_H
#define CL_SOUND_VORBIS_H
/* The OGG codec can return the samples in a number
* of different formats, we use the standard signed
* short format. */
#define OGG_SAMPLEWIDTH 2
typedef enum
{
PLAY,
@ -47,4 +40,3 @@ void OGG_Stop(void);
void OGG_Stream(void);
#endif
#endif

View file

@ -27,8 +27,6 @@
* =======================================================================
*/
#ifdef OGG
#ifndef _WIN32
#include <sys/time.h>
#endif
@ -624,6 +622,3 @@ OGG_Shutdown(void)
ogg_started = false;
}
#endif /* OGG */

View file

@ -681,9 +681,7 @@ AL_Update(void)
AL_AddLoopSounds();
/* add music */
#ifdef OGG
OGG_Stream();
#endif
AL_StreamUpdate();
AL_IssuePlaysounds();

View file

@ -43,9 +43,7 @@
static ALCcontext *context;
static ALCdevice *device;
static cvar_t *al_device;
#ifdef DLOPEN_OPENAL
static cvar_t *al_driver;
#endif
static void *handle;
/* Function pointers for OpenAL management */
@ -341,7 +339,6 @@ QAL_Init()
{
al_device = Cvar_Get("al_device", "", CVAR_ARCHIVE);
#ifdef DLOPEN_OPENAL
/* DEFAULT_OPENAL_DRIVER is defined at compile time via the compiler */
al_driver = Cvar_Get("al_driver", DEFAULT_OPENAL_DRIVER, CVAR_ARCHIVE);
@ -355,11 +352,8 @@ QAL_Init()
Com_Printf("Loading %s failed! Disabling OpenAL.\n", al_driver->string);
return false;
}
# define ALSYMBOL(handle, sym) Sys_GetProcAddress(handle, #sym)
#else
handle = NULL;
# define ALSYMBOL(handle, sym) sym
#endif
#define ALSYMBOL(handle, sym) Sys_GetProcAddress(handle, #sym)
/* Connect function pointers to management functions */
qalcCreateContext = ALSYMBOL(handle, alcCreateContext);

View file

@ -1168,10 +1168,8 @@ SDL_Update(void)
Com_Printf("----(%i)---- painted: %i\n", total, paintedtime);
}
#ifdef OGG
/* stream music */
OGG_Stream();
#endif
if (!sound.buffer)
{

View file

@ -1084,9 +1084,7 @@ S_Init(void)
num_sfx = 0;
paintedtime = 0;
#ifdef OGG
OGG_Init();
#endif
Com_Printf("Sound sampling rate: %i\n", sound.speed);
S_StopAllSounds();
@ -1110,10 +1108,7 @@ S_Shutdown(void)
}
S_StopAllSounds();
#ifdef OGG
OGG_Shutdown();
#endif
/* free all sounds */
for (i = 0, sfx = known_sfx; i < num_sfx; i++, sfx++)

View file

@ -35,10 +35,6 @@
// Screenshots
// -----------
#ifdef ZIP
// If we build with zip support, zlib is available and
// we can use that for better PNG compression.
#include "../../common/unzip/miniz.h"
static unsigned char*
@ -64,8 +60,6 @@ compress_for_stbiw(unsigned char *data, int data_len, int *out_len, int quality)
}
#define STBIW_ZLIB_COMPRESS compress_for_stbiw
#endif
#define STB_IMAGE_WRITE_IMPLEMENTATION
#include "header/stb_image_write.h"

View file

@ -27,14 +27,10 @@
#include "header/common.h"
#include "header/glob.h"
#include "unzip/unzip.h"
#ifdef OGG
#include "../client/sound/header/vorbis.h"
#endif
#ifdef ZIP
#include "unzip/unzip.h"
#endif
#define MAX_HANDLES 512
#define MAX_PAKS 100
@ -50,9 +46,7 @@ typedef struct
char name[MAX_QPATH];
fsMode_t mode;
FILE *file; /* Only one will be used. */
#ifdef ZIP
unzFile *zip; /* (file or zip) */
#endif
} fsHandle_t;
typedef struct fsLink_s
@ -75,9 +69,7 @@ typedef struct
char name[MAX_OSPATH];
int numFiles;
FILE *pak;
#ifdef ZIP
unzFile *pk3;
#endif
fsPackFile_t *files;
} fsPack_t;
@ -91,9 +83,7 @@ typedef struct fsSearchPath_s
typedef enum
{
PAK,
#ifdef ZIP
PK3
#endif
} fsPackFormat_t;
typedef struct
@ -110,11 +100,9 @@ fsSearchPath_t *fs_baseSearchPaths;
/* Pack formats / suffixes. */
fsPackTypes_t fs_packtypes[] = {
{"pak", PAK},
#ifdef ZIP
{"pk2", PK3},
{"pk3", PK3},
{"zip", PK3}
#endif
};
char datadir[MAX_OSPATH];
@ -142,7 +130,6 @@ fsRawPath_t *fs_rawPath;
// --------
#ifdef ZIP
#if _WIN32
/*
* We need some trickery to make minizip Unicode compatible...
@ -181,7 +168,6 @@ static voidpf ZCALLBACK fopen_file_func_utf(voidpf opaque, const char *filename,
return file;
}
#endif
#endif
// --------
@ -318,11 +304,7 @@ FS_HandleForFile(const char *path, fileHandle_t *f)
for (i = 0; i < MAX_HANDLES; i++, handle++)
{
if ((handle->file == NULL)
#ifdef ZIP
&& (handle->zip == NULL)
#endif
)
if ((handle->file == NULL) && (handle->zip == NULL))
{
Q_strlcpy(handle->name, path, sizeof(handle->name));
*f = i + 1;
@ -369,13 +351,11 @@ FS_FCloseFile(fileHandle_t f)
{
fclose(handle->file);
}
#ifdef ZIP
else if (handle->zip)
{
unzCloseCurrentFile(handle->zip);
unzClose(handle->zip);
}
#endif
memset(handle, 0, sizeof(*handle));
}
@ -445,7 +425,6 @@ FS_FOpenFile(const char *name, fileHandle_t *f, qboolean gamedir_only)
return pack->files[i].size;
}
}
#ifdef ZIP
else if (pack->pk3)
{
/* PK3 */
@ -470,7 +449,6 @@ FS_FOpenFile(const char *name, fileHandle_t *f, qboolean gamedir_only)
unzClose(handle->zip);
}
}
#endif
Com_Error(ERR_FATAL, "Couldn't reopen '%s'", pack->name);
}
@ -541,12 +519,10 @@ FS_Read(void *buffer, int size, fileHandle_t f)
{
r = fread(buf, 1, remaining, handle->file);
}
#ifdef ZIP
else if (handle->zip)
{
r = unzReadCurrentFile(handle->zip, buf, remaining);
}
#endif
else
{
return 0;
@ -609,12 +585,10 @@ FS_FRead(void *buffer, int size, int count, fileHandle_t f)
{
r = fread(buf, 1, remaining, handle->file);
}
#ifdef ZIP
else if (handle->zip)
{
r = unzReadCurrentFile(handle->zip, buf, remaining);
}
#endif
else
{
return 0;
@ -761,9 +735,7 @@ FS_LoadPAK(const char *packPath)
pack = Z_Malloc(sizeof(fsPack_t));
Q_strlcpy(pack->name, packPath, sizeof(pack->name));
pack->pak = handle;
#ifdef ZIP
pack->pk3 = NULL;
#endif
pack->numFiles = numFiles;
pack->files = files;
@ -772,7 +744,6 @@ FS_LoadPAK(const char *packPath)
return pack;
}
#ifdef ZIP
/*
* Takes an explicit (not game tree related) path to a pack file.
*
@ -846,7 +817,6 @@ FS_LoadPK3(const char *packPath)
return pack;
}
#endif
/*
* Allows enumerating all of the directories in the search path.
@ -911,11 +881,7 @@ FS_Path_f(void)
for (i = 0, handle = fs_handles; i < MAX_HANDLES; i++, handle++)
{
if ((handle->file != NULL)
#ifdef ZIP
|| (handle->zip != NULL)
#endif
)
if ((handle->file != NULL) || (handle->zip != NULL))
{
Com_Printf("Handle %i: '%s'.\n", i + 1, handle->name);
}
@ -927,11 +893,8 @@ FS_Path_f(void)
}
Com_Printf("----------------------\n");
#ifdef ZIP
Com_Printf("%i files in PAK/PK2/PK3/ZIP files.\n", totalFiles);
#else
Com_Printf("%i files in PAK/PK2 files.\n", totalFiles);
#endif
}
/*
@ -1373,11 +1336,9 @@ FS_AddDirToSearchPath(char *dir, qboolean create) {
case PAK:
pack = FS_LoadPAK(path);
break;
#ifdef ZIP
case PK3:
pack = FS_LoadPK3(path);
break;
#endif
}
if (pack == NULL)
@ -1419,11 +1380,9 @@ FS_AddDirToSearchPath(char *dir, qboolean create) {
case PAK:
pack = FS_LoadPAK(list[j]);
break;
#ifdef ZIP
case PK3:
pack = FS_LoadPK3(list[j]);
break;
#endif
}
if (pack == NULL)
@ -1507,12 +1466,10 @@ FS_BuildGameSpecificSearchPath(char *dir)
fclose(fs_searchPaths->pack->pak);
}
#ifdef ZIP
if (fs_searchPaths->pack->pk3)
{
unzClose(fs_searchPaths->pack->pk3);
}
#endif
Z_Free(fs_searchPaths->pack->files);
Z_Free(fs_searchPaths->pack);
@ -1526,12 +1483,7 @@ FS_BuildGameSpecificSearchPath(char *dir)
/* Close open files for game dir. */
for (i = 0; i < MAX_HANDLES; i++)
{
if (strstr(fs_handles[i].name, dir) &&
((fs_handles[i].file != NULL)
#ifdef ZIP
|| (fs_handles[i].zip != NULL)
#endif
))
if (strstr(fs_handles[i].name, dir) && ((fs_handles[i].file != NULL) || (fs_handles[i].zip != NULL)))
{
FS_FCloseFile(i);
}
@ -1576,7 +1528,7 @@ FS_BuildGameSpecificSearchPath(char *dir)
// the gamedir has changed, so read in the corresponding configs
Qcommon_ExecConfigs(false);
#if !defined(DEDICATED_ONLY) && defined(OGG)
#ifndef DEDICATED_ONLY
// this function is called whenever the game cvar changes => the player wants to switch to another mod
// in that case the list of music tracks needs to be loaded again (=> tracks are possibly from the new mod dir)
OGG_InitTrackList();
@ -1672,7 +1624,7 @@ FS_InitFilesystem(void)
{
FS_BuildGameSpecificSearchPath(fs_gamedirvar->string);
}
#if !defined(DEDICATED_ONLY) && defined(OGG)
#ifndef DEDICATED_ONLY
else
{
// no mod, but we still need to get the list of OGG tracks for background music

View file

@ -102,21 +102,11 @@ Qcommon_Buildstring(void)
#ifndef DEDICATED_ONLY
printf("Client build options:\n");
#ifdef OGG
printf(" + OGG/Vorbis\n");
#else
printf(" - OGG/Vorbis\n");
#endif
#ifdef USE_OPENAL
printf(" + OpenAL audio\n");
#else
printf(" - OpenAL audio\n");
#endif
#ifdef ZIP
printf(" + Zip file support\n");
#else
printf(" - Zip file support\n");
#endif
#endif
printf("Platform: %s\n", YQ2OSTYPE);

View file

@ -1,89 +0,0 @@
# - Try to find the OggVorbis libraries
# Once done this will define
#
# OGGVORBIS_FOUND - system has OggVorbis
# OGGVORBIS_VERSION - set either to 1 or 2
# OGGVORBIS_INCLUDE_DIR - the OggVorbis include directory
# OGGVORBIS_LIBRARIES - The libraries needed to use OggVorbis
# OGG_LIBRARY - The Ogg library
# VORBIS_LIBRARY - The Vorbis library
# VORBISFILE_LIBRARY - The VorbisFile library
# VORBISENC_LIBRARY - The VorbisEnc library
# Copyright (c) 2006, Richard Laerkaeng, <richard@goteborg.utfors.se>
#
# Redistribution and use is allowed according to the terms of the BSD license.
# For details see the accompanying COPYING-CMAKE-SCRIPTS file.
include (CheckLibraryExists)
find_path(VORBIS_INCLUDE_DIR vorbis/vorbisfile.h)
find_path(OGG_INCLUDE_DIR ogg/ogg.h)
find_library(OGG_LIBRARY NAMES ogg)
find_library(VORBIS_LIBRARY NAMES vorbis)
find_library(VORBISFILE_LIBRARY NAMES vorbisfile)
find_library(VORBISENC_LIBRARY NAMES vorbisenc)
mark_as_advanced(VORBIS_INCLUDE_DIR OGG_INCLUDE_DIR
OGG_LIBRARY VORBIS_LIBRARY VORBISFILE_LIBRARY VORBISENC_LIBRARY)
if (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBISENC_LIBRARY)
set(OGGVORBIS_FOUND TRUE)
set(OGGVORBIS_LIBRARIES ${OGG_LIBRARY} ${VORBIS_LIBRARY} ${VORBISFILE_LIBRARY} ${VORBISENC_LIBRARY})
set(_CMAKE_REQUIRED_LIBRARIES_TMP ${CMAKE_REQUIRED_LIBRARIES})
set(CMAKE_REQUIRED_LIBRARIES ${CMAKE_REQUIRED_LIBRARIES} ${OGGVORBIS_LIBRARIES})
check_library_exists(vorbis vorbis_bitrate_addblock "" HAVE_LIBVORBISENC2)
set(CMAKE_REQUIRED_LIBRARIES ${_CMAKE_REQUIRED_LIBRARIES_TMP})
if (HAVE_LIBVORBISENC2)
set (OGGVORBIS_VERSION 2)
else (HAVE_LIBVORBISENC2)
set (OGGVORBIS_VERSION 1)
endif (HAVE_LIBVORBISENC2)
else (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBISENC_LIBRARY)
set (OGGVORBIS_VERSION)
set(OGGVORBIS_FOUND FALSE)
endif (VORBIS_INCLUDE_DIR AND VORBIS_LIBRARY AND VORBISFILE_LIBRARY AND VORBISENC_LIBRARY)
if (OGGVORBIS_FOUND)
if (NOT OggVorbis_FIND_QUIETLY)
message(STATUS "Found OggVorbis: ${OGGVORBIS_LIBRARIES}")
endif (NOT OggVorbis_FIND_QUIETLY)
else (OGGVORBIS_FOUND)
if (OggVorbis_FIND_REQUIRED)
message(FATAL_ERROR "Could NOT find OggVorbis libraries")
endif (OggVorbis_FIND_REQUIRED)
if (NOT OggVorbis_FIND_QUITELY)
message(STATUS "Could NOT find OggVorbis libraries")
endif (NOT OggVorbis_FIND_QUITELY)
endif (OGGVORBIS_FOUND)
#check_include_files(vorbis/vorbisfile.h HAVE_VORBISFILE_H)
#check_library_exists(ogg ogg_page_version "" HAVE_LIBOGG)
#check_library_exists(vorbis vorbis_info_init "" HAVE_LIBVORBIS)
#check_library_exists(vorbisfile ov_open "" HAVE_LIBVORBISFILE)
#check_library_exists(vorbisenc vorbis_info_clear "" HAVE_LIBVORBISENC)
#check_library_exists(vorbis vorbis_bitrate_addblock "" HAVE_LIBVORBISENC2)
#if (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE AND HAVE_LIBVORBISENC)
# message(STATUS "Ogg/Vorbis found")
# set (VORBIS_LIBS "-lvorbis -logg")
# set (VORBISFILE_LIBS "-lvorbisfile")
# set (VORBISENC_LIBS "-lvorbisenc")
# set (OGGVORBIS_FOUND TRUE)
# if (HAVE_LIBVORBISENC2)
# set (HAVE_VORBIS 2)
# else (HAVE_LIBVORBISENC2)
# set (HAVE_VORBIS 1)
# endif (HAVE_LIBVORBISENC2)
#else (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE AND HAVE_LIBVORBISENC)
# message(STATUS "Ogg/Vorbis not found")
#endif (HAVE_LIBOGG AND HAVE_VORBISFILE_H AND HAVE_LIBVORBIS AND HAVE_LIBVORBISFILE AND HAVE_LIBVORBISENC)

View file

@ -1,4 +1,4 @@
# Locate SDL2 library
# This module defines
# SDL2_LIBRARY, the name of the library to link against
# SDL2_FOUND, if false, do not try to link to SDL2
@ -65,9 +65,10 @@
# (To distribute this file outside of CMake, substitute the full
# License text for the above reference.)
# message("<FindSDL2.cmake>")
SET(SDL2_SEARCH_PATHS
~/Library/Frameworks
~/dev/fakeroot
/Library/Frameworks
/usr/local
/usr
@ -75,15 +76,7 @@ SET(SDL2_SEARCH_PATHS
/opt/local # DarwinPorts
/opt/csw # Blastwave
/opt
#Windows Search paths
"C:/Program Files (x86)/"
"C:/Program Files/"
"$ENV{ProgramFiles}/"
"C:/fakeroot/"
"C:/dev/libs"
${SDL2_PATH}
)
FIND_PATH(SDL2_INCLUDE_DIR SDL.h
@ -93,11 +86,17 @@ FIND_PATH(SDL2_INCLUDE_DIR SDL.h
PATHS ${SDL2_SEARCH_PATHS}
)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
set(PATH_SUFFIXES lib64 lib/x64 lib)
else()
set(PATH_SUFFIXES lib/x86 lib)
endif()
FIND_LIBRARY(SDL2_LIBRARY_TEMP
NAMES SDL2
HINTS
$ENV{SDL2DIR}
PATH_SUFFIXES lib64 lib
PATH_SUFFIXES ${PATH_SUFFIXES}
PATHS ${SDL2_SEARCH_PATHS}
)
@ -111,7 +110,7 @@ IF(NOT SDL2_BUILDING_LIBRARY)
NAMES SDL2main
HINTS
$ENV{SDL2DIR}
PATH_SUFFIXES lib64 lib
PATH_SUFFIXES ${PATH_SUFFIXES}
PATHS ${SDL2_SEARCH_PATHS}
)
ENDIF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework")
@ -125,11 +124,10 @@ IF(NOT APPLE)
FIND_PACKAGE(Threads)
ENDIF(NOT APPLE)
# MinGW needs an additional library, mwindows
# It's total link flags should look like -lmingw32 -lSDL2main -lSDL2 -lmwindows
# (Actually on second look, I think it only needs one of the m* libraries.)
# MinGW needs an additional link flag, -mwindows
# It's total link flags should look like -lmingw32 -lSDL2main -lSDL2 -mwindows
IF(MINGW)
SET(MINGW32_LIBRARY mingw32 CACHE STRING "mwindows for MinGW")
SET(MINGW32_LIBRARY mingw32 "-mwindows" CACHE STRING "mwindows for MinGW")
ENDIF(MINGW)
IF(SDL2_LIBRARY_TEMP)
@ -168,6 +166,8 @@ IF(SDL2_LIBRARY_TEMP)
SET(SDL2_LIBRARY_TEMP "${SDL2_LIBRARY_TEMP}" CACHE INTERNAL "")
ENDIF(SDL2_LIBRARY_TEMP)
# message("</FindSDL2.cmake>")
INCLUDE(FindPackageHandleStandardArgs)
FIND_PACKAGE_HANDLE_STANDARD_ARGS(SDL2 REQUIRED_VARS SDL2_LIBRARY SDL2_INCLUDE_DIR)