D3D12: Refactor integration tests with separate output directories
This commit is contained in:
@@ -2,169 +2,10 @@ cmake_minimum_required(VERSION 3.15)
|
|||||||
|
|
||||||
project(D3D12_Integration)
|
project(D3D12_Integration)
|
||||||
|
|
||||||
set(ENGINE_ROOT_DIR ${CMAKE_SOURCE_DIR}/engine)
|
|
||||||
|
|
||||||
find_package(Python3 REQUIRED)
|
find_package(Python3 REQUIRED)
|
||||||
|
|
||||||
enable_testing()
|
enable_testing()
|
||||||
|
|
||||||
# Minimal test - just verifies initialization and render loop
|
add_subdirectory(minimal)
|
||||||
add_executable(D3D12_Minimal
|
add_subdirectory(triangle)
|
||||||
WIN32
|
add_subdirectory(render_model)
|
||||||
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>/
|
|
||||||
)
|
|
||||||
|
|
||||||
# Triangle test - renders a rainbow gradient triangle
|
|
||||||
add_executable(D3D12_Triangle
|
|
||||||
WIN32
|
|
||||||
triangle/main.cpp
|
|
||||||
)
|
|
||||||
|
|
||||||
target_include_directories(D3D12_Triangle PRIVATE
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/triangle
|
|
||||||
${ENGINE_ROOT_DIR}/include
|
|
||||||
)
|
|
||||||
|
|
||||||
target_compile_definitions(D3D12_Triangle PRIVATE
|
|
||||||
UNICODE
|
|
||||||
_UNICODE
|
|
||||||
)
|
|
||||||
|
|
||||||
target_link_libraries(D3D12_Triangle PRIVATE
|
|
||||||
d3d12
|
|
||||||
dxgi
|
|
||||||
d3dcompiler
|
|
||||||
winmm
|
|
||||||
XCEngine
|
|
||||||
)
|
|
||||||
|
|
||||||
# Copy Res folder to output directory for Triangle test
|
|
||||||
add_custom_command(TARGET D3D12_Triangle POST_BUILD
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/triangle/Res
|
|
||||||
$<TARGET_FILE_DIR:D3D12_Triangle>/Res
|
|
||||||
)
|
|
||||||
|
|
||||||
# Copy test scripts to output directory for Triangle test
|
|
||||||
add_custom_command(TARGET D3D12_Triangle POST_BUILD
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/run.bat
|
|
||||||
$<TARGET_FILE_DIR:D3D12_Triangle>/
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/compare_ppm.py
|
|
||||||
$<TARGET_FILE_DIR:D3D12_Triangle>/
|
|
||||||
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/run_integration_test.py
|
|
||||||
$<TARGET_FILE_DIR:D3D12_Triangle>/
|
|
||||||
)
|
|
||||||
|
|
||||||
# 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>
|
|
||||||
)
|
|
||||||
|
|
||||||
add_test(NAME D3D12_Triangle_Integration
|
|
||||||
COMMAND ${Python3_EXECUTABLE} $<TARGET_FILE_DIR:D3D12_Triangle>/run_integration_test.py
|
|
||||||
$<TARGET_FILE:D3D12_Triangle>
|
|
||||||
triangle.ppm
|
|
||||||
${CMAKE_CURRENT_SOURCE_DIR}/triangle/GT.ppm
|
|
||||||
5
|
|
||||||
WORKING_DIRECTORY $<TARGET_FILE_DIR:D3D12_Triangle>
|
|
||||||
)
|
|
||||||
|
|||||||
57
tests/RHI/D3D12/integration/minimal/CMakeLists.txt
Normal file
57
tests/RHI/D3D12/integration/minimal/CMakeLists.txt
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.15)
|
||||||
|
|
||||||
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
|
project(D3D12_Minimal)
|
||||||
|
|
||||||
|
set(ENGINE_ROOT_DIR ${CMAKE_SOURCE_DIR}/engine)
|
||||||
|
|
||||||
|
add_executable(D3D12_Minimal
|
||||||
|
WIN32
|
||||||
|
main.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(D3D12_Minimal PRIVATE
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${ENGINE_ROOT_DIR}/include
|
||||||
|
)
|
||||||
|
|
||||||
|
target_compile_definitions(D3D12_Minimal PRIVATE
|
||||||
|
UNICODE
|
||||||
|
_UNICODE
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(D3D12_Minimal PRIVATE
|
||||||
|
d3d12
|
||||||
|
dxgi
|
||||||
|
d3dcompiler
|
||||||
|
winmm
|
||||||
|
XCEngine
|
||||||
|
)
|
||||||
|
|
||||||
|
add_custom_command(TARGET D3D12_Minimal POST_BUILD
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/Res
|
||||||
|
$<TARGET_FILE_DIR:D3D12_Minimal>/Res
|
||||||
|
)
|
||||||
|
|
||||||
|
add_custom_command(TARGET D3D12_Minimal POST_BUILD
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||||
|
${CMAKE_SOURCE_DIR}/tests/RHI/D3D12/integration/compare_ppm.py
|
||||||
|
$<TARGET_FILE_DIR:D3D12_Minimal>/
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||||
|
${CMAKE_SOURCE_DIR}/tests/RHI/D3D12/integration/run_integration_test.py
|
||||||
|
$<TARGET_FILE_DIR:D3D12_Minimal>/
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/GT.ppm
|
||||||
|
$<TARGET_FILE_DIR:D3D12_Minimal>/
|
||||||
|
)
|
||||||
|
|
||||||
|
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}/GT.ppm
|
||||||
|
5
|
||||||
|
WORKING_DIRECTORY $<TARGET_FILE_DIR:D3D12_Minimal>
|
||||||
|
)
|
||||||
55
tests/RHI/D3D12/integration/render_model/CMakeLists.txt
Normal file
55
tests/RHI/D3D12/integration/render_model/CMakeLists.txt
Normal file
@@ -0,0 +1,55 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.15)
|
||||||
|
|
||||||
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
|
project(D3D12_RenderModel)
|
||||||
|
|
||||||
|
set(ENGINE_ROOT_DIR ${CMAKE_SOURCE_DIR}/engine)
|
||||||
|
|
||||||
|
add_executable(D3D12_RenderModel
|
||||||
|
WIN32
|
||||||
|
main.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(D3D12_RenderModel PRIVATE
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${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
|
||||||
|
)
|
||||||
|
|
||||||
|
add_custom_command(TARGET D3D12_RenderModel POST_BUILD
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/Res
|
||||||
|
$<TARGET_FILE_DIR:D3D12_RenderModel>/Res
|
||||||
|
)
|
||||||
|
|
||||||
|
add_custom_command(TARGET D3D12_RenderModel POST_BUILD
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||||
|
${CMAKE_SOURCE_DIR}/tests/RHI/D3D12/integration/compare_ppm.py
|
||||||
|
$<TARGET_FILE_DIR:D3D12_RenderModel>/
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||||
|
${CMAKE_SOURCE_DIR}/tests/RHI/D3D12/integration/run_integration_test.py
|
||||||
|
$<TARGET_FILE_DIR:D3D12_RenderModel>/
|
||||||
|
)
|
||||||
|
|
||||||
|
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}/GT.ppm
|
||||||
|
5
|
||||||
|
WORKING_DIRECTORY $<TARGET_FILE_DIR:D3D12_RenderModel>
|
||||||
|
)
|
||||||
57
tests/RHI/D3D12/integration/triangle/CMakeLists.txt
Normal file
57
tests/RHI/D3D12/integration/triangle/CMakeLists.txt
Normal file
@@ -0,0 +1,57 @@
|
|||||||
|
cmake_minimum_required(VERSION 3.15)
|
||||||
|
|
||||||
|
set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR})
|
||||||
|
|
||||||
|
project(D3D12_Triangle)
|
||||||
|
|
||||||
|
set(ENGINE_ROOT_DIR ${CMAKE_SOURCE_DIR}/engine)
|
||||||
|
|
||||||
|
add_executable(D3D12_Triangle
|
||||||
|
WIN32
|
||||||
|
main.cpp
|
||||||
|
)
|
||||||
|
|
||||||
|
target_include_directories(D3D12_Triangle PRIVATE
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}
|
||||||
|
${ENGINE_ROOT_DIR}/include
|
||||||
|
)
|
||||||
|
|
||||||
|
target_compile_definitions(D3D12_Triangle PRIVATE
|
||||||
|
UNICODE
|
||||||
|
_UNICODE
|
||||||
|
)
|
||||||
|
|
||||||
|
target_link_libraries(D3D12_Triangle PRIVATE
|
||||||
|
d3d12
|
||||||
|
dxgi
|
||||||
|
d3dcompiler
|
||||||
|
winmm
|
||||||
|
XCEngine
|
||||||
|
)
|
||||||
|
|
||||||
|
add_custom_command(TARGET D3D12_Triangle POST_BUILD
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_directory
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/Res
|
||||||
|
$<TARGET_FILE_DIR:D3D12_Triangle>/Res
|
||||||
|
)
|
||||||
|
|
||||||
|
add_custom_command(TARGET D3D12_Triangle POST_BUILD
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||||
|
${CMAKE_SOURCE_DIR}/tests/RHI/D3D12/integration/compare_ppm.py
|
||||||
|
$<TARGET_FILE_DIR:D3D12_Triangle>/
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||||
|
${CMAKE_SOURCE_DIR}/tests/RHI/D3D12/integration/run_integration_test.py
|
||||||
|
$<TARGET_FILE_DIR:D3D12_Triangle>/
|
||||||
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/GT.ppm
|
||||||
|
$<TARGET_FILE_DIR:D3D12_Triangle>/
|
||||||
|
)
|
||||||
|
|
||||||
|
add_test(NAME D3D12_Triangle_Integration
|
||||||
|
COMMAND ${Python3_EXECUTABLE} $<TARGET_FILE_DIR:D3D12_Triangle>/run_integration_test.py
|
||||||
|
$<TARGET_FILE:D3D12_Triangle>
|
||||||
|
triangle.ppm
|
||||||
|
${CMAKE_CURRENT_SOURCE_DIR}/GT.ppm
|
||||||
|
5
|
||||||
|
WORKING_DIRECTORY $<TARGET_FILE_DIR:D3D12_Triangle>
|
||||||
|
)
|
||||||
Reference in New Issue
Block a user