CMake: Add option to enable/disable Vulkan video backend

This commit is contained in:
mazes-80 2018-09-03 18:09:23 +02:00 committed by Léo Lam
parent 908d6f8fa0
commit f375ee72a2
No known key found for this signature in database
GPG Key ID: 0DF30F9081000741
4 changed files with 16 additions and 3 deletions

View File

@ -35,6 +35,7 @@ option(ENABLE_ALSA "Enables ALSA sound backend" ON)
option(ENABLE_PULSEAUDIO "Enables PulseAudio sound backend" ON) option(ENABLE_PULSEAUDIO "Enables PulseAudio sound backend" ON)
option(ENABLE_LLVM "Enables LLVM support, for disassembly" ON) option(ENABLE_LLVM "Enables LLVM support, for disassembly" ON)
option(ENABLE_TESTS "Enables building the unit tests" ON) option(ENABLE_TESTS "Enables building the unit tests" ON)
option(ENABLE_VULKAN "Enables vulkan video backend" ON)
option(USE_DISCORD_PRESENCE "Enables Discord Rich Presence, show the current game on Discord" ON) option(USE_DISCORD_PRESENCE "Enables Discord Rich Presence, show the current game on Discord" ON)
# Maintainers: if you consider blanket disabling this for your users, please # Maintainers: if you consider blanket disabling this for your users, please
@ -543,6 +544,7 @@ if (_M_X86)
add_subdirectory(Externals/Bochs_disasm) add_subdirectory(Externals/Bochs_disasm)
endif() endif()
add_subdirectory(Externals/cpp-optparse) add_subdirectory(Externals/cpp-optparse)
find_package(fmt 6.0) find_package(fmt 6.0)
if(fmt_FOUND) if(fmt_FOUND)
message(STATUS "Using shared fmt ${fmt_VERSION}") message(STATUS "Using shared fmt ${fmt_VERSION}")
@ -551,8 +553,12 @@ else()
message(STATUS "Using static fmt from Externals") message(STATUS "Using static fmt from Externals")
add_subdirectory(Externals/fmt EXCLUDE_FROM_ALL) add_subdirectory(Externals/fmt EXCLUDE_FROM_ALL)
endif() endif()
add_subdirectory(Externals/glslang)
add_subdirectory(Externals/imgui) add_subdirectory(Externals/imgui)
add_subdirectory(Externals/glslang)
if(ENABLE_VULKAN)
add_definitions(-DUSE_VULKAN)
endif()
find_package(pugixml) find_package(pugixml)
if(NOT pugixml_FOUND) if(NOT pugixml_FOUND)

View File

@ -563,7 +563,6 @@ PUBLIC
videonull videonull
videoogl videoogl
videosoftware videosoftware
videovulkan
PRIVATE PRIVATE
fmt::fmt fmt::fmt
@ -601,6 +600,10 @@ if(LIBUSB_FOUND)
) )
endif() endif()
if(ENABLE_VULKAN)
target_link_libraries(core PUBLIC videovulkan)
endif()
if(WIN32) if(WIN32)
target_sources(core PRIVATE target_sources(core PRIVATE
HW/EXI/BBA/TAP_Win32.cpp HW/EXI/BBA/TAP_Win32.cpp

View File

@ -1,7 +1,6 @@
add_subdirectory(OGL) add_subdirectory(OGL)
add_subdirectory(Null) add_subdirectory(Null)
add_subdirectory(Software) add_subdirectory(Software)
add_subdirectory(Vulkan)
if(CMAKE_SYSTEM_NAME STREQUAL "Windows") if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
add_subdirectory(D3DCommon) add_subdirectory(D3DCommon)
@ -9,3 +8,6 @@ if(CMAKE_SYSTEM_NAME STREQUAL "Windows")
add_subdirectory(D3D12) add_subdirectory(D3D12)
endif() endif()
if(ENABLE_VULKAN)
add_subdirectory(Vulkan)
endif()

View File

@ -225,7 +225,9 @@ const std::vector<std::unique_ptr<VideoBackendBase>>& VideoBackendBase::GetAvail
backends.push_back(std::make_unique<DX11::VideoBackend>()); backends.push_back(std::make_unique<DX11::VideoBackend>());
backends.push_back(std::make_unique<DX12::VideoBackend>()); backends.push_back(std::make_unique<DX12::VideoBackend>());
#endif #endif
#ifdef USE_VULKAN
backends.push_back(std::make_unique<Vulkan::VideoBackend>()); backends.push_back(std::make_unique<Vulkan::VideoBackend>());
#endif
#ifdef HAS_OPENGL #ifdef HAS_OPENGL
backends.push_back(std::make_unique<SW::VideoSoftware>()); backends.push_back(std::make_unique<SW::VideoSoftware>());
#endif #endif