Skip to content

Commit 9630ee2

Browse files
committed
build(rhi): integrate SDL3 dependency with find_package and DLL auto-copy
- Add find_package(SDL3 REQUIRED CONFIG) to root CMakeLists.txt - Link Caffeine library against SDL3::SDL3 - Add post-build SDL3 DLL copy for Windows test executable
1 parent 5275a05 commit 9630ee2

2 files changed

Lines changed: 17 additions & 1 deletion

File tree

CMakeLists.txt

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,19 +12,26 @@ if(CMAKE_BUILD_TYPE STREQUAL "Debug")
1212
add_compile_definitions(CF_DEBUG)
1313
endif()
1414

15+
# ── SDL3 ────────────────────────────────────────────────────────
16+
find_package(SDL3 REQUIRED CONFIG)
17+
1518
add_library(Caffeine
1619
src/core/Timer.cpp
1720
src/core/GameLoop.cpp
1821
src/input/InputManager.cpp
1922
src/debug/LogSystem.cpp
2023
src/debug/Profiler.cpp
24+
src/rhi/RenderDevice.cpp
25+
src/rhi/CommandBuffer.cpp
2126
)
2227

2328
target_include_directories(Caffeine PUBLIC
2429
$<BUILD_INTERFACE:${CMAKE_CURRENT_SOURCE_DIR}/src>
2530
$<INSTALL_INTERFACE:include>
2631
)
2732

33+
target_link_libraries(Caffeine PUBLIC SDL3::SDL3)
34+
2835
target_compile_features(Caffeine PUBLIC cxx_std_20)
2936

3037
add_library(Caffeine::Core ALIAS Caffeine)

tests/CMakeLists.txt

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@ add_executable(CaffeineTest
99
test_gameloop.cpp
1010
test_input.cpp
1111
test_debug.cpp
12+
test_rhi.cpp
1213
)
1314

1415
target_link_libraries(CaffeineTest PRIVATE Caffeine)
@@ -20,4 +21,12 @@ else()
2021
endif()
2122

2223
enable_testing()
23-
add_test(NAME CaffeineTest COMMAND CaffeineTest)
24+
add_test(NAME CaffeineTest COMMAND CaffeineTest)
25+
26+
if(WIN32)
27+
add_custom_command(TARGET CaffeineTest POST_BUILD
28+
COMMAND ${CMAKE_COMMAND} -E copy_if_different
29+
$<TARGET_FILE:SDL3::SDL3>
30+
$<TARGET_FILE_DIR:CaffeineTest>
31+
)
32+
endif()

0 commit comments

Comments
 (0)