Make tests build for PSP and make them able to launch
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
diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index 0dfb69d..bbc3df5 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -4,7 +4,26 @@ project(SDL2 C)
# Global settings for all of the test targets
# FIXME: is this wrong?
remove_definitions(-DUSING_GENERATED_CONFIG_H)
-link_libraries(SDL2_test SDL2-static)
+
+if(PSP)
+ link_libraries(
+ SDL2main
+ SDL2_test
+ SDL2-static
+ GL
+ pspvram
+ pspvfpu
+ pspdisplay
+ pspgu
+ pspge
+ pspaudio
+ pspctrl
+ psphprm
+ psppower
+ )
+else()
+ link_libraries(SDL2_test SDL2-static)
+endif()
if(WINDOWS)
# mingw32 must come before SDL2main to link successfully
@@ -123,7 +142,6 @@ set(NEEDS_RESOURCES
testgamecontroller
testshape
testshader
- testnative
testspriteminimal
testautomation
testcustomcursor
@@ -135,9 +153,109 @@ set(NEEDS_RESOURCES
testaudiohotplug
testmultiaudio
)
+if(NOT PSP)
+ set(NEEDS_RESOURCES ${NEEDS_RESOURCES} testnative)
+endif()
+
+if(PSP)
+ set(BUILD_EBOOT
+ ${NEEDS_RESOURCES}
+ testoffscreen
+ testvulkan
+ testbounds
+ testhotplug
+ testgles2
+ testhaptic
+ testrelative
+ testgl2
+ testsem
+ testdisplayinfo
+ testgles
+ teststreaming
+ testgeometry
+ testgesture
+ testfile
+ testdropfile
+ testdraw2
+ testviewport
+ testhittesting
+ checkkeys
+ testoverlay2
+ testver
+ testdrawchessboard
+ testsurround
+ testintersections
+ testmessage
+ testaudiocapture
+ testerror
+ testatomic
+ testjoystick
+ testrumble
+ testiconv
+ testfilesystem
+ testplatform
+ testthread
+ testkeys
+ testloadso
+ testmouse
+ testqsort
+ testime
+ testaudioinfo
+ testlock
+ checkkeysthreads
+ testtimer
+ testpower
+ testwm2
+ torturethread
+ )
+ foreach(APP IN LISTS BUILD_EBOOT)
+ create_pbp_file(
+ TARGET ${APP}
+ TITLE SDL-${APP}
+ ICON_PATH NULL
+ BACKGROUND_PATH NULL
+ PREVIEW_PATH NULL
+ BUILD_PRX
+ ENC_PRX
+ )
+ add_custom_command(
+ TARGET ${APP} POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E make_directory
+ $<TARGET_FILE_DIR:${ARG_TARGET}>/psp-${APP}
+ )
+ add_custom_command(
+ TARGET ${APP} POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E rename
+ $<TARGET_FILE_DIR:${ARG_TARGET}>/EBOOT.PBP
+ $<TARGET_FILE_DIR:${ARG_TARGET}>/psp-${APP}/EBOOT.PBP
+ )
+ add_custom_command(
+ TARGET ${APP} POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E rename
+ $<TARGET_FILE_DIR:${ARG_TARGET}>/${APP}
+ $<TARGET_FILE_DIR:${ARG_TARGET}>/psp-${APP}/${APP}
+ )
+ add_custom_command(
+ TARGET ${APP} POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E rename
+ $<TARGET_FILE_DIR:${ARG_TARGET}>/${APP}.prx
+ $<TARGET_FILE_DIR:${ARG_TARGET}>/psp-${APP}/${APP}.prx
+ )
+ add_custom_command(
+ TARGET ${APP} POST_BUILD
+ COMMAND ${CMAKE_COMMAND} -E remove
+ $<TARGET_FILE_DIR:${ARG_TARGET}>/PARAM.SFO
+ )
+ endforeach()
+endif()
+
foreach(APP IN LISTS NEEDS_RESOURCES)
foreach(RESOURCE_FILE ${RESOURCE_FILES})
- add_custom_command(TARGET ${APP} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${RESOURCE_FILE} $<TARGET_FILE_DIR:${APP}>)
+ if(PSP)
+ add_custom_command(TARGET ${APP} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${RESOURCE_FILE} $<TARGET_FILE_DIR:${APP}>/psp-${APP})
+ else()
+ add_custom_command(TARGET ${APP} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${RESOURCE_FILE} $<TARGET_FILE_DIR:${APP}>)
+ endif()
endforeach(RESOURCE_FILE)
if(APPLE)
# Make sure resource files get installed into macOS/iOS .app bundles.