Skip to content

Commit

Permalink
Add SDL3 dependency through CMAKE
Browse files Browse the repository at this point in the history
Fix shader copies and dll dependencies for test apps
  • Loading branch information
beau-lunarg committed Nov 2, 2024
1 parent 4328526 commit 5dfb7f7
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 3 deletions.
1 change: 0 additions & 1 deletion CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
7 changes: 7 additions & 0 deletions cmake/FindSDL3.cmake
Original file line number Diff line number Diff line change
@@ -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)
2 changes: 2 additions & 0 deletions test/test_apps/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
# Description: CMake script for test apps
###############################################################################

find_package(SDL3)

add_custom_target(gfxrecon-testapps)

add_subdirectory(triangle)
Expand Down
5 changes: 4 additions & 1 deletion test/test_apps/multisample-depth/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -61,8 +61,11 @@ add_custom_command(
POST_BUILD
COMMAND
${CMAKE_COMMAND} -E copy_directory
${CMAKE_CURRENT_LIST_DIR}/shaders "$<TARGET_FILE_DIR:gfxrecon-testapp-multisample-depth>"
${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 $<TARGET_RUNTIME_DLLS:gfxrecon-testapp-multisample-depth> $<TARGET_FILE_DIR:gfxrecon-testapp-multisample-depth>
COMMAND_EXPAND_LISTS)

install(TARGETS gfxrecon-testapp-multisample-depth RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

Expand Down
5 changes: 4 additions & 1 deletion test/test_apps/triangle/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -63,8 +63,11 @@ add_custom_command(
POST_BUILD
COMMAND
${CMAKE_COMMAND} -E copy_directory
${CMAKE_CURRENT_LIST_DIR}/shaders "$<TARGET_FILE_DIR:gfxrecon-testapp-triangle>"
${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 $<TARGET_RUNTIME_DLLS:gfxrecon-testapp-triangle> $<TARGET_FILE_DIR:gfxrecon-testapp-triangle>
COMMAND_EXPAND_LISTS)

install(TARGETS gfxrecon-testapp-triangle RUNTIME DESTINATION ${CMAKE_INSTALL_BINDIR})

Expand Down

0 comments on commit 5dfb7f7

Please sign in to comment.