Fix D3D12 build: add missing headers and fix CMake paths

This commit is contained in:
2026-03-17 00:40:29 +08:00
parent 5bcf9d74a3
commit 4b41a4cca1
5 changed files with 15 additions and 10 deletions

View File

@@ -2,6 +2,7 @@
#include <d3d12.h>
#include <wrl/client.h>
#include <string>
#include "D3D12Enum.h"

View File

@@ -5,8 +5,8 @@
#include <wrl/client.h>
#include <string>
#include "../SwapChain.h"
#include "D3D12Enum.h"
#include "../Types.h"
using Microsoft::WRL::ComPtr;

View File

@@ -3,6 +3,7 @@
#include <d3d12.h>
#include <dxgi1_4.h>
#include <wrl/client.h>
#include <vector>
#include "D3D12Enum.h"
#include "D3D12Texture.h"

View File

@@ -2,6 +2,7 @@
#include <d3d12.h>
#include <wrl/client.h>
#include <string>
#include "D3D12Enum.h"

View File

@@ -2,16 +2,18 @@ cmake_minimum_required(VERSION 3.15)
project(D3D12)
set(ENGINE_ROOT_DIR ${CMAKE_SOURCE_DIR}/../engine)
add_executable(D3D12
WIN32
main.cpp
${CMAKE_SOURCE_DIR}/MVS/D3D12/stbi/stb_image.cpp
${CMAKE_CURRENT_SOURCE_DIR}/stbi/stb_image.cpp
)
target_include_directories(D3D12 PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/MVS/D3D12/stbi
${CMAKE_SOURCE_DIR}/engine/include
${CMAKE_CURRENT_SOURCE_DIR}/stbi
${ENGINE_ROOT_DIR}/include
)
target_compile_definitions(D3D12 PRIVATE
@@ -21,8 +23,8 @@ target_compile_definitions(D3D12 PRIVATE
target_include_directories(D3D12 PRIVATE
${CMAKE_CURRENT_SOURCE_DIR}
${CMAKE_SOURCE_DIR}/engine/third_party
${CMAKE_SOURCE_DIR}/engine/include
${ENGINE_ROOT_DIR}/third_party
${ENGINE_ROOT_DIR}/include
)
target_link_libraries(D3D12 PRIVATE
@@ -36,19 +38,19 @@ target_link_libraries(D3D12 PRIVATE
# Copy Res folder to output directory after build
add_custom_command(TARGET D3D12 POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_directory
${CMAKE_SOURCE_DIR}/tests/D3D12/Res
${CMAKE_CURRENT_SOURCE_DIR}/Res
$<TARGET_FILE_DIR:D3D12>/Res
)
# Copy test scripts to output directory
add_custom_command(TARGET D3D12 POST_BUILD
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_SOURCE_DIR}/tests/D3D12/run.bat
${CMAKE_CURRENT_SOURCE_DIR}/run.bat
$<TARGET_FILE_DIR:D3D12>/run.bat
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_SOURCE_DIR}/tests/D3D12/compare_ppm.py
${CMAKE_CURRENT_SOURCE_DIR}/compare_ppm.py
$<TARGET_FILE_DIR:D3D12>/compare_ppm.py
COMMAND ${CMAKE_COMMAND} -E copy_if_different
${CMAKE_SOURCE_DIR}/tests/D3D12/GT.ppm
${CMAKE_CURRENT_SOURCE_DIR}/GT.ppm
$<TARGET_FILE_DIR:D3D12>/GT.ppm
)