mirror of https://github.com/stella-emu/stella.git
First pass at conditional compilation of SDL for Stella.
For now, it's enabled for all mainline ports. Stella doesn't absolutely need SDL (as the libretro port shows); it's less than 2000 lines in 220,000+ LOC,
This commit is contained in:
parent
6c1efce278
commit
1042c4ff7f
2
Makefile
2
Makefile
|
@ -26,7 +26,7 @@
|
|||
|
||||
srcdir ?= .
|
||||
|
||||
DEFINES := -D_GLIBCXX_USE_CXX11_ABI=1
|
||||
DEFINES := -DSDL_SUPPORT -D_GLIBCXX_USE_CXX11_ABI=1
|
||||
LDFLAGS := -pthread
|
||||
INCLUDES :=
|
||||
LIBS :=
|
||||
|
|
|
@ -19,7 +19,9 @@
|
|||
#define MEDIA_FACTORY_HXX
|
||||
|
||||
#include "bspf.hxx"
|
||||
#include "SDL_lib.hxx"
|
||||
#if defined(SDL_SUPPORT)
|
||||
#include "SDL_lib.hxx"
|
||||
#endif
|
||||
|
||||
#include "OSystem.hxx"
|
||||
#include "Settings.hxx"
|
||||
|
@ -54,16 +56,20 @@
|
|||
#if defined(__LIB_RETRO__)
|
||||
#include "EventHandlerLIBRETRO.hxx"
|
||||
#include "FrameBufferLIBRETRO.hxx"
|
||||
#else
|
||||
#elif defined(SDL_SUPPORT)
|
||||
#include "EventHandlerSDL2.hxx"
|
||||
#include "FrameBufferSDL2.hxx"
|
||||
#else
|
||||
#error Unsupported backend!
|
||||
#endif
|
||||
|
||||
#if defined(SOUND_SUPPORT)
|
||||
#if defined(__LIB_RETRO__)
|
||||
#include "SoundLIBRETRO.hxx"
|
||||
#else
|
||||
#elif defined(SDL_SUPPORT)
|
||||
#include "SoundSDL2.hxx"
|
||||
#else
|
||||
#include "SoundNull.hxx"
|
||||
#endif
|
||||
#else
|
||||
#include "SoundNull.hxx"
|
||||
|
@ -140,18 +146,22 @@ class MediaFactory
|
|||
{
|
||||
#if defined(__LIB_RETRO__)
|
||||
return make_unique<FrameBufferLIBRETRO>(osystem);
|
||||
#else
|
||||
#elif defined(SDL_SUPPORT)
|
||||
return make_unique<FrameBufferSDL2>(osystem);
|
||||
#else
|
||||
#error Unsupported platform for FrameBuffer!
|
||||
#endif
|
||||
}
|
||||
|
||||
static unique_ptr<Sound> createAudio(OSystem& osystem, AudioSettings& audioSettings)
|
||||
{
|
||||
#ifdef SOUND_SUPPORT
|
||||
#if defined(SOUND_SUPPORT)
|
||||
#if defined(__LIB_RETRO__)
|
||||
return make_unique<SoundLIBRETRO>(osystem, audioSettings);
|
||||
#elif defined(SOUND_SUPPORT)
|
||||
#elif defined(SOUND_SUPPORT) && defined(SDL_SUPPORT)
|
||||
return make_unique<SoundSDL2>(osystem, audioSettings);
|
||||
#else
|
||||
return make_unique<SoundNull>(osystem);
|
||||
#endif
|
||||
#else
|
||||
return make_unique<SoundNull>(osystem);
|
||||
|
@ -162,24 +172,27 @@ class MediaFactory
|
|||
{
|
||||
#if defined(__LIB_RETRO__)
|
||||
return make_unique<EventHandlerLIBRETRO>(osystem);
|
||||
#else
|
||||
#elif defined(SDL_SUPPORT)
|
||||
return make_unique<EventHandlerSDL2>(osystem);
|
||||
#else
|
||||
#error Unsupported platform for EventHandler!
|
||||
#endif
|
||||
}
|
||||
|
||||
static void cleanUp()
|
||||
{
|
||||
#if defined(SDL_SUPPORT)
|
||||
SDL_Quit();
|
||||
#endif
|
||||
}
|
||||
|
||||
static string backendName()
|
||||
{
|
||||
ostringstream buf;
|
||||
SDL_version ver;
|
||||
SDL_GetVersion(&ver);
|
||||
buf << "SDL " << int(ver.major) << "." << int(ver.minor) << "." << int(ver.patch);
|
||||
|
||||
return buf.str();
|
||||
#if defined(SDL_SUPPORT)
|
||||
return SDLVersion();
|
||||
#else
|
||||
return "Custom backend";
|
||||
#endif
|
||||
}
|
||||
|
||||
private:
|
||||
|
|
|
@ -18,6 +18,8 @@
|
|||
#ifndef SDL_LIB_HXX
|
||||
#define SDL_LIB_HXX
|
||||
|
||||
#include "bspf.hxx"
|
||||
|
||||
/*
|
||||
* We can't control the quality of code from outside projects, so for now
|
||||
* just disable warnings for it.
|
||||
|
@ -43,4 +45,13 @@
|
|||
#undef pixel
|
||||
#undef bool
|
||||
|
||||
#endif
|
||||
static inline string SDLVersion()
|
||||
{
|
||||
ostringstream buf;
|
||||
SDL_version ver;
|
||||
SDL_GetVersion(&ver);
|
||||
buf << "SDL " << int(ver.major) << "." << int(ver.minor) << "." << int(ver.patch);
|
||||
return buf.str();
|
||||
}
|
||||
|
||||
#endif // SDL_LIB_HXX
|
||||
|
|
|
@ -18,7 +18,9 @@
|
|||
#ifndef STELLA_KEYS_HXX
|
||||
#define STELLA_KEYS_HXX
|
||||
|
||||
#include "SDL_lib.hxx"
|
||||
#ifdef SDL_SUPPORT
|
||||
#include "SDL_lib.hxx"
|
||||
#endif
|
||||
|
||||
/**
|
||||
This class implements a thin wrapper around the SDL keysym enumerations,
|
||||
|
@ -439,7 +441,11 @@ namespace StellaKeyName
|
|||
{
|
||||
inline const char* const forKey(StellaKey key)
|
||||
{
|
||||
#ifdef SDL_SUPPORT
|
||||
return SDL_GetScancodeName(SDL_Scancode(key));
|
||||
#else
|
||||
return "";
|
||||
#endif
|
||||
}
|
||||
};
|
||||
|
||||
|
|
|
@ -3026,6 +3026,7 @@
|
|||
GCC_GENERATE_DEBUGGING_SYMBOLS = YES;
|
||||
GCC_OPTIMIZATION_LEVEL = 0;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
SDL_SUPPORT,
|
||||
CHEATCODE_SUPPORT,
|
||||
DEBUGGER_SUPPORT,
|
||||
JOYSTICK_SUPPORT,
|
||||
|
@ -3080,6 +3081,7 @@
|
|||
GCC_GENERATE_DEBUGGING_SYMBOLS = NO;
|
||||
GCC_OPTIMIZATION_LEVEL = 3;
|
||||
GCC_PREPROCESSOR_DEFINITIONS = (
|
||||
SDL_SUPPORT,
|
||||
CHEATCODE_SUPPORT,
|
||||
DEBUGGER_SUPPORT,
|
||||
JOYSTICK_SUPPORT,
|
||||
|
|
|
@ -157,7 +157,7 @@
|
|||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>BSPF_WINDOWS;WIN32;DEBUG_BUILD;PNG_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>BSPF_WINDOWS;WIN32;DEBUG_BUILD;SDL_SUPPORT;PNG_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
|
@ -193,7 +193,7 @@
|
|||
<ClCompile>
|
||||
<Optimization>Disabled</Optimization>
|
||||
<AdditionalIncludeDirectories>..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>BSPF_WINDOWS;WIN32;DEBUG_BUILD;PNG_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>BSPF_WINDOWS;WIN32;DEBUG_BUILD;SDL_SUPPORT;PNG_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<MinimalRebuild>false</MinimalRebuild>
|
||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
|
@ -226,7 +226,7 @@
|
|||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<AdditionalIncludeDirectories>..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>BSPF_WINDOWS;WIN32;NDEBUG;PNG_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>BSPF_WINDOWS;WIN32;NDEBUG;SDL_SUPPORT;PNG_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<PrecompiledHeader>
|
||||
|
@ -260,7 +260,7 @@
|
|||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<WholeProgramOptimization>false</WholeProgramOptimization>
|
||||
<AdditionalIncludeDirectories>..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>BSPF_WINDOWS;WIN32;NDEBUG;PNG_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>BSPF_WINDOWS;WIN32;NDEBUG;SDL_SUPPORT;PNG_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<PrecompiledHeader>
|
||||
|
@ -298,7 +298,7 @@
|
|||
<InlineFunctionExpansion>AnySuitable</InlineFunctionExpansion>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<AdditionalIncludeDirectories>..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>BSPF_WINDOWS;WIN32;NDEBUG;PNG_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>BSPF_WINDOWS;WIN32;NDEBUG;SDL_SUPPORT;PNG_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<PrecompiledHeader>
|
||||
|
@ -335,7 +335,7 @@
|
|||
<InlineFunctionExpansion>Default</InlineFunctionExpansion>
|
||||
<OmitFramePointers>true</OmitFramePointers>
|
||||
<AdditionalIncludeDirectories>..\yacc;..\emucore;..\emucore\tia;..\emucore\tia\frame-manager;..\common;..\common\tv_filters;..\gui;..\debugger\gui;..\debugger;..\windows;..\cheat;..\zlib;..\libpng;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories>
|
||||
<PreprocessorDefinitions>BSPF_WINDOWS;WIN32;NDEBUG;PNG_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<PreprocessorDefinitions>BSPF_WINDOWS;WIN32;NDEBUG;SDL_SUPPORT;PNG_SUPPORT;JOYSTICK_SUPPORT;DEBUGGER_SUPPORT;WINDOWED_SUPPORT;SOUND_SUPPORT;CHEATCODE_SUPPORT;%(PreprocessorDefinitions)</PreprocessorDefinitions>
|
||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary>
|
||||
<RuntimeTypeInfo>false</RuntimeTypeInfo>
|
||||
<PrecompiledHeader>
|
||||
|
|
Loading…
Reference in New Issue