mirror of https://github.com/stella-emu/stella.git
Some more cleanups wrt the sharing of the SDL codebase between
Linux and Windows. Reworked the Makefile (again). Now you have to edit it and select which system you are using for the SDL port (linux or windows), then start compilation with 'make sdl'. The makefile is starting to get harder to manage, and with the explosion of features, I'm looking into moving to a configure script (autoconf and automake) for a future release. git-svn-id: svn://svn.code.sf.net/p/stella/code/trunk@227 8b62c5a3-ac7e-4cc8-8f21-d9a121418aba
This commit is contained in:
parent
41556196e4
commit
1457853110
|
@ -13,7 +13,7 @@
|
|||
## See the file "license" for information on usage and redistribution of
|
||||
## this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
##
|
||||
## $Id: makefile,v 1.46 2003-12-04 22:22:53 stephena Exp $
|
||||
## $Id: makefile,v 1.47 2003-12-05 19:51:08 stephena Exp $
|
||||
##============================================================================
|
||||
|
||||
##============================================================================
|
||||
|
@ -23,7 +23,14 @@
|
|||
## Comment a line out to disable that option, remove comment to enable it.
|
||||
##============================================================================
|
||||
|
||||
OPTIMIZATIONS = $(CXXFLAGS) -Wall -Wunused
|
||||
### add your own compiler optimizations here
|
||||
### if none are provided, the defaults will be used
|
||||
OPTIMIZATIONS =
|
||||
|
||||
### which system the SDL version is being compiled on
|
||||
### you should only enable one at a time
|
||||
SYSTEM_SDL = linux
|
||||
#SYSTEM_SDL = windows
|
||||
|
||||
### which sound drivers to compile for the SDL version
|
||||
### OSS is most compatible, SDL for platforms where OSS not available
|
||||
|
@ -40,19 +47,17 @@ SOUND_SDL = 1
|
|||
JOYSTICK_SUPPORT = 1
|
||||
|
||||
### to include support for saving snapshots in png format
|
||||
### (requires PNG library) FIXME
|
||||
### Only SDL port supported for now FIXME
|
||||
# SNAPSHOT_SUPPORT = 1
|
||||
### (requires PNG library)
|
||||
SNAPSHOT_SUPPORT = 1
|
||||
|
||||
### comment this out if your system doesn't
|
||||
### have the gettimeofday function
|
||||
#HAVE_GETTIMEOFDAY = 1
|
||||
# HAVE_GETTIMEOFDAY = 1
|
||||
|
||||
### to include support for game developers
|
||||
### enables some extra commandline options that allow the user
|
||||
### to override some emulation defaults
|
||||
### Only SDL port supported for now
|
||||
DEVELOPER_SUPPORT = 1
|
||||
# DEVELOPER_SUPPORT = 1
|
||||
|
||||
### if your C++ compiler doesn't support the bool type
|
||||
# BSPF_BOOL = 1
|
||||
|
@ -79,7 +84,7 @@ OPTS.SDL =
|
|||
LIBS.SDL = `sdl-config --libs`
|
||||
CFLAGS.SDL = `sdl-config --cflags`
|
||||
|
||||
OPTS.DOS = -DDOS=1
|
||||
OPTS.DOS = -DDOS
|
||||
|
||||
SRC = ..
|
||||
CORE = $(SRC)/emucore
|
||||
|
@ -88,62 +93,94 @@ COMMON = $(SRC)/ui/common
|
|||
|
||||
INCLUDES = -I. -I$(CORE) -I$(CORE)/m6502/src -I$(CORE)/m6502/src/bspf/src -I$(COMMON)
|
||||
|
||||
FLAGS = $(OPTIMIZATIONS) $(INCLUDES) $(SYS_INCLUDES)
|
||||
## set some sane optimizations if none have been provided
|
||||
ifndef OPTIMIZATIONS
|
||||
ifdef CXXFLAGS
|
||||
OPTIMIZATIONS = $(CXXFLAGS)
|
||||
else
|
||||
OPTIMIZATIONS = -O2 -march=i386
|
||||
endif
|
||||
endif
|
||||
|
||||
FLAGS = $(OPTIMIZATIONS) -Wall -Wunused $(INCLUDES) $(SYS_INCLUDES)
|
||||
|
||||
## set the user-defined options
|
||||
ifdef BSPF_BOOL
|
||||
OPTS.DOS += -DBSPF_BOOL=1
|
||||
OPTS.DOS += -DBSPF_BOOL
|
||||
endif
|
||||
|
||||
ifdef SHOW_TIMING
|
||||
OPTS.SDL += -DSHOW_TIMING=1
|
||||
OPTS.DOS += -DSHOW_TIMING=1
|
||||
OPTS.SDL += -DSHOW_TIMING
|
||||
OPTS.DOS += -DSHOW_TIMING
|
||||
endif
|
||||
|
||||
ifdef DEBUG
|
||||
OPTS.SDL += -DDEBUG=1
|
||||
OPTS.DOS += -DDEBUG=1
|
||||
OPTS.SDL += -DDEBUG
|
||||
OPTS.DOS += -DDEBUG
|
||||
endif
|
||||
|
||||
ifdef JOYSTICK_SUPPORT
|
||||
OPTS.SDL += -DHAVE_JOYSTICK=1
|
||||
OPTS.SDL += -DHAVE_JOYSTICK
|
||||
endif
|
||||
|
||||
ifdef SNAPSHOT_SUPPORT
|
||||
OBJS.SDL += Snapshot.o
|
||||
OPTS.SDL += -DSNAPSHOT_SUPPORT=1
|
||||
LIBS.SDL += -lpng -lz
|
||||
OBJS.SDL += Snapshot.o
|
||||
OPTS.SDL += -DSNAPSHOT_SUPPORT
|
||||
LIBS.SDL += -lpng -lz
|
||||
endif
|
||||
|
||||
ifdef HAVE_GETTIMEOFDAY
|
||||
OPTS.SDL += -DHAVE_GETTIMEOFDAY=1
|
||||
OPTS.SDL += -DHAVE_GETTIMEOFDAY
|
||||
endif
|
||||
|
||||
ifdef DEVELOPER_SUPPORT
|
||||
OPTS.SDL += -DDEVELOPER_SUPPORT=1
|
||||
OPTS.DOS += -DDEVELOPER_SUPPORT=1
|
||||
OPTS.SDL += -DDEVELOPER_SUPPORT
|
||||
OPTS.DOS += -DDEVELOPER_SUPPORT
|
||||
endif
|
||||
|
||||
ifeq ($(sounD_OSS), 1)
|
||||
OPTS.SDL += -DSOUND_OSS=1
|
||||
ifeq ($(SOUND_OSS), 1)
|
||||
OPTS.SDL += -DSOUND_OSS
|
||||
OBJS.SDL += SoundOSS.o
|
||||
endif
|
||||
|
||||
ifeq ($(SOUND_SDL), 1)
|
||||
OPTS.SDL += -DSOUND_SDL=1
|
||||
OPTS.SDL += -DSOUND_SDL
|
||||
OBJS.SDL += SoundSDL.o
|
||||
endif
|
||||
|
||||
ifeq ($(SOUND_ALSA), 1)
|
||||
OPTS.SDL += -DSOUND_ALSA=1
|
||||
OPTS.SDL += -DSOUND_ALSA
|
||||
OBJS.SDL += SoundALSA.o
|
||||
LIBS.SDL += -lasound
|
||||
endif
|
||||
|
||||
ifeq ($(OPENGL_SUPPORT), 1)
|
||||
OPTS.SDL += -DDISPLAY_OPENGL=1
|
||||
OBJS.SDL += FrameBufferGL.o
|
||||
LIBS.SDL += -lopengl32
|
||||
##============================================================================
|
||||
## Now figure out what has to be built for SDL
|
||||
##============================================================================
|
||||
ifeq ($(SYSTEM_SDL), linux)
|
||||
CFLAGS.SDL += -L/usr/X11R6/lib
|
||||
OPTS.SDL += -DBSPF_UNIX -DUNIX
|
||||
LIBS.SDL += -lX11 -lXext
|
||||
OBJS.SDL += SettingsUNIX.o
|
||||
|
||||
ifeq ($(OPENGL_SUPPORT), 1)
|
||||
OPTS.SDL += -DDISPLAY_OPENGL
|
||||
OBJS.SDL += FrameBufferGL.o
|
||||
LIBS.SDL += -lGL
|
||||
endif
|
||||
endif
|
||||
|
||||
ifeq ($(SYSTEM_SDL), windows)
|
||||
CFLAGS.SDL += ""
|
||||
OPTS.SDL += -DBSPF_WIN32 -DWIN32
|
||||
LIBS.SDL += ""
|
||||
OBJS.SDL += SettingsWin32.o
|
||||
|
||||
ifeq ($(OPENGL_SUPPORT), 1)
|
||||
OPTS.SDL += -DDISPLAY_OPENGL -DTEXTURES_ARE_LOST
|
||||
OBJS.SDL += FrameBufferGL.o
|
||||
LIBS.SDL += -lopengl32
|
||||
endif
|
||||
endif
|
||||
|
||||
|
||||
|
@ -154,9 +191,8 @@ default:
|
|||
@echo ""
|
||||
@echo "<version> is one of:"
|
||||
@echo ""
|
||||
@echo " dos DOS version using DJGPP"
|
||||
@echo " linux-sdl Linux SDL version"
|
||||
@echo " win32-sdl Windows SDL version"
|
||||
@echo " dos DOS version using DJGPP"
|
||||
@echo " sdl SDL version (edit makefile for version)"
|
||||
@echo ""
|
||||
@echo "Hopefully new versions will be added soon!"
|
||||
@echo ""
|
||||
|
@ -166,36 +202,19 @@ dos:
|
|||
LD="gxx" \
|
||||
CXX="gcc" \
|
||||
INCLUDES="$(INCLUDES) -I$(UI)/dos -I$(UI)/sound" \
|
||||
OPTIONS="-DBSPF_DOS=1" \
|
||||
OPTIONS="-DBSPF_DOS" \
|
||||
OPTIONS+="$(OPTS.DOS)" \
|
||||
LDFLAGS="" \
|
||||
LDLIBS="" \
|
||||
OBJS="mainDOS.o PCJoys.o SndDOS.o dos_sb.o vga.o"
|
||||
|
||||
linux-sdl:
|
||||
sdl:
|
||||
make stella.sdl \
|
||||
INCLUDES="$(INCLUDES) -I$(UI)/sdl -I$(UI)/sound" \
|
||||
SYS_INCLUDES="" \
|
||||
OPTIONS="-DBSPF_UNIX=1 -DUNIX=1" \
|
||||
OPTIONS+="$(OPTS.SDL)" \
|
||||
LDFLAGS="-L/usr/X11R6/lib" \
|
||||
LDFLAGS+="$(CFLAGS.SDL)" \
|
||||
LDLIBS="-lX11 -lXext" \
|
||||
LDLIBS+="$(LIBS.SDL)" \
|
||||
OBJS="mainSDL.o SettingsUNIX.o FrameBufferSDL.o FrameBufferSoft.o" \
|
||||
OBJS+="$(OBJS.SDL)"
|
||||
|
||||
win32-sdl:
|
||||
make stella.sdl \
|
||||
INCLUDES="$(INCLUDES) -I$(UI)/sdl -I$(UI)/sound" \
|
||||
SYS_INCLUDES="" \
|
||||
OPTIONS="-DBSPF_UNIX=1 -DWIN32" \
|
||||
OPTIONS+="$(OPTS.SDL)" \
|
||||
LDFLAGS="" \
|
||||
LDFLAGS+="$(CFLAGS.SDL)" \
|
||||
LDLIBS="" \
|
||||
LDLIBS+="$(LIBS.SDL)" \
|
||||
OBJS="mainSDL.o SettingsWin32.o FrameBufferSDL.o FrameBufferSoft.o" \
|
||||
OPTIONS="$(OPTS.SDL)" \
|
||||
LDFLAGS="$(CFLAGS.SDL)" \
|
||||
LDLIBS="$(LIBS.SDL)" \
|
||||
OBJS="mainSDL.o FrameBufferSDL.o FrameBufferSoft.o" \
|
||||
OBJS+="$(OBJS.SDL)"
|
||||
|
||||
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: Settings.cxx,v 1.15 2003-12-04 19:18:45 stephena Exp $
|
||||
// $Id: Settings.cxx,v 1.16 2003-12-05 19:51:09 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <cassert>
|
||||
|
@ -50,8 +50,8 @@ Settings::Settings()
|
|||
set("palette", "standard");
|
||||
|
||||
#ifdef SNAPSHOT_SUPPORT
|
||||
set("ssdir", "");
|
||||
set("ssname", "");
|
||||
set("ssdir", ".");
|
||||
set("ssname", "romname");
|
||||
set("sssingle", "false");
|
||||
#endif
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: SettingsUNIX.cxx,v 1.5 2003-11-18 15:04:17 stephena Exp $
|
||||
// $Id: SettingsUNIX.cxx,v 1.6 2003-12-05 19:51:09 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <cstdlib>
|
||||
|
@ -73,11 +73,6 @@ SettingsUNIX::SettingsUNIX()
|
|||
set("hidecursor", "false");
|
||||
set("volume", "-1");
|
||||
set("accurate", "true");
|
||||
#ifdef SNAPSHOT_SUPPORT
|
||||
set("ssname", "romname");
|
||||
set("ssdir", "./");
|
||||
set("ssingle", "false");
|
||||
#endif
|
||||
set("joyleft", "0");
|
||||
set("joyright", "1");
|
||||
}
|
||||
|
|
|
@ -13,7 +13,7 @@
|
|||
// See the file "license" for information on usage and redistribution of
|
||||
// this file, and for a DISCLAIMER OF ALL WARRANTIES.
|
||||
//
|
||||
// $Id: mainSDL.cxx,v 1.64 2003-12-04 22:22:53 stephena Exp $
|
||||
// $Id: mainSDL.cxx,v 1.65 2003-12-05 19:51:09 stephena Exp $
|
||||
//============================================================================
|
||||
|
||||
#include <fstream>
|
||||
|
@ -43,6 +43,9 @@
|
|||
|
||||
#ifdef DISPLAY_OPENGL
|
||||
#include "FrameBufferGL.hxx"
|
||||
|
||||
// Indicates whether to use OpenGL mode
|
||||
static bool theUseOpenGLFlag;
|
||||
#endif
|
||||
|
||||
#ifdef SOUND_ALSA
|
||||
|
@ -57,11 +60,9 @@
|
|||
#include "SoundSDL.hxx"
|
||||
#endif
|
||||
|
||||
#ifdef UNIX
|
||||
#if defined(UNIX)
|
||||
#include "SettingsUNIX.hxx"
|
||||
#endif
|
||||
|
||||
#ifdef WIN32
|
||||
#elif defined(WIN32)
|
||||
#include "SettingsWin32.hxx"
|
||||
#endif
|
||||
|
||||
|
@ -343,7 +344,7 @@ void handleEvents()
|
|||
else if(key == SDLK_RETURN)
|
||||
theDisplay->toggleFullscreen();
|
||||
#ifdef DISPLAY_OPENGL
|
||||
else if(key == SDLK_f)
|
||||
else if(key == SDLK_f && theUseOpenGLFlag)
|
||||
((FrameBufferGL*)theDisplay)->toggleFilter();
|
||||
#endif
|
||||
#ifdef DEVELOPER_SUPPORT
|
||||
|
@ -666,10 +667,9 @@ void cleanup()
|
|||
// - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -
|
||||
int main(int argc, char* argv[])
|
||||
{
|
||||
#ifdef UNIX
|
||||
#if defined(UNIX)
|
||||
theSettings = new SettingsUNIX();
|
||||
#endif
|
||||
#ifdef WIN32
|
||||
#elif defined(WIN32)
|
||||
theSettings = new SettingsWin32();
|
||||
#endif
|
||||
if(!theSettings)
|
||||
|
@ -693,8 +693,11 @@ int main(int argc, char* argv[])
|
|||
theShowInfoFlag = theSettings->getBool("showinfo");
|
||||
|
||||
// Request that the SDL window be centered, if possible
|
||||
// This will probably only work under Linux
|
||||
#if defined(UNIX)
|
||||
setenv("SDL_VIDEO_CENTERED", "1", 1);
|
||||
#else
|
||||
putenv("SDL_VIDEO_CENTERED");
|
||||
#endif
|
||||
|
||||
// Get a pointer to the file which contains the cartridge ROM
|
||||
const char* file = argv[argc - 1];
|
||||
|
@ -734,6 +737,7 @@ int main(int argc, char* argv[])
|
|||
else if(videodriver == "gl")
|
||||
{
|
||||
theDisplay = new FrameBufferGL();
|
||||
theUseOpenGLFlag = true;
|
||||
if(theShowInfoFlag)
|
||||
cout << "Using OpenGL mode for video.\n";
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue