2026-03-20 02:58:33 +08:00
|
|
|
cmake_minimum_required(VERSION 3.15)
|
|
|
|
|
|
|
|
|
|
get_filename_component(PROJECT_ROOT_DIR ${CMAKE_CURRENT_SOURCE_DIR}/../../../.. ABSOLUTE)
|
|
|
|
|
|
|
|
|
|
find_package(GTest REQUIRED)
|
|
|
|
|
|
|
|
|
|
set(TEST_SOURCES
|
|
|
|
|
fixtures/D3D12TestFixture.cpp
|
|
|
|
|
test_device.cpp
|
|
|
|
|
test_fence.cpp
|
|
|
|
|
test_command_queue.cpp
|
|
|
|
|
test_command_allocator.cpp
|
|
|
|
|
test_command_list.cpp
|
|
|
|
|
test_buffer.cpp
|
|
|
|
|
test_texture.cpp
|
|
|
|
|
test_descriptor_heap.cpp
|
|
|
|
|
test_shader.cpp
|
|
|
|
|
test_root_signature.cpp
|
|
|
|
|
test_pipeline_state.cpp
|
|
|
|
|
test_views.cpp
|
2026-03-20 17:07:24 +08:00
|
|
|
test_swap_chain.cpp
|
2026-03-20 02:58:33 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
add_executable(d3d12_engine_tests ${TEST_SOURCES})
|
|
|
|
|
|
|
|
|
|
target_link_libraries(d3d12_engine_tests PRIVATE
|
|
|
|
|
d3d12
|
|
|
|
|
dxgi
|
|
|
|
|
d3dcompiler
|
|
|
|
|
XCEngine
|
|
|
|
|
GTest::gtest
|
|
|
|
|
GTest::gtest_main
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
target_include_directories(d3d12_engine_tests PRIVATE
|
|
|
|
|
${CMAKE_CURRENT_SOURCE_DIR}/fixtures
|
|
|
|
|
${PROJECT_ROOT_DIR}/engine/include
|
|
|
|
|
${PROJECT_ROOT_DIR}/engine/src
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
target_compile_definitions(d3d12_engine_tests PRIVATE
|
2026-03-20 17:07:24 +08:00
|
|
|
TEST_RESOURCES_DIR="${PROJECT_ROOT_DIR}/tests/RHI/D3D12/integration/minimal/Res"
|
2026-03-20 02:58:33 +08:00
|
|
|
)
|
|
|
|
|
|
|
|
|
|
add_custom_command(TARGET d3d12_engine_tests POST_BUILD
|
|
|
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
2026-03-20 17:07:24 +08:00
|
|
|
${PROJECT_ROOT_DIR}/tests/RHI/D3D12/integration/minimal/Res
|
2026-03-20 02:58:33 +08:00
|
|
|
$<TARGET_FILE_DIR:d3d12_engine_tests>/Res
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
enable_testing()
|
|
|
|
|
add_test(NAME D3D12EngineTests COMMAND d3d12_engine_tests)
|