CMake: Add support for the D3D12 backend

Bug: dawn:333
Change-Id: I61defcd7d5a66fc728c92d1e702ed09b5c84968f
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/16000
Reviewed-by: Austin Eng <enga@chromium.org>
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
This commit is contained in:
Corentin Wallez 2020-02-24 13:27:28 +00:00 committed by Commit Bot service account
parent bc34d908f6
commit 33466973bc
3 changed files with 76 additions and 1 deletions

View File

@ -124,6 +124,10 @@ endif()
if (DAWN_USE_X11) if (DAWN_USE_X11)
target_compile_definitions(dawn_internal_config INTERFACE "DAWN_USE_X11") target_compile_definitions(dawn_internal_config INTERFACE "DAWN_USE_X11")
endif() endif()
if (WIN32)
target_compile_definitions(dawn_internal_config INTERFACE "NOMINMAX" "WIN32_LEAN_AND_MEAN")
endif()
set(CMAKE_CXX_STANDARD "14") set(CMAKE_CXX_STANDARD "14")

View File

@ -150,7 +150,72 @@ if (DAWN_USE_X11)
endif() endif()
if (DAWN_ENABLE_D3D12) if (DAWN_ENABLE_D3D12)
#TODO target_sources(dawn_native PRIVATE
"${DAWN_INCLUDE_DIR}/dawn_native/D3D12Backend.h"
"d3d12/AdapterD3D12.cpp"
"d3d12/AdapterD3D12.h"
"d3d12/BackendD3D12.cpp"
"d3d12/BackendD3D12.h"
"d3d12/BindGroupD3D12.cpp"
"d3d12/BindGroupD3D12.h"
"d3d12/BindGroupLayoutD3D12.cpp"
"d3d12/BindGroupLayoutD3D12.h"
"d3d12/BufferD3D12.cpp"
"d3d12/BufferD3D12.h"
"d3d12/CommandAllocatorManager.cpp"
"d3d12/CommandAllocatorManager.h"
"d3d12/CommandBufferD3D12.cpp"
"d3d12/CommandBufferD3D12.h"
"d3d12/CommandRecordingContext.cpp"
"d3d12/CommandRecordingContext.h"
"d3d12/ComputePipelineD3D12.cpp"
"d3d12/ComputePipelineD3D12.h"
"d3d12/D3D12Error.cpp"
"d3d12/D3D12Error.h"
"d3d12/D3D12Info.cpp"
"d3d12/D3D12Info.h"
"d3d12/DescriptorHeapAllocator.cpp"
"d3d12/DescriptorHeapAllocator.h"
"d3d12/DeviceD3D12.cpp"
"d3d12/DeviceD3D12.h"
"d3d12/Forward.h"
"d3d12/HeapAllocatorD3D12.cpp"
"d3d12/HeapAllocatorD3D12.h"
"d3d12/HeapD3D12.cpp"
"d3d12/HeapD3D12.h"
"d3d12/NativeSwapChainImplD3D12.cpp"
"d3d12/NativeSwapChainImplD3D12.h"
"d3d12/PipelineLayoutD3D12.cpp"
"d3d12/PipelineLayoutD3D12.h"
"d3d12/PlatformFunctions.cpp"
"d3d12/PlatformFunctions.h"
"d3d12/QueueD3D12.cpp"
"d3d12/QueueD3D12.h"
"d3d12/RenderPassBuilderD3D12.cpp"
"d3d12/RenderPassBuilderD3D12.h"
"d3d12/RenderPipelineD3D12.cpp"
"d3d12/RenderPipelineD3D12.h"
"d3d12/ResourceAllocatorManagerD3D12.cpp"
"d3d12/ResourceAllocatorManagerD3D12.h"
"d3d12/ResourceHeapAllocationD3D12.cpp"
"d3d12/ResourceHeapAllocationD3D12.h"
"d3d12/SamplerD3D12.cpp"
"d3d12/SamplerD3D12.h"
"d3d12/ShaderModuleD3D12.cpp"
"d3d12/ShaderModuleD3D12.h"
"d3d12/StagingBufferD3D12.cpp"
"d3d12/StagingBufferD3D12.h"
"d3d12/SwapChainD3D12.cpp"
"d3d12/SwapChainD3D12.h"
"d3d12/TextureCopySplitter.cpp"
"d3d12/TextureCopySplitter.h"
"d3d12/TextureD3D12.cpp"
"d3d12/TextureD3D12.h"
"d3d12/UtilsD3D12.cpp"
"d3d12/UtilsD3D12.h"
"d3d12/d3d12_platform.h"
)
target_link_libraries(dawn_native PRIVATE dxguid.lib)
endif() endif()
if (DAWN_ENABLE_METAL) if (DAWN_ENABLE_METAL)

View File

@ -48,6 +48,12 @@ else()
set(SHADERC_SKIP_INSTALL ON) set(SHADERC_SKIP_INSTALL ON)
set(SHADERC_ENABLE_SPVC ON) set(SHADERC_ENABLE_SPVC ON)
# Change the default value of SHADERC_ENABLE_SHARED_CRT to ON as that's what matches the
# CMake defaults better.
if(MSVC)
option(SHADERC_ENABLE_SHARED_CRT "Use the shared CRT instead of the static CRT" ON)
endif()
# Let SPVC's CMakeLists.txt deal with configuring SPIRV-Cross # Let SPVC's CMakeLists.txt deal with configuring SPIRV-Cross
set(SPIRV_CROSS_ENABLE_TESTS OFF) set(SPIRV_CROSS_ENABLE_TESTS OFF)
set(SHADERC_SPIRV_CROSS_DIR "${DAWN_SPIRV_CROSS_DIR}") set(SHADERC_SPIRV_CROSS_DIR "${DAWN_SPIRV_CROSS_DIR}")