Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
Fixed bug 5072 - Test resources missing when building with SDL_TEST a…
…nd CMake

DominikD

There are several tests that need resources in the output directory to work:
* `testiconv` depends on `utf8.txt`
* `testoverlay2` and `teststreaming` depend on `moose.dat`

This patch adds these two files to the `RESOURCE_FILES` variable.

One could also copy `shapes\*.bmp` over to the output directory for `testshape` to use but this patch doesn't do that for three reasons:
* executable takes path as an argument and doesn't need these files side by side
* these are ~45MB and copying them over would cause build directory to swell
* there are already files in the output directory that can be used with this test (`sample.bmp` and `button.bmp`)
  • Loading branch information
slouken committed Apr 5, 2020
1 parent f3e6096 commit 89fe32d
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion test/CMakeLists.txt
Expand Up @@ -94,7 +94,7 @@ add_executable(testoffscreen testoffscreen.c)
file(WRITE ${CMAKE_CURRENT_BINARY_DIR}/resources_dummy.c "int main(int argc, const char **argv){ return 1; }\n")
add_executable(SDL2_test_resoureces ${CMAKE_CURRENT_BINARY_DIR}/resources_dummy.c)

file(GLOB RESOURCE_FILES *.bmp *.wav)
file(GLOB RESOURCE_FILES *.bmp *.wav moose.dat utf8.txt)
foreach(RESOURCE_FILE ${RESOURCE_FILES})
add_custom_command(TARGET SDL2_test_resoureces POST_BUILD COMMAND ${CMAKE_COMMAND} ARGS -E copy_if_different ${RESOURCE_FILE} $<TARGET_FILE_DIR:SDL2_test_resoureces>)
endforeach(RESOURCE_FILE)
Expand Down

0 comments on commit 89fe32d

Please sign in to comment.