mirror of https://github.com/encounter/SDL.git
CMake support
This commit is contained in:
parent
47c105161b
commit
e928b92f1a
159
CMakeLists.txt
159
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,8 +861,10 @@ if(LIBC)
|
|||
check_symbol_exists("${_FN}" "math.h" ${_HAVEVAR})
|
||||
endforeach()
|
||||
set(CMAKE_REQUIRED_LIBRARIES)
|
||||
if(NOT VITA)
|
||||
list(APPEND EXTRA_LIBS m)
|
||||
endif()
|
||||
endif()
|
||||
|
||||
check_library_exists(iconv iconv_open "" HAVE_LIBICONV)
|
||||
check_library_exists(c iconv_open "" HAVE_BUILTIN_ICONV)
|
||||
|
@ -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)
|
||||
|
||||
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
|
||||
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 ${EXTRA_LDFLAGS} ${_EXTRA_LIBS})
|
||||
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}")
|
||||
|
|
|
@ -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@
|
||||
|
|
Loading…
Reference in New Issue