add DX11 support

This commit is contained in:
Timo de Kort 2019-05-26 19:46:43 +02:00
parent 9b0607973e
commit 7bb528186f

View File

@ -1,19 +1,23 @@
cmake_minimum_required(VERSION 3.11b)
set(BACKEND_VULKAN "vulkan")
set(BACKEND_METAL "metal")
set(BACKEND_DX11 "dx11")
set(BACKEND_DX12 "dx12")
set(AVAILABLE_BACKENDS
${BACKEND_VULKAN}
${BACKEND_METAL}
${BACKEND_DX11}
${BACKEND_DX12})
if(NOT DEFINED BACKEND OR NOT "${BACKEND}" IN_LIST AVAILABLE_BACKENDS)
message(FATAL_ERROR "BACKEND invalid or undefined, available backends: ${AVAILABLE_BACKENDS}")
endif()
project(hello_triangle)
set(TARGET_NAME hello_triangle)
set(BACKEND_VULKAN "vulkan")
set(BACKEND_METAL "metal")
set(BACKEND_DX12 "dx12")
set(AVAILABLE_BACKENDS ${BACKEND_VULKAN} ${BACKEND_METAL} ${BACKEND_DX12})
if(NOT DEFINED BACKEND)
message(FATAL_ERROR "Backend has not been set, please do so by using the -DBACKEND= argument. \
Available backends: ${AVAILABLE_BACKENDS}")
endif()
add_executable(hello_triangle main.c)
if(MSVC)
@ -21,7 +25,9 @@ if(MSVC)
target_compile_options(${TARGET_NAME} PRIVATE /W4)
set(GLFW_LIBRARY glfw3)
set(OS_LIBRARIES "userenv" "ws2_32" "Dwmapi" "dbghelp")
if("${BACKEND}" STREQUAL "${BACKEND_DX12}")
if("${BACKEND}" STREQUAL "${BACKEND_DX11}")
list(APPEND OS_LIBRARIES "d3dcompiler" "D3D11" "DXGI")
elseif("${BACKEND}" STREQUAL "${BACKEND_DX12}")
list(APPEND OS_LIBRARIES "d3dcompiler" "D3D12" "DXGI")
endif()
elseif(APPLE)