mirror of https://github.com/encounter/SDL.git
Add basic support for compiling on RISC OS
This commit is contained in:
parent
033aa51d87
commit
8f1a916ac5
|
@ -129,7 +129,7 @@ elseif(CMAKE_SYSTEM_NAME MATCHES "Haiku.*")
|
|||
endif()
|
||||
|
||||
# Don't mistake osx for unix
|
||||
if(UNIX AND NOT APPLE)
|
||||
if(UNIX AND NOT APPLE AND NOT RISCOS)
|
||||
set(UNIX_SYS ON)
|
||||
else()
|
||||
set(UNIX_SYS OFF)
|
||||
|
@ -341,7 +341,7 @@ set_option(VIDEO_OPENGLES "Include OpenGL ES support" ON)
|
|||
set_option(PTHREADS "Use POSIX threads for multi-threading" ${SDL_PTHREADS_ENABLED_BY_DEFAULT})
|
||||
dep_option(PTHREADS_SEM "Use pthread semaphores" ON "PTHREADS" OFF)
|
||||
set_option(SDL_DLOPEN "Use dlopen for shared object loading" ${SDL_DLOPEN_ENABLED_BY_DEFAULT})
|
||||
set_option(OSS "Support the OSS audio API" ${UNIX_SYS})
|
||||
dep_option(OSS "Support the OSS audio API" ON "UNIX_SYS OR RISCOS" OFF)
|
||||
set_option(ALSA "Support the ALSA audio API" ${UNIX_SYS})
|
||||
dep_option(ALSA_SHARED "Dynamically load ALSA audio support" ON "ALSA" OFF)
|
||||
set_option(JACK "Support the JACK audio API" ${UNIX_SYS})
|
||||
|
@ -1091,7 +1091,7 @@ elseif(EMSCRIPTEN)
|
|||
endif()
|
||||
endif()
|
||||
|
||||
elseif(UNIX AND NOT APPLE AND NOT ANDROID)
|
||||
elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS)
|
||||
if(SDL_AUDIO)
|
||||
if(SYSV5 OR SOLARIS OR HPUX)
|
||||
set(SDL_AUDIO_DRIVER_SUNAUDIO 1)
|
||||
|
@ -1814,6 +1814,24 @@ elseif(HAIKU)
|
|||
endif()
|
||||
|
||||
CheckPTHREAD()
|
||||
|
||||
elseif(RISCOS)
|
||||
if(SDL_TIMERS)
|
||||
set(SDL_TIMER_UNIX 1)
|
||||
file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/unix/*.c)
|
||||
set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES})
|
||||
set(HAVE_SDL_TIMERS TRUE)
|
||||
|
||||
if(CLOCK_GETTIME)
|
||||
set(HAVE_CLOCK_GETTIME 1)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
CheckPTHREAD()
|
||||
|
||||
if(SDL_AUDIO)
|
||||
CheckOSS()
|
||||
endif()
|
||||
endif()
|
||||
|
||||
if(VIDEO_VULKAN)
|
||||
|
|
|
@ -25365,6 +25365,27 @@ $as_echo "#define SDL_FILESYSTEM_EMSCRIPTEN 1" >>confdefs.h
|
|||
# Set up files for the timer library
|
||||
if test x$enable_timers = xyes; then
|
||||
|
||||
$as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h
|
||||
|
||||
SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
|
||||
have_timers=yes
|
||||
fi
|
||||
;;
|
||||
*-*-riscos*)
|
||||
ARCH=riscos
|
||||
CheckVisibilityHidden
|
||||
CheckDeclarationAfterStatement
|
||||
CheckDummyVideo
|
||||
CheckDiskAudio
|
||||
CheckDummyAudio
|
||||
CheckDLOPEN
|
||||
CheckOSS
|
||||
CheckPTHREAD
|
||||
CheckClockGettime
|
||||
|
||||
# Set up files for the timer library
|
||||
if test x$enable_timers = xyes; then
|
||||
|
||||
$as_echo "#define SDL_TIMER_UNIX 1" >>confdefs.h
|
||||
|
||||
SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
|
||||
|
|
19
configure.ac
19
configure.ac
|
@ -4056,6 +4056,25 @@ AS_HELP_STRING([--enable-render-d3d], [enable the Direct3D render driver [[defau
|
|||
SOURCES="$SOURCES $srcdir/src/filesystem/emscripten/*.c"
|
||||
have_filesystem=yes
|
||||
fi
|
||||
# Set up files for the timer library
|
||||
if test x$enable_timers = xyes; then
|
||||
AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
|
||||
SOURCES="$SOURCES $srcdir/src/timer/unix/*.c"
|
||||
have_timers=yes
|
||||
fi
|
||||
;;
|
||||
*-*-riscos*)
|
||||
ARCH=riscos
|
||||
CheckVisibilityHidden
|
||||
CheckDeclarationAfterStatement
|
||||
CheckDummyVideo
|
||||
CheckDiskAudio
|
||||
CheckDummyAudio
|
||||
CheckDLOPEN
|
||||
CheckOSS
|
||||
CheckPTHREAD
|
||||
CheckClockGettime
|
||||
|
||||
# Set up files for the timer library
|
||||
if test x$enable_timers = xyes; then
|
||||
AC_DEFINE(SDL_TIMER_UNIX, 1, [ ])
|
||||
|
|
|
@ -32,6 +32,10 @@
|
|||
#include <atomic.h>
|
||||
#endif
|
||||
|
||||
#if !defined(HAVE_GCC_ATOMICS) && defined(__RISCOS__)
|
||||
#include <unixlib/local.h>
|
||||
#endif
|
||||
|
||||
#if defined(_MSC_VER) && (defined(_M_IX86) || defined(_M_X64))
|
||||
#include <xmmintrin.h>
|
||||
#endif
|
||||
|
@ -84,6 +88,16 @@ SDL_AtomicTryLock(SDL_SpinLock *lock)
|
|||
defined(__ARM_ARCH_5__) || defined(__ARM_ARCH_5TE__) || \
|
||||
defined(__ARM_ARCH_5TEJ__))
|
||||
int result;
|
||||
|
||||
#if defined(__RISCOS__)
|
||||
if (__cpucap_have_rex()) {
|
||||
__asm__ __volatile__ (
|
||||
"ldrex %0, [%2]\nteq %0, #0\nstrexeq %0, %1, [%2]"
|
||||
: "=&r" (result) : "r" (1), "r" (lock) : "cc", "memory");
|
||||
return (result == 0);
|
||||
}
|
||||
#endif
|
||||
|
||||
__asm__ __volatile__ (
|
||||
"swp %0, %1, [%2]\n"
|
||||
: "=&r,&r" (result) : "r,0" (1), "r,r" (lock) : "memory");
|
||||
|
|
|
@ -53,6 +53,8 @@
|
|||
#define SDL_DYNAMIC_API 0
|
||||
#elif defined(__PSP__) && __PSP__
|
||||
#define SDL_DYNAMIC_API 0
|
||||
#elif defined(__riscos__) && __riscos__ /* probably not useful on RISC OS, since dlopen() can't be used when using static linking. */
|
||||
#define SDL_DYNAMIC_API 0
|
||||
#elif defined(__clang_analyzer__)
|
||||
#define SDL_DYNAMIC_API 0 /* Turn off for static analysis, so reports are more clear. */
|
||||
#endif
|
||||
|
|
|
@ -188,7 +188,7 @@ SDL_ThreadID(void)
|
|||
int
|
||||
SDL_SYS_SetThreadPriority(SDL_ThreadPriority priority)
|
||||
{
|
||||
#if __NACL__
|
||||
#if __NACL__ || __RISCOS__
|
||||
/* FIXME: Setting thread priority does not seem to be supported in NACL */
|
||||
return 0;
|
||||
#elif __LINUX__
|
||||
|
|
|
@ -2988,6 +2988,11 @@ fi
|
|||
MATHLIB=""
|
||||
SYS_GL_LIBS=""
|
||||
;;
|
||||
*-*-riscos* )
|
||||
EXE=",e1f"
|
||||
MATHLIB=""
|
||||
SYS_GL_LIBS=""
|
||||
;;
|
||||
*)
|
||||
ISUNIX="true"
|
||||
EXE=""
|
||||
|
|
|
@ -71,6 +71,11 @@ case "$host" in
|
|||
MATHLIB=""
|
||||
SYS_GL_LIBS=""
|
||||
;;
|
||||
*-*-riscos* )
|
||||
EXE=",e1f"
|
||||
MATHLIB=""
|
||||
SYS_GL_LIBS=""
|
||||
;;
|
||||
*)
|
||||
dnl Oh well, call it Unix...
|
||||
ISUNIX="true"
|
||||
|
|
Loading…
Reference in New Issue