cmake: Remove HAVE_D3D12_H from sources and introduce SDL_RENDER_D3D(11|12)

This commit is contained in:
Anonymous Maarten
2024-08-01 15:49:02 +02:00
committed by Anonymous Maarten
parent 0c5bb532c3
commit 68fb07787b
6 changed files with 14 additions and 29 deletions

View File

@@ -327,7 +327,9 @@ dep_option(SDL_COCOA "Use Cocoa video driver" ON "APPLE" OFF)
dep_option(SDL_DIRECTX "Use DirectX for Windows audio/video" ON "SDL_AUDIO OR SDL_VIDEO;WINDOWS" OFF)
dep_option(SDL_XINPUT "Use Xinput for Windows" ON "WINDOWS" OFF)
dep_option(SDL_WASAPI "Use the Windows WASAPI audio driver" ON "WINDOWS;SDL_AUDIO" OFF)
dep_option(SDL_RENDER_D3D "Enable the Direct3D render driver" ON "SDL_RENDER" OFF)
dep_option(SDL_RENDER_D3D "Enable the Direct3D 9 render driver" ON "SDL_RENDER;SDL_DIRECTX" OFF)
dep_option(SDL_RENDER_D3D11 "Enable the Direct3D 11 render driver" ON "SDL_RENDER;SDL_DIRECTX" OFF)
dep_option(SDL_RENDER_D3D12 "Enable the Direct3D 12 render driver" ON "SDL_RENDER;SDL_DIRECTX" OFF)
dep_option(SDL_RENDER_METAL "Enable the Metal render driver" ON "SDL_RENDER;${APPLE}" OFF)
dep_option(SDL_VIVANTE "Use Vivante EGL video driver" ON "${UNIX_SYS};SDL_CPU_ARM32" OFF)
dep_option(SDL_VULKAN "Enable Vulkan support" ON "SDL_VIDEO;ANDROID OR APPLE OR LINUX OR FREEBSD OR WINDOWS" OFF)
@@ -1838,14 +1840,8 @@ elseif(WINDOWS)
string(APPEND CMAKE_REQUIRED_FLAGS " /I\"$ENV{DXSDK_DIR}\\Include\"")
endif()
check_include_file(d3d9.h HAVE_D3D_H)
check_include_file(d3d9.h HAVE_D3D9_H)
check_include_file(d3d11_1.h HAVE_D3D11_H)
check_c_source_compiles("
#include <d3d12.h>
#include <d3d12sdklayers.h>
ID3D12Device1 *device;
int main(int argc, char **argv) { return 0; }
" HAVE_D3D12_H)
check_include_file(ddraw.h HAVE_DDRAW_H)
check_include_file(dsound.h HAVE_DSOUND_H)
check_include_file(dinput.h HAVE_DINPUT_H)
@@ -1854,7 +1850,7 @@ elseif(WINDOWS)
endif()
check_include_file(dxgi.h HAVE_DXGI_H)
cmake_pop_check_state()
if(HAVE_D3D_H OR HAVE_D3D11_H OR HAVE_D3D12_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H)
if(HAVE_D3D9_H OR HAVE_D3D11_H OR HAVE_DDRAW_H OR HAVE_DSOUND_H OR HAVE_DINPUT_H)
set(HAVE_DIRECTX TRUE)
if(NOT MINGW AND NOT USE_WINSDK_DIRECTX)
if(CMAKE_SIZEOF_VOID_P EQUAL 8)
@@ -1929,17 +1925,17 @@ elseif(WINDOWS)
sdl_glob_sources("${SDL3_SOURCE_DIR}/src/video/windows/*.c")
endif()
if(SDL_RENDER_D3D AND HAVE_D3D_H AND NOT WINDOWS_STORE)
if(SDL_RENDER_D3D AND HAVE_D3D9_H AND NOT WINDOWS_STORE)
set(SDL_VIDEO_RENDER_D3D 1)
set(HAVE_RENDER_D3D TRUE)
endif()
if(SDL_RENDER_D3D AND HAVE_D3D11_H)
if(SDL_RENDER_D3D11 AND HAVE_D3D11_H)
set(SDL_VIDEO_RENDER_D3D11 1)
set(HAVE_RENDER_D3D TRUE)
set(HAVE_RENDER_D3D11 TRUE)
endif()
if(SDL_RENDER_D3D AND HAVE_D3D12_H AND NOT WINDOWS_STORE)
if(SDL_RENDER_D3D12 AND NOT WINDOWS_STORE)
set(SDL_VIDEO_RENDER_D3D12 1)
set(HAVE_RENDER_D3D TRUE)
set(HAVE_RENDER_D3D12 TRUE)
endif()
set(HAVE_SDL_VIDEO TRUE)
endif()