- Rename golden image file to match simpler convention - Update CMakeLists.txt reference - Update TEST_SPEC.md documentation - Update run_tests.py reference
118 lines
3.3 KiB
CMake
118 lines
3.3 KiB
CMake
cmake_minimum_required(VERSION 3.15)
|
|
|
|
project(D3D12_Integration)
|
|
|
|
set(ENGINE_ROOT_DIR ${CMAKE_SOURCE_DIR}/engine)
|
|
|
|
find_package(Python3 REQUIRED)
|
|
|
|
enable_testing()
|
|
|
|
# Minimal test - just verifies initialization and render loop
|
|
add_executable(D3D12_Minimal
|
|
WIN32
|
|
minimal/main.cpp
|
|
)
|
|
|
|
target_include_directories(D3D12_Minimal PRIVATE
|
|
${CMAKE_CURRENT_SOURCE_DIR}/minimal
|
|
${ENGINE_ROOT_DIR}/include
|
|
)
|
|
|
|
target_compile_definitions(D3D12_Minimal PRIVATE
|
|
UNICODE
|
|
_UNICODE
|
|
)
|
|
|
|
target_link_libraries(D3D12_Minimal PRIVATE
|
|
d3d12
|
|
dxgi
|
|
d3dcompiler
|
|
winmm
|
|
XCEngine
|
|
)
|
|
|
|
# Render model test - complete rendering with model, shader, texture
|
|
add_executable(D3D12_RenderModel
|
|
WIN32
|
|
render_model/main.cpp
|
|
)
|
|
|
|
target_include_directories(D3D12_RenderModel PRIVATE
|
|
${CMAKE_CURRENT_SOURCE_DIR}/render_model
|
|
${ENGINE_ROOT_DIR}/include
|
|
${ENGINE_ROOT_DIR}
|
|
)
|
|
|
|
target_compile_definitions(D3D12_RenderModel PRIVATE
|
|
UNICODE
|
|
_UNICODE
|
|
)
|
|
|
|
target_link_libraries(D3D12_RenderModel PRIVATE
|
|
d3d12
|
|
dxgi
|
|
d3dcompiler
|
|
winmm
|
|
XCEngine
|
|
)
|
|
|
|
# Copy Res folder to output directory for Minimal test
|
|
add_custom_command(TARGET D3D12_Minimal POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
|
${CMAKE_CURRENT_SOURCE_DIR}/minimal/Res
|
|
$<TARGET_FILE_DIR:D3D12_Minimal>/Res
|
|
)
|
|
|
|
# Copy Res folder to output directory for RenderModel test
|
|
add_custom_command(TARGET D3D12_RenderModel POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
|
${CMAKE_CURRENT_SOURCE_DIR}/render_model/Res
|
|
$<TARGET_FILE_DIR:D3D12_RenderModel>/Res
|
|
)
|
|
|
|
# Copy test scripts to output directory for Minimal test
|
|
add_custom_command(TARGET D3D12_Minimal POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
${CMAKE_CURRENT_SOURCE_DIR}/run.bat
|
|
$<TARGET_FILE_DIR:D3D12_Minimal>/
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
${CMAKE_CURRENT_SOURCE_DIR}/compare_ppm.py
|
|
$<TARGET_FILE_DIR:D3D12_Minimal>/
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
${CMAKE_CURRENT_SOURCE_DIR}/run_integration_test.py
|
|
$<TARGET_FILE_DIR:D3D12_Minimal>/
|
|
)
|
|
|
|
# Copy test scripts to output directory for RenderModel test
|
|
add_custom_command(TARGET D3D12_RenderModel POST_BUILD
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
${CMAKE_CURRENT_SOURCE_DIR}/run.bat
|
|
$<TARGET_FILE_DIR:D3D12_RenderModel>/
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
${CMAKE_CURRENT_SOURCE_DIR}/compare_ppm.py
|
|
$<TARGET_FILE_DIR:D3D12_RenderModel>/
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
${CMAKE_CURRENT_SOURCE_DIR}/run_integration_test.py
|
|
$<TARGET_FILE_DIR:D3D12_RenderModel>/
|
|
)
|
|
|
|
# Register integration tests with CTest
|
|
add_test(NAME D3D12_Minimal_Integration
|
|
COMMAND ${Python3_EXECUTABLE} $<TARGET_FILE_DIR:D3D12_Minimal>/run_integration_test.py
|
|
$<TARGET_FILE:D3D12_Minimal>
|
|
minimal.ppm
|
|
${CMAKE_CURRENT_SOURCE_DIR}/minimal/GT.ppm
|
|
5
|
|
WORKING_DIRECTORY $<TARGET_FILE_DIR:D3D12_Minimal>
|
|
)
|
|
|
|
add_test(NAME D3D12_RenderModel_Integration
|
|
COMMAND ${Python3_EXECUTABLE} $<TARGET_FILE_DIR:D3D12_RenderModel>/run_integration_test.py
|
|
$<TARGET_FILE:D3D12_RenderModel>
|
|
screenshot.ppm
|
|
${CMAKE_CURRENT_SOURCE_DIR}/render_model/GT.ppm
|
|
5
|
|
WORKING_DIRECTORY $<TARGET_FILE_DIR:D3D12_RenderModel>
|
|
)
|