Skip to content
Snippets Groups Projects
Commit 9ee9b19c authored by deuce's avatar deuce
Browse files

SDL back where it belongs...

parent f389631e
No related branches found
No related tags found
No related merge requests found
...@@ -27,6 +27,84 @@ endif ...@@ -27,6 +27,84 @@ endif
ifdef NO_X ifdef NO_X
ifndef WITH_SDL ifndef WITH_SDL
CIOLIB-MT_CFLAGS += -DNO_FONTS CIOLIB-MT_CFLAGS += -DNO_FONTS
CIOLIB-CFLAGS += -DNO_FONTS CIOLIB_CFLAGS += -DNO_FONTS
endif
endif
# Find SDL headers!
ifdef USE_SDL
ifndef WITH_SDL_AUDIO
ifdef SDL_CONFIG
ifeq ($(shell ${SDL_CONFIG} --cflags > /dev/null 2>&1 && echo YES),YES)
WITH_SDL := 1
endif
else
ifeq ($(os),darwin)
ifeq ($(shell if [ -d /Library/Frameworks/SDL.framework ] ; then echo YES ; fi),YES)
WITH_SDL := 1
endif
else
ifeq ($(shell sdl-config --cflags > /dev/null 2>&1 && echo YES),YES)
SDL_CONFIG := sdl-config
WITH_SDL := 1
else
ifeq ($(shell sdl13-config --cflags > /dev/null 2>&1 && echo YES),YES)
SDL_CONFIG := sdl13-config
WITH_SDL := 1
else
ifeq ($(shell sdl12-config --cflags > /dev/null 2>&1 && echo YES),YES)
SDL_CONFIG := sdl12-config
WITH_SDL := 1
else
ifeq ($(shell sdl11-config --cflags > /dev/null 2>&1 && echo YES),YES)
SDL_CONFIG := sdl11-config
WITH_SDL := 1
endif
endif
endif
endif
endif
endif
endif
endif
ifdef WITH_SDL
ifndef WITH_SDL_AUDIO
ifdef SDL_CONFIG
ifeq ($(shell ${SDL_CONFIG} --cflags > /dev/null 2>&1 && echo YES),YES)
CIOLIB-MT_CFLAGS += -DWITH_SDL
CIOLIB-MT_CFLAGS += $(shell $(SDL_CONFIG) --cflags)
CIOLIB_CFLAGS += -DWITH_SDL
CIOLIB_CFLAGS += $(shell $(SDL_CONFIG) --cflags)
ifdef STATIC_SDL
CIOLIB-MT_LIBS += $(shell $(SDL_CONFIG) --static-libs)
CIOLIB-MT_CFLAGS += -DSTATIC_SDL
CIOLIB-LIBS += $(shell $(SDL_CONFIG) --static-libs)
CIOLIB-CFLAGS += -DSTATIC_SDL
else
ifeq ($(os),darwin)
CIOLIB-MT_LIBS += $(UL_PRE)dl$(UL_SUF)
CIOLIB_LIBS += $(UL_PRE)dl$(UL_SUF)
endif
ifeq ($(os),linux)
CIOLIB-MT_LIBS += $(UL_PRE)dl$(UL_SUF)
CIOLIB_LIBS += $(UL_PRE)dl$(UL_SUF)
endif
ifeq ($(os),sunos)
CIOLIB-MT_LIBS += $(UL_PRE)dl$(UL_SUF)
CIOLIB_LIBS += $(UL_PRE)dl$(UL_SUF)
endif
endif
endif
else
ifeq ($(os),darwin)
CIOLIB-MT_CFLAGS += -DWITH_SDL -DSTATIC_SDL
CIOLIB-MT_CFLAGS += -I/Library/Frameworks/SDL.framework/Headers
CIOLIB-MT_LIBS += -framework SDL -framework Cocoa -framework Carbon -I/Library/Frameworks/SDL.framework/Headers
CIOLIB_CFLAGS += -DWITH_SDL -DSTATIC_SDL
CIOLIB_CFLAGS += -I/Library/Frameworks/SDL.framework/Headers
CIOLIB_LIBS += -framework SDL -framework Cocoa -framework Carbon -I/Library/Frameworks/SDL.framework/Headers
endif
endif
endif endif
endif endif
...@@ -12,8 +12,17 @@ else ...@@ -12,8 +12,17 @@ else
$(MTOBJODIR)$(DIRSEP)x_cio$(OFILE) $(MTOBJODIR)$(DIRSEP)x_cio$(OFILE)
endif endif
ifdef WITH_SDL ifdef WITH_SDL_AUDIO
OBJS += $(MTOBJODIR)$(DIRSEP)sdl_con$(OFILE) OBJS += $(MTOBJODIR)$(DIRSEP)sdl_con$(OFILE)
else
ifdef WITH_SDL
OBJS += $(MTOBJODIR)$(DIRSEP)sdl_con$(OFILE)
OBJS += $(MTOBJODIR)$(DIRSEP)sdlfuncs$(OFILE)
ifeq ($(os),darwin)
MTOBJS += $(MTOBJODIR)$(DIRSEP)SDLMain$(OFILE)
OBJS += $(OBJODIR)$(DIRSEP)SDLMain$(OFILE)
endif
endif
endif endif
ifeq ($(os),netbsd) ifeq ($(os),netbsd)
......
...@@ -48,7 +48,7 @@ ...@@ -48,7 +48,7 @@
#define CIOLIB_NO_MACROS #define CIOLIB_NO_MACROS
#include "ciolib.h" #include "ciolib.h"
#ifdef WITH_SDL #if defined(WITH_SDL) || defined(WITH_SDL_AUDIO)
#include "sdl_con.h" #include "sdl_con.h"
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
...@@ -111,7 +111,7 @@ CIOLIBEXPORT char * CIOLIBCALL ciolib_getcliptext(void); ...@@ -111,7 +111,7 @@ CIOLIBEXPORT char * CIOLIBCALL ciolib_getcliptext(void);
#define CIOLIB_INIT() { if(initialized != 1) initciolib(CIOLIB_MODE_AUTO); } #define CIOLIB_INIT() { if(initialized != 1) initciolib(CIOLIB_MODE_AUTO); }
#ifdef WITH_SDL #if defined(WITH_SDL) || defined(WITH_SDL_AUDIO)
int try_sdl_init(int mode) int try_sdl_init(int mode)
{ {
if(!sdl_initciolib(mode)) { if(!sdl_initciolib(mode)) {
...@@ -304,7 +304,7 @@ CIOLIBEXPORT int CIOLIBCALL initciolib(int mode) ...@@ -304,7 +304,7 @@ CIOLIBEXPORT int CIOLIBCALL initciolib(int mode)
switch(mode) { switch(mode) {
case CIOLIB_MODE_AUTO: case CIOLIB_MODE_AUTO:
#ifdef WITH_SDL #if defined(WITH_SDL) || defined(WITH_SDL_AUDIO)
if(!try_sdl_init(mode)) if(!try_sdl_init(mode))
#endif #endif
#ifdef _WIN32 #ifdef _WIN32
...@@ -337,7 +337,7 @@ CIOLIBEXPORT int CIOLIBCALL initciolib(int mode) ...@@ -337,7 +337,7 @@ CIOLIBEXPORT int CIOLIBCALL initciolib(int mode)
try_ansi_init(mode); try_ansi_init(mode);
break; break;
#ifdef WITH_SDL #if defined(WITH_SDL) || defined(WITH_SDL_AUDIO)
case CIOLIB_MODE_SDL: case CIOLIB_MODE_SDL:
case CIOLIB_MODE_SDL_FULLSCREEN: case CIOLIB_MODE_SDL_FULLSCREEN:
try_sdl_init(mode); try_sdl_init(mode);
......
...@@ -361,4 +361,13 @@ CIOLIBEXPORT int CIOLIBCALL ciolib_loadfont(char *filename); ...@@ -361,4 +361,13 @@ CIOLIBEXPORT int CIOLIBCALL ciolib_loadfont(char *filename);
#define loadfont(a) ciolib_loadfont(a) #define loadfont(a) ciolib_loadfont(a)
#endif #endif
#ifdef WITH_SDL
#include <SDL.h>
#ifdef main
#undef main
#endif
#define main CIOLIB_main
#endif
#endif /* Do not add anything after this line */ #endif /* Do not add anything after this line */
...@@ -28,7 +28,7 @@ static int main_returned=0; ...@@ -28,7 +28,7 @@ static int main_returned=0;
static SDL_sem *sdl_main_sem; static SDL_sem *sdl_main_sem;
SDL_sem *sdl_exit_sem; SDL_sem *sdl_exit_sem;
int XPDEV_main(int argc, char **argv, char **enviro); int CIOLIB_main(int argc, char **argv, char **enviro);
#ifdef STATIC_SDL #ifdef STATIC_SDL
int load_sdl_funcs(struct sdlfuncs *sdlf) int load_sdl_funcs(struct sdlfuncs *sdlf)
...@@ -479,7 +479,7 @@ static int sdl_run_main(void *data) ...@@ -479,7 +479,7 @@ static int sdl_run_main(void *data)
int ret; int ret;
args=data; args=data;
ret=XPDEV_main(args->argc, args->argv, args->enviro); ret=CIOLIB_main(args->argc, args->argv, args->enviro);
main_returned=1; main_returned=1;
sdl.SemPost(sdl_main_sem); sdl.SemPost(sdl_main_sem);
if(sdl_exit_drawing_thread!=NULL) if(sdl_exit_drawing_thread!=NULL)
...@@ -589,6 +589,6 @@ int SDL_main_env(int argc, char **argv, char **env) ...@@ -589,6 +589,6 @@ int SDL_main_env(int argc, char **argv, char **env)
sdl.WaitThread(main_thread, &main_ret); sdl.WaitThread(main_thread, &main_ret);
} }
else else
main_ret=XPDEV_main(argc, argv, env); main_ret=CIOLIB_main(argc, argv, env);
return(main_ret); return(main_ret);
} }
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment