From 5dfb7f7a4d35f6531731791d2380a8552a8b8a8f Mon Sep 17 00:00:00 2001 From: beau-lunarg Date: Sat, 2 Nov 2024 14:02:57 -0400 Subject: [PATCH] Add SDL3 dependency through CMAKE Fix shader copies and dll dependencies for test apps --- CMakeLists.txt | 1 - cmake/FindSDL3.cmake | 7 +++++++ test/test_apps/CMakeLists.txt | 2 ++ test/test_apps/multisample-depth/CMakeLists.txt | 5 ++++- test/test_apps/triangle/CMakeLists.txt | 5 ++++- 5 files changed, 17 insertions(+), 3 deletions(-) create mode 100644 cmake/FindSDL3.cmake diff --git a/CMakeLists.txt b/CMakeLists.txt index 71e372bae..74b737c41 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -354,7 +354,6 @@ if (${RUN_TESTS}) target_include_directories(catch2 INTERFACE external) endif() -add_subdirectory(external/SDL) add_subdirectory(external/nlohmann) add_subdirectory(framework) if(NOT BUILD_STATIC) diff --git a/cmake/FindSDL3.cmake b/cmake/FindSDL3.cmake new file mode 100644 index 000000000..3202a2c94 --- /dev/null +++ b/cmake/FindSDL3.cmake @@ -0,0 +1,7 @@ +include(FetchContent) +FetchContent_Declare( + sdl + GIT_REPOSITORY https://github.com/libsdl-org/SDL.git + GIT_TAG preview-3.1.3 +) +FetchContent_MakeAvailable(sdl) diff --git a/test/test_apps/CMakeLists.txt b/test/test_apps/CMakeLists.txt index 2241ef361..2325f01b0 100644 --- a/test/test_apps/CMakeLists.txt +++ b/test/test_apps/CMakeLists.txt @@ -26,6 +26,8 @@ # Description: CMake script for test apps ############################################################################### +find_package(SDL3) + add_custom_target(gfxrecon-testapps) add_subdirectory(triangle) diff --git a/test/test_apps/multisample-depth/CMakeLists.txt b/test/test_apps/multisample-depth/CMakeLists.txt index 526a9a5e5..179550423 100644 --- a/test/test_apps/multisample-depth/CMakeLists.txt +++ b/test/test_apps/multisample-depth/CMakeLists.txt @@ -61,8 +61,11 @@ add_custom_command( POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory - ${CMAKE_CURRENT_LIST_DIR}/shaders "$" + ${CMAKE_CURRENT_LIST_DIR}/shaders ${CMAKE_CURRENT_BINARY_DIR} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}) +add_custom_command(TARGET gfxrecon-testapp-multisample-depth POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different $ $ + COMMAND_EXPAND_LISTS) install(TARGETS gfxrecon-testapp-multisample-depth RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR}) diff --git a/test/test_apps/triangle/CMakeLists.txt b/test/test_apps/triangle/CMakeLists.txt index e157543a2..b63a64546 100644 --- a/test/test_apps/triangle/CMakeLists.txt +++ b/test/test_apps/triangle/CMakeLists.txt @@ -63,8 +63,11 @@ add_custom_command( POST_BUILD COMMAND ${CMAKE_COMMAND} -E copy_directory - ${CMAKE_CURRENT_LIST_DIR}/shaders "$" + ${CMAKE_CURRENT_LIST_DIR}/shaders ${CMAKE_CURRENT_BINARY_DIR} DEPENDS ${CMAKE_CURRENT_BINARY_DIR}/${CMAKE_BUILD_TYPE}) +add_custom_command(TARGET gfxrecon-testapp-triangle POST_BUILD + COMMAND ${CMAKE_COMMAND} -E copy_if_different $ $ + COMMAND_EXPAND_LISTS) install(TARGETS gfxrecon-testapp-triangle RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})