more conform vulkan/metal configuration

This commit is contained in:
pionere 2022-01-10 15:39:42 +01:00 committed by Ryan C. Gordon
parent 606d2ea87f
commit 118de86202
1 changed files with 40 additions and 34 deletions

View File

@ -1152,17 +1152,19 @@ if(ANDROID)
list(APPEND EXTRA_LIBS ${OpenGLES1_LIBRARY} ${OpenGLES2_LIBRARY}) list(APPEND EXTRA_LIBS ${OpenGLES1_LIBRARY} ${OpenGLES2_LIBRARY})
endif() endif()
CHECK_C_SOURCE_COMPILES(" if(SDL_VULKAN)
#if defined(__ARM_ARCH) && __ARM_ARCH < 7 CHECK_C_SOURCE_COMPILES("
#error Vulkan doesn't work on this configuration #if defined(__ARM_ARCH) && __ARM_ARCH < 7
#endif #error Vulkan doesn't work on this configuration
int main(void) { #endif
return 0; int main(void) {
} return 0;
" VULKAN_PASSED_ANDROID_CHECKS) }
if(NOT VULKAN_PASSED_ANDROID_CHECKS) " VULKAN_PASSED_ANDROID_CHECKS)
set(SDL_VULKAN OFF) if(VULKAN_PASSED_ANDROID_CHECKS)
message(STATUS "Vulkan doesn't work on this configuration") set(SDL_VIDEO_VULKAN 1)
set(HAVE_VULKAN TRUE)
endif()
endif() endif()
endif() endif()
@ -1277,6 +1279,11 @@ elseif(UNIX AND NOT APPLE AND NOT ANDROID AND NOT RISCOS AND NOT HAIKU)
CheckOpenGLES() CheckOpenGLES()
CheckWayland() CheckWayland()
CheckVivante() CheckVivante()
# FIXME: implement CheckVulkan()
if(SDL_VULKAN)
set(SDL_VIDEO_VULKAN 1)
set(HAVE_VULKAN TRUE)
endif()
endif() endif()
if(UNIX) if(UNIX)
@ -1749,6 +1756,11 @@ elseif(WINDOWS)
set(SDL_VIDEO_RENDER_OGL_ES2 1) set(SDL_VIDEO_RENDER_OGL_ES2 1)
set(HAVE_OPENGLES TRUE) set(HAVE_OPENGLES TRUE)
endif() endif()
if(SDL_VULKAN)
set(SDL_VIDEO_VULKAN 1)
set(HAVE_VULKAN TRUE)
endif()
endif() endif()
if(SDL_HIDAPI) if(SDL_HIDAPI)
@ -2014,24 +2026,22 @@ elseif(APPLE)
if(HAVE_FRAMEWORK_METAL) if(HAVE_FRAMEWORK_METAL)
set(SDL_FRAMEWORK_METAL 1) set(SDL_FRAMEWORK_METAL 1)
set(SDL_FRAMEWORK_QUARTZCORE 1) set(SDL_FRAMEWORK_QUARTZCORE 1)
else() if(SDL_VULKAN)
set(SDL_VULKAN 0) set(SDL_VIDEO_VULKAN 1)
set(SDL_METAL 0) set(HAVE_VULKAN TRUE)
set(SDL_RENDER_METAL 0) endif()
if(SDL_METAL)
set(SDL_VIDEO_METAL 1)
set(HAVE_METAL TRUE)
endif()
if(SDL_RENDER_METAL)
file(GLOB RENDER_METAL_SOURCES ${SDL2_SOURCE_DIR}/src/render/metal/*.m)
set(SOURCE_FILES ${SOURCE_FILES} ${RENDER_METAL_SOURCES})
set(SDL_VIDEO_RENDER_METAL 1)
set(HAVE_RENDER_METAL TRUE)
endif()
endif() endif()
endif() endif()
if(SDL_METAL)
set(SDL_VIDEO_METAL 1)
set(HAVE_METAL TRUE)
endif()
if(SDL_RENDER_METAL)
file(GLOB RENDER_METAL_SOURCES ${SDL2_SOURCE_DIR}/src/render/metal/*.m)
set(SOURCE_FILES ${SOURCE_FILES} ${RENDER_METAL_SOURCES})
set(SDL_VIDEO_RENDER_METAL 1)
set(HAVE_RENDER_METAL TRUE)
endif()
endif() endif()
# Actually load the frameworks at the end so we don't duplicate include. # Actually load the frameworks at the end so we don't duplicate include.
@ -2521,14 +2531,10 @@ elseif(OS2)
endif() endif()
endif() endif()
if(SDL_VULKAN AND NOT SDL_LOADSO) if(HAVE_VULKAN AND NOT SDL_LOADSO)
message(STATUS "Vulkan support is available, but disabled because there's no loadso.") message(STATUS "Vulkan support is available, but disabled because there's no loadso.")
set(SDL_VULKAN OFF) set(HAVE_VULKAN FALSE)
endif() set(SDL_VIDEO_VULKAN 0)
if(SDL_VULKAN)
set(SDL_VIDEO_VULKAN 1)
set(HAVE_VULKAN TRUE)
endif() endif()
# Dummies # Dummies