mirror of
https://github.com/yquake2/yquake2remaster.git
synced 2024-11-10 07:12:07 +00:00
Compiles on Linux with OpenAL support, SDL1/2 support.
Added build options for Zip/Ogg/OpenAL (On if available)
This commit is contained in:
parent
8211f5d497
commit
2d20c5c801
5 changed files with 54 additions and 35 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -1,3 +1,4 @@
|
||||||
/build/
|
/build/
|
||||||
/release/
|
/release/
|
||||||
*.mk
|
*.mk
|
||||||
|
*.user
|
||||||
|
|
|
@ -12,6 +12,13 @@ set(CMAKE_MODULE_PATH ${CMAKE_CURRENT_LIST_DIR}/cmake/modules
|
||||||
#Add Homebrew for OSX
|
#Add Homebrew for OSX
|
||||||
list(APPEND CMAKE_PREFIX_PATH /usr/local)
|
list(APPEND CMAKE_PREFIX_PATH /usr/local)
|
||||||
|
|
||||||
|
#yquake2 compilation options
|
||||||
|
option(ZIP_SUPPORT "ZIP support" ON)
|
||||||
|
option(OGG_SUPPORT "OGG Vorbis playback support (Music)" ON)
|
||||||
|
option(OPENAL_SUPPORT "3D Sound support" ON)
|
||||||
|
#TODO Remove the X11 Gamma from the code
|
||||||
|
#TODO Remove SDL 1.X all together.
|
||||||
|
|
||||||
#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(yquake2LinkerFlags)
|
set(yquake2LinkerFlags)
|
||||||
set(yquake2IncludeDirectories)
|
set(yquake2IncludeDirectories)
|
||||||
|
@ -28,41 +35,64 @@ set(CLIENT_SRC_DIR ${SOURCE_DIR}/client)
|
||||||
#Required libraries to build the different
|
#Required libraries to build the different
|
||||||
#components of the tutorials. Find them and add the include/linker
|
#components of the tutorials. Find them and add the include/linker
|
||||||
#directories and flags(In case the package manager find it in a weird place)
|
#directories and flags(In case the package manager find it in a weird place)
|
||||||
find_package(SDL2 REQUIRED)
|
find_package(SDL2)
|
||||||
add_definitions(-DSDL2)
|
if(${SDL2_FOUND})
|
||||||
list(APPEND yquake2IncludeDirectories "${SDL2_INCLUDE_DIR}/..")
|
add_definitions(-DSDL2)
|
||||||
list(APPEND yquake2LinkerFlags ${SDL2_LIBRARY})
|
list(APPEND yquake2IncludeDirectories "${SDL2_INCLUDE_DIR}/..")
|
||||||
|
list(APPEND yquake2LinkerFlags ${SDL2_LIBRARY})
|
||||||
|
else()
|
||||||
|
#If we can't get SDL2 at least get SDL 1.X
|
||||||
|
find_package(SDL REQUIRED)
|
||||||
|
add_definitions(-DWITH_CDA)
|
||||||
|
list(APPEND yquake2IncludeDirectories "${SDL_INCLUDE_DIR}/..")
|
||||||
|
list(APPEND yquake2LinkerFlags ${SDL_LIBRARY})
|
||||||
|
endif()
|
||||||
|
|
||||||
find_package(OpenGL REQUIRED)
|
find_package(OpenGL REQUIRED)
|
||||||
list(APPEND yquake2IncludeDirectories ${OPENGL_INCLUDE_DIR})
|
list(APPEND yquake2IncludeDirectories ${OPENGL_INCLUDE_DIR})
|
||||||
list(APPEND yquake2LinkerFlags ${OPENGL_LIBRARIES})
|
list(APPEND yquake2LinkerFlags ${OPENGL_LIBRARIES})
|
||||||
|
|
||||||
find_package(ZLIB REQUIRED)
|
if(${ZIP_SUPPORT})
|
||||||
list(APPEND yquake2IncludeDirectories ${ZLIB_INCLUDE_DIRS})
|
find_package(ZLIB REQUIRED)
|
||||||
list(APPEND yquake2LinkerFlags ${ZLIB_LIBRARIES})
|
list(APPEND yquake2IncludeDirectories ${ZLIB_INCLUDE_DIRS})
|
||||||
|
list(APPEND yquake2LinkerFlags ${ZLIB_LIBRARIES})
|
||||||
#OggVorbis
|
add_definitions(-DZIP -DNOUNCRYPT)
|
||||||
find_package(OggVorbis)
|
|
||||||
if(${OGGVORBIS_FOUND})
|
|
||||||
add_definitions(-DOGG=1)
|
|
||||||
list(APPEND yquake2IncludeDirectories ${OGGVORBIS_INCLUDE_DIR})
|
|
||||||
list(APPEND yquake2LinkerFlags ${OGG_LIBRARY} ${VORBIS_LIBRARY} ${VORBISFILE_LIBRARY})
|
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
#OpenAL
|
if(${OGG_SUPPORT})
|
||||||
find_package(OpenAL)
|
find_package(OggVorbis)
|
||||||
#TODO Enable OSX OpenAL support
|
if(${OGGVORBIS_FOUND})
|
||||||
if(${OPENAL_FOUND} AND NOT(${CMAKE_SYSTEM_NAME} MATCHES "Darwin"))
|
add_definitions(-DOGG=1)
|
||||||
add_definitions(-DUSE_OPENAL -DDEFAULT_OPENAL_DRIVER)
|
list(APPEND yquake2IncludeDirectories ${OGGVORBIS_INCLUDE_DIR})
|
||||||
list(APPEND yquake2IncludeDirectories "${OPENAL_INCLUDE_DIR}")
|
list(APPEND yquake2LinkerFlags ${OGG_LIBRARY} ${VORBIS_LIBRARY} ${VORBISFILE_LIBRARY})
|
||||||
list(APPEND yquake2LinkerFlags ${OPENAL_LIBRARY})
|
endif()
|
||||||
|
endif()
|
||||||
|
|
||||||
|
if(${OPENAL_SUPPORT})
|
||||||
|
find_package(OpenAL)
|
||||||
|
#TODO Enable OSX OpenAL support
|
||||||
|
if(${OPENAL_FOUND} AND NOT(${CMAKE_SYSTEM_NAME} MATCHES "Darwin"))
|
||||||
|
list(APPEND yquake2IncludeDirectories "${OPENAL_INCLUDE_DIR}")
|
||||||
|
list(APPEND yquake2LinkerFlags ${OPENAL_LIBRARY})
|
||||||
|
|
||||||
|
#TODO This should be done in the source with a #ifdef PLATFORM_X
|
||||||
|
#We found the library but we must also give it the right dynamic library
|
||||||
|
#to open.
|
||||||
|
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
|
||||||
|
add_definitions(-DUSE_OPENAL -DDEFAULT_OPENAL_DRIVER="openal32.dll")
|
||||||
|
elseif(${CMAKE_SYSTEM_NAME} MATCHES "Darwin")
|
||||||
|
add_definitions(-DUSE_OPENAL -DDEFAULT_OPENAL_DRIVER="libopenal.dylib")
|
||||||
|
elseif((${CMAKE_SYSTEM_NAME} MATCHES "FreeBSD") OR (${CMAKE_SYSTEM_NAME} MATCHES "OpenBSD"))
|
||||||
|
add_definitions(-DUSE_OPENAL -DDEFAULT_OPENAL_DRIVER="libopenal.so")
|
||||||
|
else()
|
||||||
|
add_definitions(-DUSE_OPENAL -DDEFAULT_OPENAL_DRIVER="libopenal.so.1")
|
||||||
|
endif()
|
||||||
|
endif()
|
||||||
endif()
|
endif()
|
||||||
|
|
||||||
list(APPEND yquake2LinkerFlags "-lm -rdynamic")
|
list(APPEND yquake2LinkerFlags "-lm -rdynamic")
|
||||||
list(APPEND yquake2LinkerFlags ${CMAKE_DL_LIBS})
|
list(APPEND yquake2LinkerFlags ${CMAKE_DL_LIBS})
|
||||||
|
|
||||||
add_definitions(-DZIP -DNOUNCRYPT)
|
|
||||||
|
|
||||||
#With all of those libraries and user defined paths added,
|
#With all of those libraries and user defined paths added,
|
||||||
#lets give them to the compiler and linker.
|
#lets give them to the compiler and linker.
|
||||||
include_directories(${yquake2IncludeDirectories})
|
include_directories(${yquake2IncludeDirectories})
|
||||||
|
|
|
@ -31,15 +31,11 @@
|
||||||
#include "../../client/header/client.h"
|
#include "../../client/header/client.h"
|
||||||
|
|
||||||
/* There's no sdl-config on OS X and Windows */
|
/* There's no sdl-config on OS X and Windows */
|
||||||
#if defined(_WIN32) || defined(__APPLE__)
|
|
||||||
#ifdef SDL2
|
#ifdef SDL2
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
#else /* SDL1.2 */
|
#else /* SDL1.2 */
|
||||||
#include <SDL/SDL.h>
|
#include <SDL/SDL.h>
|
||||||
#endif /*SDL2 */
|
#endif /*SDL2 */
|
||||||
#else /* not _WIN32 || APPLE */
|
|
||||||
#include <SDL.h>
|
|
||||||
#endif /* _WIN32 || APPLE */
|
|
||||||
|
|
||||||
/* SDL 1.2 <-> 2.0 compatiblity cruft */
|
/* SDL 1.2 <-> 2.0 compatiblity cruft */
|
||||||
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
#if SDL_VERSION_ATLEAST(2, 0, 0)
|
||||||
|
|
|
@ -41,15 +41,11 @@
|
||||||
#include <GL/gl.h>
|
#include <GL/gl.h>
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#if defined(_WIN32) || defined(__APPLE__)
|
|
||||||
#ifdef SDL2
|
#ifdef SDL2
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
#else // SDL1.2
|
#else // SDL1.2
|
||||||
#include <SDL/SDL.h>
|
#include <SDL/SDL.h>
|
||||||
#endif //SDL2
|
#endif //SDL2
|
||||||
#else // not _WIN32 || APPLE
|
|
||||||
#include <SDL.h>
|
|
||||||
#endif // _WIN32 || APPLE
|
|
||||||
|
|
||||||
/* The window icon */
|
/* The window icon */
|
||||||
#include "icon/q2icon.xbm"
|
#include "icon/q2icon.xbm"
|
||||||
|
|
|
@ -34,15 +34,11 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/* SDL includes */
|
/* SDL includes */
|
||||||
#if defined(_WIN32) || defined(__APPLE__)
|
|
||||||
#ifdef SDL2
|
#ifdef SDL2
|
||||||
#include <SDL2/SDL.h>
|
#include <SDL2/SDL.h>
|
||||||
#else // SDL1.2
|
#else // SDL1.2
|
||||||
#include <SDL/SDL.h>
|
#include <SDL/SDL.h>
|
||||||
#endif //SDL2
|
#endif //SDL2
|
||||||
#else // not _WIN32 || APPLE
|
|
||||||
#include <SDL.h>
|
|
||||||
#endif // _WIN32 || APPLE
|
|
||||||
|
|
||||||
/* Local includes */
|
/* Local includes */
|
||||||
#include "../../client/header/client.h"
|
#include "../../client/header/client.h"
|
||||||
|
|
Loading…
Reference in a new issue