SDL: 3DS: Only bundle resources with tests that need them (b58a1)

From b58a1c7f330b18b25bd414c852a8dc329fa5fe8a Mon Sep 17 00:00:00 2001
From: Cameron Cawley <[EMAIL REDACTED]>
Date: Sat, 12 Oct 2024 19:01:24 +0100
Subject: [PATCH] 3DS: Only bundle resources with tests that need them

(cherry picked from commit d7bb56f16364105ec195effc88a92349f94af81d)
---
 test/CMakeLists.txt | 7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

diff --git a/test/CMakeLists.txt b/test/CMakeLists.txt
index f048d51f9edcd..609ea98ef0623 100644
--- a/test/CMakeLists.txt
+++ b/test/CMakeLists.txt
@@ -366,12 +366,11 @@ if(PSP)
 endif()
 
 if(N3DS)
-    set(ROMFS_DIR "${CMAKE_CURRENT_BINARY_DIR}/romfs")
-    file(COPY ${RESOURCE_FILES} DESTINATION "${ROMFS_DIR}")
-
     foreach(APP IN LISTS SDL_TEST_EXECUTABLES)
         get_target_property(TARGET_BINARY_DIR ${APP} BINARY_DIR)
+        set(ROMFS_DIR "${TARGET_BINARY_DIR}/sdl-${APP}")
         set(SMDH_FILE "${TARGET_BINARY_DIR}/${APP}.smdh")
+        file(MAKE_DIRECTORY ${ROMFS_DIR})
         ctr_generate_smdh("${SMDH_FILE}"
             NAME "SDL-${APP}"
             DESCRIPTION "SDL2 Test suite"
@@ -428,7 +427,7 @@ add_custom_target(copy-sdl-test-resources
 )
 
 foreach(APP IN LISTS SDL_TESTS_NEEDS_RESOURCES)
-    if(PSP OR PS2)
+    if(PSP OR PS2 OR N3DS)
         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}>/sdl-${APP})
         endforeach()