Proposing to make vulkan support eventually optional.

Still some alternative oses does not have vulkan support or not full (e.g. Raspberry).
This commit is contained in:
David Carlier 2020-12-23 09:50:37 +00:00
parent 983f7f6b4b
commit 8dc76d54d1

View file

@ -47,6 +47,7 @@ string(REPLACE "-O3" "-O2" CMAKE_C_FLAGS_RELEASE "${CMAKE_C_FLAGS_RELEASE}")
# Compilation time options.
option(CURL_SUPPORT "cURL support" ON)
option(OPENAL_SUPPORT "OpenAL support" ON)
option(VULKAN_SUPPORT "Vulkan support" ON)
option(SYSTEMWIDE_SUPPORT "Enable systemwide installation of game assets" OFF)
# These variables will act as our list of include folders and linker flags.
@ -122,10 +123,12 @@ else()
add_definitions(-DHAVE_EXECINFO)
endif()
if (${VULKAN_SUPPORT})
# We need an Vulkan implementation.
find_package(Vulkan REQUIRED)
list(APPEND yquake2IncludeDirectories ${Vulkan_INCLUDE_DIR})
list(APPEND yquake2VulkanLinkerFlags ${Vulkan_LIBRARIES})
endif()
# cURL support.
if (${CURL_SUPPORT})
@ -576,6 +579,7 @@ set(SOFT-Header
${COMMON_SRC_DIR}/header/shared.h
)
if (${VULKAN_SUPPORT})
set(VK-Source
${REF_SRC_DIR}/vk/vk_buffer.c
${REF_SRC_DIR}/vk/vk_cmd.c
@ -615,6 +619,7 @@ set(VK-Header
${REF_SRC_DIR}/vk/header/util.h
${COMMON_SRC_DIR}/header/shared.h
)
endif()
# Wrapper for the Windows binary
if(${CMAKE_SYSTEM_NAME} MATCHES "Windows")
@ -703,6 +708,7 @@ set_target_properties(ref_soft PROPERTIES
)
target_link_libraries(ref_soft ${yquake2LinkerFlags} ${yquake2SDLLinkerFlags})
if(${VULKAN_SUPPORT})
# Build the vk renderer dynamic library
add_library(ref_vk MODULE ${VK-Source} ${VK-Header} ${REF-Platform-Specific-Source})
set_target_properties(ref_vk PROPERTIES
@ -712,3 +718,4 @@ set_target_properties(ref_vk PROPERTIES
SUFFIX ${CMAKE_SHARED_LIBRARY_SUFFIX}
)
target_link_libraries(ref_vk ${yquake2LinkerFlags} ${yquake2VulkanLinkerFlags} ${yquake2SDLLinkerFlags})
endif()