From bf2336078ca70eaeed8aef9dd8700553984db83e Mon Sep 17 00:00:00 2001 From: Wouter Wijsman Date: Mon, 3 Jan 2022 18:41:21 +0100 Subject: [PATCH] Make tests build for PSP and make them able to launch --- test/CMakeLists.txt | 124 ++++++++++++++++++++++++++++++++++++++++++-- 1 file changed, 121 insertions(+), 3 deletions(-) diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt index 0dfb69d87..bbc3df506 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 + $/psp-${APP} + ) + add_custom_command( + TARGET ${APP} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E rename + $/EBOOT.PBP + $/psp-${APP}/EBOOT.PBP + ) + add_custom_command( + TARGET ${APP} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E rename + $/${APP} + $/psp-${APP}/${APP} + ) + add_custom_command( + TARGET ${APP} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E rename + $/${APP}.prx + $/psp-${APP}/${APP}.prx + ) + add_custom_command( + TARGET ${APP} POST_BUILD + COMMAND ${CMAKE_COMMAND} -E remove + $/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} $) + if(PSP) + add_custom_command(TARGET ${APP} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${RESOURCE_FILE} $/psp-${APP}) + else() + add_custom_command(TARGET ${APP} POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${RESOURCE_FILE} $) + endif() endforeach(RESOURCE_FILE) if(APPLE) # Make sure resource files get installed into macOS/iOS .app bundles.