Enhance config script to allow selecting SDL1 or 2 backends
This commit is contained in:
@@ -27,7 +27,7 @@ uqm_requirements()
|
|||||||
|
|
||||||
|
|
||||||
# Libraries always used
|
# Libraries always used
|
||||||
use_library SDL 1.2.8 || exit 1
|
have_library SDL 1.2.8 || have_library SDL2 || exit 1
|
||||||
use_library libpng || exit 1
|
use_library libpng || exit 1
|
||||||
|
|
||||||
case "$HOST_SYSTEM" in
|
case "$HOST_SYSTEM" in
|
||||||
@@ -194,25 +194,40 @@ uqm_prepare_config()
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
||||||
CHOICE_graphics_OPTIONS="pure opengl"
|
CHOICE_graphics_OPTIONS="pure opengl sdl2"
|
||||||
CHOICE_graphics_TITLE="OpenGL graphics support"
|
CHOICE_graphics_TITLE="Graphics Engine"
|
||||||
CHOICE_graphics_OPTION_pure_TITLE="Don't include OpenGL graphics support"
|
CHOICE_graphics_OPTION_pure_TITLE="SDL1 without OpenGL graphics support"
|
||||||
CHOICE_graphics_OPTION_pure_ACTION='graphics_pure_action'
|
CHOICE_graphics_OPTION_pure_ACTION='graphics_pure_action'
|
||||||
graphics_pure_action() {
|
graphics_pure_action() {
|
||||||
CFLAGS="$CFLAGS -DGFXMODULE_SDL"
|
CFLAGS="$CFLAGS -DGFXMODULE_SDL -DSDL_DIR=SDL"
|
||||||
GFXMODULE=sdl
|
GFXMODULE=sdl
|
||||||
HAVE_OPENGL=0
|
HAVE_OPENGL=0
|
||||||
|
use_library SDL 1.2.8
|
||||||
}
|
}
|
||||||
CHOICE_graphics_OPTION_opengl_TITLE="Include OpenGL graphics support"
|
CHOICE_graphics_OPTION_opengl_TITLE="SDL1 with OpenGL graphics support"
|
||||||
CHOICE_graphics_OPTION_opengl_ACTION='graphics_opengl_action'
|
CHOICE_graphics_OPTION_opengl_ACTION='graphics_opengl_action'
|
||||||
CHOICE_graphics_OPTION_opengl_PRECOND="have_library opengl"
|
CHOICE_graphics_OPTION_opengl_PRECOND="have_library opengl"
|
||||||
graphics_opengl_action() {
|
graphics_opengl_action() {
|
||||||
CFLAGS="$CFLAGS -DGFXMODULE_SDL -DHAVE_OPENGL"
|
CFLAGS="$CFLAGS -DGFXMODULE_SDL -DHAVE_OPENGL -DSDL_DIR=SDL"
|
||||||
GFXMODULE=sdl
|
GFXMODULE=sdl
|
||||||
HAVE_OPENGL=1
|
HAVE_OPENGL=1
|
||||||
use_library opengl
|
use_library SDL 1.2.8 && use_library opengl
|
||||||
}
|
}
|
||||||
|
CHOICE_graphics_OPTION_sdl2_TITLE="SDL2 with modern graphics support"
|
||||||
|
CHOICE_graphics_OPTION_sdl2_ACTION='graphics_sdl2_action'
|
||||||
|
graphics_sdl2_action() {
|
||||||
|
CFLAGS="$CFLAGS -DGFXMODULE_SDL -DSDL_DIR=SDL2"
|
||||||
|
GFXMODULE=sdl
|
||||||
|
HAVE_OPENGL=0
|
||||||
|
use_library SDL2
|
||||||
|
}
|
||||||
|
# TODO: Once SDL2 has parity to SDL1, make it the default if
|
||||||
|
# available.
|
||||||
|
# if have_library SDL2; then
|
||||||
|
# CHOICE_graphics_DEFAULT=sdl2
|
||||||
|
# else
|
||||||
CHOICE_graphics_DEFAULT=opengl
|
CHOICE_graphics_DEFAULT=opengl
|
||||||
|
# fi
|
||||||
|
|
||||||
CHOICE_sound_OPTIONS="mixsdl openal"
|
CHOICE_sound_OPTIONS="mixsdl openal"
|
||||||
CHOICE_sound_TITLE="Sound backend"
|
CHOICE_sound_TITLE="Sound backend"
|
||||||
|
|||||||
@@ -75,6 +75,21 @@ case "$HOST_SYSTEM" in
|
|||||||
esac
|
esac
|
||||||
|
|
||||||
|
|
||||||
|
### SDL2 ###
|
||||||
|
LIB_SDL2_NAME="Simple DirectMedia Layer version 2.x"
|
||||||
|
case "$HOST_SYSTEM" in
|
||||||
|
WINSCW|GCCE|ARMV5)
|
||||||
|
LIB_SDL2_DETECT="false"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
LIB_SDL2_DETECT="have_command sdl2-config"
|
||||||
|
LIB_SDL2_CFLAGS='$(sdl2-config --cflags)'
|
||||||
|
LIB_SDL2_LDFLAGS='$(sdl2-config --libs)'
|
||||||
|
LIB_SDL2_VERSION='$(sdl2-config --version)'
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
|
|
||||||
### libpng ###
|
### libpng ###
|
||||||
LIB_libpng_NAME="libpng"
|
LIB_libpng_NAME="libpng"
|
||||||
# libpng generally integrates with pkg-config, but that also generally
|
# libpng generally integrates with pkg-config, but that also generally
|
||||||
|
|||||||
+1
-9
@@ -461,16 +461,8 @@ typedef unsigned int wint_t;
|
|||||||
#endif /* defined (PORT_WANT_ERRNO) */
|
#endif /* defined (PORT_WANT_ERRNO) */
|
||||||
|
|
||||||
// Use SDL_INCLUDE to portably include the SDL files from the right location.
|
// Use SDL_INCLUDE to portably include the SDL files from the right location.
|
||||||
// TODO: Where the SDL and SDL_image headers are located could be detected
|
// The SDL_DIR definition is provided by the build configuration.
|
||||||
// from the build script.
|
|
||||||
#ifdef __APPLE__
|
#ifdef __APPLE__
|
||||||
# define SDL_DIR SDL
|
|
||||||
#else
|
|
||||||
// SDL_image.h directly under the include dir.
|
|
||||||
# undef SDL_DIR
|
|
||||||
#endif
|
|
||||||
|
|
||||||
#ifdef SDL_DIR
|
|
||||||
# define SDL_INCLUDE(file) <SDL_DIR/file>
|
# define SDL_INCLUDE(file) <SDL_DIR/file>
|
||||||
#else
|
#else
|
||||||
# define SDL_INCLUDE(file) <file>
|
# define SDL_INCLUDE(file) <file>
|
||||||
|
|||||||
Reference in New Issue
Block a user