109 lines
2.9 KiB
CMake
109 lines
2.9 KiB
CMake
cmake_minimum_required(VERSION 3.15)
|
|
|
|
project(D3D12_Integration)
|
|
|
|
set(ENGINE_ROOT_DIR ${CMAKE_SOURCE_DIR}/../engine)
|
|
|
|
# Minimal test - just verifies initialization and render loop
|
|
add_executable(D3D12_Minimal
|
|
WIN32
|
|
main_minimal.cpp
|
|
)
|
|
|
|
target_include_directories(D3D12_Minimal PRIVATE
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
|
${CMAKE_CURRENT_SOURCE_DIR}/stbi
|
|
${ENGINE_ROOT_DIR}/include
|
|
)
|
|
|
|
target_compile_definitions(D3D12_Minimal PRIVATE
|
|
UNICODE
|
|
_UNICODE
|
|
)
|
|
|
|
target_include_directories(D3D12_Minimal PRIVATE
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
|
${ENGINE_ROOT_DIR}/third_party
|
|
${ENGINE_ROOT_DIR}/include
|
|
)
|
|
|
|
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
|
|
main_render.cpp
|
|
${CMAKE_CURRENT_SOURCE_DIR}/stbi/stb_image.cpp
|
|
)
|
|
|
|
target_include_directories(D3D12_RenderModel PRIVATE
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
|
${CMAKE_CURRENT_SOURCE_DIR}/stbi
|
|
${ENGINE_ROOT_DIR}/include
|
|
)
|
|
|
|
target_compile_definitions(D3D12_RenderModel PRIVATE
|
|
UNICODE
|
|
_UNICODE
|
|
)
|
|
|
|
target_include_directories(D3D12_RenderModel PRIVATE
|
|
${CMAKE_CURRENT_SOURCE_DIR}
|
|
${ENGINE_ROOT_DIR}/third_party
|
|
${ENGINE_ROOT_DIR}/include
|
|
)
|
|
|
|
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}/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}/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>/run.bat
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
${CMAKE_CURRENT_SOURCE_DIR}/compare_ppm.py
|
|
$<TARGET_FILE_DIR:D3D12_Minimal>/compare_ppm.py
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
${CMAKE_CURRENT_SOURCE_DIR}/GT.ppm
|
|
$<TARGET_FILE_DIR:D3D12_Minimal>/GT.ppm
|
|
)
|
|
|
|
# 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>/run.bat
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
${CMAKE_CURRENT_SOURCE_DIR}/compare_ppm.py
|
|
$<TARGET_FILE_DIR:D3D12_RenderModel>/compare_ppm.py
|
|
COMMAND ${CMAKE_COMMAND} -E copy_if_different
|
|
${CMAKE_CURRENT_SOURCE_DIR}/GT.ppm
|
|
$<TARGET_FILE_DIR:D3D12_RenderModel>/GT.ppm
|
|
)
|