CMake support
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 6d0a3aa..a0d1b19 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -204,7 +204,7 @@ if(APPLE OR ARCH_64)
set(OPT_DEF_SSEMATH ON)
endif()
endif()
-if(UNIX OR MINGW OR MSYS OR USE_CLANG)
+if(UNIX OR MINGW OR MSYS OR USE_CLANG OR VITA)
set(OPT_DEF_LIBC ON)
endif()
@@ -299,6 +299,12 @@ if(EMSCRIPTEN)
set(SDL_DLOPEN_ENABLED_BY_DEFAULT OFF)
endif()
+if(VITA)
+ set(SDL_SHARED_ENABLED_BY_DEFAULT OFF)
+ set(SDL_LOADSO_ENABLED_BY_DEFAULT OFF)
+ set(SDL_DLOPEN_ENABLED_BY_DEFAULT OFF)
+endif()
+
# When defined, respect CMake's BUILD_SHARED_LIBS setting:
set(SDL_STATIC_ENABLED_BY_DEFAULT ON)
if (NOT DEFINED SDL_SHARED_ENABLED_BY_DEFAULT)
@@ -855,7 +861,9 @@ if(LIBC)
check_symbol_exists("${_FN}" "math.h" ${_HAVEVAR})
endforeach()
set(CMAKE_REQUIRED_LIBRARIES)
- list(APPEND EXTRA_LIBS m)
+ if(NOT VITA)
+ list(APPEND EXTRA_LIBS m)
+ endif()
endif()
check_library_exists(iconv iconv_open "" HAVE_LIBICONV)
@@ -2006,6 +2014,133 @@ elseif(RISCOS)
if(SDL_AUDIO)
CheckOSS()
endif()
+elseif(VITA)
+ # SDL_spinlock.c Needs to be compiled in ARM mode.
+ check_c_compiler_flag(-marm HAVE_ARM_MODE)
+ if(HAVE_ARM_MODE)
+ set_source_files_properties(${SDL2_SOURCE_DIR}/src/atomic/SDL_spinlock.c PROPERTIES COMPILE_FLAGS -marm)
+ endif()
+
+ if(SDL_AUDIO)
+ set(SDL_AUDIO_DRIVER_VITA 1)
+ file(GLOB VITA_AUDIO_SOURCES ${SDL2_SOURCE_DIR}/src/audio/vita/*.c)
+ set(SOURCE_FILES ${SOURCE_FILES} ${VITA_AUDIO_SOURCES})
+ set(HAVE_SDL_AUDIO TRUE)
+ endif()
+ if(SDL_FILESYSTEM)
+ set(SDL_FILESYSTEM_VITA 1)
+ file(GLOB VITA_FILESYSTEM_SOURCES ${SDL2_SOURCE_DIR}/src/filesystem/vita/*.c)
+ set(SOURCE_FILES ${SOURCE_FILES} ${VITA_FILESYSTEM_SOURCES})
+ set(HAVE_SDL_FILESYSTEM TRUE)
+ endif()
+ if(SDL_JOYSTICK)
+ set(SDL_JOYSTICK_VITA 1)
+ file(GLOB VITA_JOYSTICK_SOURCES ${SDL2_SOURCE_DIR}/src/joystick/vita/*.c)
+ set(SOURCE_FILES ${SOURCE_FILES} ${VITA_JOYSTICK_SOURCES})
+ set(HAVE_SDL_JOYSTICK TRUE)
+ endif()
+ if(SDL_POWER)
+ set(SDL_POWER_VITA 1)
+ file(GLOB VITA_POWER_SOURCES ${SDL2_SOURCE_DIR}/src/power/vita/*.c)
+ set(SOURCE_FILES ${SOURCE_FILES} ${VITA_POWER_SOURCES})
+ set(HAVE_SDL_POWER TRUE)
+ endif()
+ if(SDL_THREADS)
+ set(SDL_THREAD_VITA 1)
+ set(SOURCE_FILES ${SOURCE_FILES}
+ ${SDL2_SOURCE_DIR}/src/thread/vita/SDL_sysmutex.c
+ ${SDL2_SOURCE_DIR}/src/thread/vita/SDL_syssem.c
+ ${SDL2_SOURCE_DIR}/src/thread/vita/SDL_systhread.c
+ ${SDL2_SOURCE_DIR}/src/thread/vita/SDL_syscond.c
+ ${SDL2_SOURCE_DIR}/src/thread/generic/SDL_systls.c)
+ set(HAVE_SDL_THREADS TRUE)
+ endif()
+ if(SDL_TIMERS)
+ set(SDL_TIMER_VITA 1)
+ file(GLOB TIMER_SOURCES ${SDL2_SOURCE_DIR}/src/timer/vita/*.c)
+ set(SOURCE_FILES ${SOURCE_FILES} ${TIMER_SOURCES})
+ set(HAVE_SDL_TIMERS TRUE)
+ endif()
+ if(SDL_SENSOR)
+ set(SDL_SENSOR_VITA 1)
+ set(HAVE_SDL_SENSORS TRUE)
+ file(GLOB VITA_SENSOR_SOURCES ${SDL2_SOURCE_DIR}/src/sensor/vita/*.c)
+ set(SOURCE_FILES ${SOURCE_FILES} ${VITA_SENSOR_SOURCES})
+ endif()
+ if(SDL_VIDEO)
+ set(SDL_VIDEO_DRIVER_VITA 1)
+ file(GLOB VITA_VIDEO_SOURCES ${SDL2_SOURCE_DIR}/src/video/vita/*.c)
+ set(SOURCE_FILES ${SOURCE_FILES} ${VITA_VIDEO_SOURCES})
+ set(HAVE_SDL_VIDEO TRUE)
+
+ if(DOLCESDK)
+ add_definitions("-DDOLCEVITA")
+ set(SDL_VIDEO_OPENGL_ES2 1)
+ set(SDL_VIDEO_RENDER_VITA_GLES2 1)
+ else()
+ add_definitions("-DSCE_OK=0")
+ endif()
+ set(SDL_VIDEO_RENDER_VITA_GXM 1)
+
+ if(DOLCESDK)
+ list(APPEND EXTRA_LIBS
+ pib
+ SceGxm_stub
+ SceGxmInternalForVsh_stub
+ SceDisplay_stub
+ SceCtrl_stub
+ SceAppMgr_stub
+ SceAppMgrUser_stub
+ SceAudio_stub
+ SceSysmodule_stub
+ SceSharedFb_stub
+ SceDisplay_stub
+ SceDisplayUser_stub
+ SceCtrl_stub
+ SceIofilemgr_stub
+ SceCommonDialog_stub
+ SceTouch_stub
+ SceHid_stub
+ SceMotion_stub
+ m
+ )
+ else()
+ list(APPEND EXTRA_LIBS
+ SceGxm_stub
+ SceDisplay_stub
+ SceCtrl_stub
+ SceAppMgr_stub
+ SceAudio_stub
+ SceSysmodule_stub
+ SceDisplay_stub
+ SceCtrl_stub
+ SceIofilemgr_stub
+ SceCommonDialog_stub
+ SceTouch_stub
+ SceHid_stub
+ SceMotion_stub
+ m
+ )
+ endif()
+ endif()
+
+ set(HAVE_ARMSIMD TRUE)
+ set(SDL_ARM_SIMD_BLITTERS 1)
+ file(GLOB ARMSIMD_SOURCES ${SDL2_SOURCE_DIR}/src/video/arm/pixman-arm-simd*.S)
+ set(SOURCE_FILES ${SOURCE_FILES} ${ARMSIMD_SOURCES})
+
+ set(HAVE_ARMNEON TRUE)
+ set(SDL_ARM_NEON_BLITTERS 1)
+ file(GLOB ARMNEON_SOURCES ${SDL2_SOURCE_DIR}/src/video/arm/pixman-arm-neon*.S)
+ set(SOURCE_FILES ${SOURCE_FILES} ${ARMNEON_SOURCES})
+
+ set_property(SOURCE ${SDL2_SOURCE_DIR}/src/video/arm/pixman-arm-simd-asm.S PROPERTY LANGUAGE C)
+ set_property(SOURCE ${SDL2_SOURCE_DIR}/src/video/arm/pixman-arm-neon-asm.S PROPERTY LANGUAGE C)
+
+ add_definitions("-D__VITA__")
+
+ CheckPTHREAD()
+
endif()
if(VIDEO_VULKAN)
@@ -2105,7 +2240,17 @@ if(NOT CMAKE_HOST_WIN32)
WORKING_DIRECTORY ${SDL2_BINARY_DIR})
endif()
if(NOT WINDOWS OR CYGWIN)
- set(prefix ${CMAKE_INSTALL_PREFIX})
+
+ if(VITA)
+ if(DOLCESDK)
+ set(prefix "\${DOLCESDK}/arm-dolce-eabi")
+ else()
+ set(prefix "\${VITASDK}/arm-vita-eabi")
+ endif()
+ else()
+ set(prefix ${CMAKE_INSTALL_PREFIX})
+ endif()
+
set(exec_prefix "\${prefix}")
set(libdir "\${exec_prefix}/lib${LIB_SUFFIX}")
set(bindir "\${exec_prefix}/bin")
@@ -2129,13 +2274,23 @@ Libs.private:")
endif()
# Clean up the different lists
- listtostr(EXTRA_LIBS _EXTRA_LIBS "-l")
- set(SDL_STATIC_LIBS ${EXTRA_LDFLAGS} ${_EXTRA_LIBS})
- list(REMOVE_DUPLICATES SDL_STATIC_LIBS)
- listtostr(SDL_STATIC_LIBS _SDL_STATIC_LIBS)
- set(SDL_STATIC_LIBS ${_SDL_STATIC_LIBS})
- listtostr(SDL_LIBS _SDL_LIBS)
- set(SDL_LIBS ${_SDL_LIBS})
+ if (VITA)
+ listtostrrev(EXTRA_LIBS _EXTRA_LIBS "-l")
+ set(SDL_STATIC_LIBS ${SDL_LIBS} ${EXTRA_LDFLAGS} ${_EXTRA_LIBS})
+ list(REMOVE_DUPLICATES SDL_STATIC_LIBS)
+ listtostrrev(SDL_STATIC_LIBS _SDL_STATIC_LIBS)
+ set(SDL_STATIC_LIBS ${_SDL_STATIC_LIBS})
+ listtostrrev(SDL_LIBS _SDL_LIBS)
+ set(SDL_LIBS ${_SDL_LIBS})
+ else()
+ listtostr(EXTRA_LIBS _EXTRA_LIBS "-l")
+ set(SDL_STATIC_LIBS ${SDL_LIBS} ${EXTRA_LDFLAGS} ${_EXTRA_LIBS})
+ list(REMOVE_DUPLICATES SDL_STATIC_LIBS)
+ listtostr(SDL_STATIC_LIBS _SDL_STATIC_LIBS)
+ set(SDL_STATIC_LIBS ${_SDL_STATIC_LIBS})
+ listtostr(SDL_LIBS _SDL_LIBS)
+ set(SDL_LIBS ${_SDL_LIBS})
+ endif()
# MESSAGE(STATUS "SDL_LIBS: ${SDL_LIBS}")
# MESSAGE(STATUS "SDL_STATIC_LIBS: ${SDL_STATIC_LIBS}")
diff --git a/include/SDL_config.h.cmake b/include/SDL_config.h.cmake
index fb56e35..d2a4f40 100644
--- a/include/SDL_config.h.cmake
+++ b/include/SDL_config.h.cmake
@@ -295,6 +295,7 @@
#cmakedefine SDL_AUDIO_DRIVER_WASAPI @SDL_AUDIO_DRIVER_WASAPI@
#cmakedefine SDL_AUDIO_DRIVER_WINMM @SDL_AUDIO_DRIVER_WINMM@
#cmakedefine SDL_AUDIO_DRIVER_OS2 @SDL_AUDIO_DRIVER_OS2@
+#cmakedefine SDL_AUDIO_DRIVER_VITA @SDL_AUDIO_DRIVER_VITA@
/* Enable various input drivers */
#cmakedefine SDL_INPUT_LINUXEV @SDL_INPUT_LINUXEV@
@@ -314,6 +315,7 @@
#cmakedefine SDL_JOYSTICK_HIDAPI @SDL_JOYSTICK_HIDAPI@
#cmakedefine SDL_JOYSTICK_EMSCRIPTEN @SDL_JOYSTICK_EMSCRIPTEN@
#cmakedefine SDL_JOYSTICK_VIRTUAL @SDL_JOYSTICK_VIRTUAL@
+#cmakedefine SDL_JOYSTICK_VITA @SDL_JOYSTICK_VITA@
#cmakedefine SDL_HAPTIC_DUMMY @SDL_HAPTIC_DUMMY@
#cmakedefine SDL_HAPTIC_LINUX @SDL_HAPTIC_LINUX@
#cmakedefine SDL_HAPTIC_IOKIT @SDL_HAPTIC_IOKIT@
@@ -327,6 +329,7 @@
#cmakedefine SDL_SENSOR_COREMOTION @SDL_SENSOR_COREMOTION@
#cmakedefine SDL_SENSOR_WINDOWS @SDL_SENSOR_WINDOWS@
#cmakedefine SDL_SENSOR_DUMMY @SDL_SENSOR_DUMMY@
+#cmakedefine SDL_SENSOR_VITA @SDL_SENSOR_VITA@
/* Enable various shared object loading systems */
#cmakedefine SDL_LOADSO_DLOPEN @SDL_LOADSO_DLOPEN@
@@ -342,6 +345,7 @@
#cmakedefine SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP @SDL_THREAD_PTHREAD_RECURSIVE_MUTEX_NP@
#cmakedefine SDL_THREAD_WINDOWS @SDL_THREAD_WINDOWS@
#cmakedefine SDL_THREAD_OS2 @SDL_THREAD_OS2@
+#cmakedefine SDL_THREAD_VITA @SDL_THREAD_VITA@
/* Enable various timer systems */
#cmakedefine SDL_TIMER_HAIKU @SDL_TIMER_HAIKU@
@@ -349,6 +353,7 @@
#cmakedefine SDL_TIMER_UNIX @SDL_TIMER_UNIX@
#cmakedefine SDL_TIMER_WINDOWS @SDL_TIMER_WINDOWS@
#cmakedefine SDL_TIMER_OS2 @SDL_TIMER_OS2@
+#cmakedefine SDL_TIMER_VITA @SDL_TIMER_VITA@
/* Enable various video drivers */
#cmakedefine SDL_VIDEO_DRIVER_ANDROID @SDL_VIDEO_DRIVER_ANDROID@
@@ -400,6 +405,7 @@
#cmakedefine SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS @SDL_VIDEO_DRIVER_X11_SUPPORTS_GENERIC_EVENTS@
#cmakedefine SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY @SDL_VIDEO_DRIVER_X11_CONST_PARAM_XEXTADDDISPLAY@
#cmakedefine SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM @SDL_VIDEO_DRIVER_X11_HAS_XKBKEYCODETOKEYSYM@
+#cmakedefine SDL_VIDEO_DRIVER_VITA @SDL_VIDEO_DRIVER_VITA@
#cmakedefine SDL_VIDEO_RENDER_D3D @SDL_VIDEO_RENDER_D3D@
#cmakedefine SDL_VIDEO_RENDER_D3D11 @SDL_VIDEO_RENDER_D3D11@
@@ -408,6 +414,8 @@
#cmakedefine SDL_VIDEO_RENDER_OGL_ES2 @SDL_VIDEO_RENDER_OGL_ES2@
#cmakedefine SDL_VIDEO_RENDER_DIRECTFB @SDL_VIDEO_RENDER_DIRECTFB@
#cmakedefine SDL_VIDEO_RENDER_METAL @SDL_VIDEO_RENDER_METAL@
+#cmakedefine SDL_VIDEO_RENDER_VITA_GLES2 @SDL_VIDEO_RENDER_VITA_GLES2@
+#cmakedefine SDL_VIDEO_RENDER_VITA_GXM @SDL_VIDEO_RENDER_VITA_GXM@
/* Enable OpenGL support */
#cmakedefine SDL_VIDEO_OPENGL @SDL_VIDEO_OPENGL@
@@ -437,6 +445,7 @@
#cmakedefine SDL_POWER_HAIKU @SDL_POWER_HAIKU@
#cmakedefine SDL_POWER_EMSCRIPTEN @SDL_POWER_EMSCRIPTEN@
#cmakedefine SDL_POWER_HARDWIRED @SDL_POWER_HARDWIRED@
+#cmakedefine SDL_POWER_VITA @SDL_POWER_VITA@
/* Enable system filesystem support */
#cmakedefine SDL_FILESYSTEM_ANDROID @SDL_FILESYSTEM_ANDROID@
@@ -447,6 +456,7 @@
#cmakedefine SDL_FILESYSTEM_WINDOWS @SDL_FILESYSTEM_WINDOWS@
#cmakedefine SDL_FILESYSTEM_EMSCRIPTEN @SDL_FILESYSTEM_EMSCRIPTEN@
#cmakedefine SDL_FILESYSTEM_OS2 @SDL_FILESYSTEM_OS2@
+#cmakedefine SDL_FILESYSTEM_VITA @SDL_FILESYSTEM_VITA@
/* Enable assembly routines */
#cmakedefine SDL_ASSEMBLY_ROUTINES @SDL_ASSEMBLY_ROUTINES@