diff options
| author | 2021-07-19 20:54:03 -0400 | |
|---|---|---|
| committer | 2021-07-19 20:54:03 -0400 | |
| commit | ffc78ce9c17554bc72f205d6ea55ef7bc3363b47 (patch) | |
| tree | d117cb643addb8d3ffb363951d892fd07278e1c7 | |
| parent | Merge pull request #6651 from lat9nq/update-settings (diff) | |
| parent | sdl_impl, emu_window: Remove clang ignore (diff) | |
| download | yuzu-ffc78ce9c17554bc72f205d6ea55ef7bc3363b47.tar.gz yuzu-ffc78ce9c17554bc72f205d6ea55ef7bc3363b47.tar.xz yuzu-ffc78ce9c17554bc72f205d6ea55ef7bc3363b47.zip | |
Merge pull request #6652 from lat9nq/cmd-vulkan-fixes
yuzu-cmd: Linux Vulkan fixes
Diffstat (limited to '')
| -rw-r--r-- | CMakeLists.txt | 30 | ||||
| -rw-r--r-- | externals/CMakeLists.txt | 2 | ||||
| -rw-r--r-- | src/input_common/sdl/sdl_impl.h | 8 | ||||
| -rw-r--r-- | src/yuzu_cmd/CMakeLists.txt | 5 | ||||
| -rw-r--r-- | src/yuzu_cmd/emu_window/emu_window_sdl2.cpp | 8 | ||||
| -rw-r--r-- | src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp | 8 | ||||
| -rw-r--r-- | src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp | 28 |
7 files changed, 38 insertions, 51 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index de93ca2c2..857550e71 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
| @@ -13,7 +13,7 @@ project(yuzu) | |||
| 13 | option(ENABLE_SDL2 "Enable the SDL2 frontend" ON) | 13 | option(ENABLE_SDL2 "Enable the SDL2 frontend" ON) |
| 14 | CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_SDL2 "Download bundled SDL2 binaries" ON "ENABLE_SDL2;MSVC" OFF) | 14 | CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_SDL2 "Download bundled SDL2 binaries" ON "ENABLE_SDL2;MSVC" OFF) |
| 15 | # On Linux system SDL2 is likely to be lacking HIDAPI support which have drawbacks but is needed for SDL motion | 15 | # On Linux system SDL2 is likely to be lacking HIDAPI support which have drawbacks but is needed for SDL motion |
| 16 | option(YUZU_ALLOW_SYSTEM_SDL2 "Try using system SDL2 before fallling back to one from externals" OFF) | 16 | CMAKE_DEPENDENT_OPTION(YUZU_USE_EXTERNAL_SDL2 "Compile external SDL2" ON "ENABLE_SDL2;NOT MSVC" OFF) |
| 17 | 17 | ||
| 18 | option(ENABLE_QT "Enable the Qt frontend" ON) | 18 | option(ENABLE_QT "Enable the Qt frontend" ON) |
| 19 | option(ENABLE_QT_TRANSLATION "Enable translations for the Qt frontend" OFF) | 19 | option(ENABLE_QT_TRANSLATION "Enable translations for the Qt frontend" OFF) |
| @@ -393,26 +393,20 @@ if (ENABLE_SDL2) | |||
| 393 | add_library(SDL2 INTERFACE) | 393 | add_library(SDL2 INTERFACE) |
| 394 | target_link_libraries(SDL2 INTERFACE "${SDL2_LIBRARY}") | 394 | target_link_libraries(SDL2 INTERFACE "${SDL2_LIBRARY}") |
| 395 | target_include_directories(SDL2 INTERFACE "${SDL2_INCLUDE_DIR}") | 395 | target_include_directories(SDL2 INTERFACE "${SDL2_INCLUDE_DIR}") |
| 396 | elseif (YUZU_USE_EXTERNAL_SDL2) | ||
| 397 | message(STATUS "Using SDL2 from externals.") | ||
| 396 | else() | 398 | else() |
| 397 | if (YUZU_ALLOW_SYSTEM_SDL2) | 399 | find_package(SDL2 2.0.15 REQUIRED) |
| 398 | find_package(SDL2 2.0.15 QUIET) | ||
| 399 | |||
| 400 | if (SDL2_FOUND) | ||
| 401 | # Some installations don't set SDL2_LIBRARIES | ||
| 402 | if("${SDL2_LIBRARIES}" STREQUAL "") | ||
| 403 | message(WARNING "SDL2_LIBRARIES wasn't set, manually setting to SDL2::SDL2") | ||
| 404 | set(SDL2_LIBRARIES "SDL2::SDL2") | ||
| 405 | endif() | ||
| 406 | 400 | ||
| 407 | include_directories(SYSTEM ${SDL2_INCLUDE_DIRS}) | 401 | # Some installations don't set SDL2_LIBRARIES |
| 408 | add_library(SDL2 INTERFACE) | 402 | if("${SDL2_LIBRARIES}" STREQUAL "") |
| 409 | target_link_libraries(SDL2 INTERFACE "${SDL2_LIBRARIES}") | 403 | message(WARNING "SDL2_LIBRARIES wasn't set, manually setting to SDL2::SDL2") |
| 410 | else() | 404 | set(SDL2_LIBRARIES "SDL2::SDL2") |
| 411 | message(STATUS "SDL2 2.0.15 or newer not found, falling back to externals.") | ||
| 412 | endif() | ||
| 413 | else() | ||
| 414 | message(STATUS "Using SDL2 from externals.") | ||
| 415 | endif() | 405 | endif() |
| 406 | |||
| 407 | include_directories(SYSTEM ${SDL2_INCLUDE_DIRS}) | ||
| 408 | add_library(SDL2 INTERFACE) | ||
| 409 | target_link_libraries(SDL2 INTERFACE "${SDL2_LIBRARIES}") | ||
| 416 | endif() | 410 | endif() |
| 417 | endif() | 411 | endif() |
| 418 | 412 | ||
diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index fd427a912..4b8d35548 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt | |||
| @@ -51,7 +51,7 @@ if (NOT LIBUSB_FOUND OR YUZU_USE_BUNDLED_LIBUSB) | |||
| 51 | endif() | 51 | endif() |
| 52 | 52 | ||
| 53 | # SDL2 | 53 | # SDL2 |
| 54 | if (NOT SDL2_FOUND AND ENABLE_SDL2) | 54 | if (YUZU_USE_EXTERNAL_SDL2) |
| 55 | if (NOT WIN32) | 55 | if (NOT WIN32) |
| 56 | # Yuzu itself needs: Events Joystick Haptic Sensor Timers Audio | 56 | # Yuzu itself needs: Events Joystick Haptic Sensor Timers Audio |
| 57 | # Yuzu-cmd also needs: Video (depends on Loadso/Dlopen) | 57 | # Yuzu-cmd also needs: Video (depends on Loadso/Dlopen) |
diff --git a/src/input_common/sdl/sdl_impl.h b/src/input_common/sdl/sdl_impl.h index b77afcbd8..7a9ad6346 100644 --- a/src/input_common/sdl/sdl_impl.h +++ b/src/input_common/sdl/sdl_impl.h | |||
| @@ -10,15 +10,7 @@ | |||
| 10 | #include <thread> | 10 | #include <thread> |
| 11 | #include <unordered_map> | 11 | #include <unordered_map> |
| 12 | 12 | ||
| 13 | // Ignore -Wimplicit-fallthrough due to https://github.com/libsdl-org/SDL/issues/4307 | ||
| 14 | #ifdef __GNUC__ | ||
| 15 | #pragma GCC diagnostic push | ||
| 16 | #pragma GCC diagnostic ignored "-Wimplicit-fallthrough" | ||
| 17 | #endif | ||
| 18 | #include <SDL.h> | 13 | #include <SDL.h> |
| 19 | #ifdef __GNUC__ | ||
| 20 | #pragma GCC diagnostic pop | ||
| 21 | #endif | ||
| 22 | 14 | ||
| 23 | #include "common/common_types.h" | 15 | #include "common/common_types.h" |
| 24 | #include "common/threadsafe_queue.h" | 16 | #include "common/threadsafe_queue.h" |
diff --git a/src/yuzu_cmd/CMakeLists.txt b/src/yuzu_cmd/CMakeLists.txt index 4bf25727b..e55a19649 100644 --- a/src/yuzu_cmd/CMakeLists.txt +++ b/src/yuzu_cmd/CMakeLists.txt | |||
| @@ -38,6 +38,11 @@ target_include_directories(yuzu-cmd PRIVATE ${RESOURCES_DIR}) | |||
| 38 | 38 | ||
| 39 | target_include_directories(yuzu-cmd PRIVATE ../../externals/Vulkan-Headers/include) | 39 | target_include_directories(yuzu-cmd PRIVATE ../../externals/Vulkan-Headers/include) |
| 40 | 40 | ||
| 41 | if (YUZU_USE_EXTERNAL_SDL2) | ||
| 42 | target_compile_definitions(yuzu-cmd PRIVATE -DYUZU_USE_EXTERNAL_SDL2) | ||
| 43 | target_include_directories(yuzu-cmd PRIVATE ${PROJECT_BINARY_DIR}/externals/SDL/include) | ||
| 44 | endif() | ||
| 45 | |||
| 41 | if(UNIX AND NOT APPLE) | 46 | if(UNIX AND NOT APPLE) |
| 42 | install(TARGETS yuzu-cmd RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") | 47 | install(TARGETS yuzu-cmd RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") |
| 43 | endif() | 48 | endif() |
diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp index 06b20c975..896181f0b 100644 --- a/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp +++ b/src/yuzu_cmd/emu_window/emu_window_sdl2.cpp | |||
| @@ -2,15 +2,7 @@ | |||
| 2 | // Licensed under GPLv2 or any later version | 2 | // Licensed under GPLv2 or any later version |
| 3 | // Refer to the license.txt file included. | 3 | // Refer to the license.txt file included. |
| 4 | 4 | ||
| 5 | // Ignore -Wimplicit-fallthrough due to https://github.com/libsdl-org/SDL/issues/4307 | ||
| 6 | #ifdef __clang__ | ||
| 7 | #pragma clang diagnostic push | ||
| 8 | #pragma clang diagnostic ignored "-Wimplicit-fallthrough" | ||
| 9 | #endif | ||
| 10 | #include <SDL.h> | 5 | #include <SDL.h> |
| 11 | #ifdef __clang__ | ||
| 12 | #pragma clang diagnostic pop | ||
| 13 | #endif | ||
| 14 | 6 | ||
| 15 | #include "common/logging/log.h" | 7 | #include "common/logging/log.h" |
| 16 | #include "common/scm_rev.h" | 8 | #include "common/scm_rev.h" |
diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp index 837a44be7..eadb41790 100644 --- a/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp +++ b/src/yuzu_cmd/emu_window/emu_window_sdl2_gl.cpp | |||
| @@ -7,15 +7,7 @@ | |||
| 7 | #include <string> | 7 | #include <string> |
| 8 | 8 | ||
| 9 | #define SDL_MAIN_HANDLED | 9 | #define SDL_MAIN_HANDLED |
| 10 | // Ignore -Wimplicit-fallthrough due to https://github.com/libsdl-org/SDL/issues/4307 | ||
| 11 | #ifdef __clang__ | ||
| 12 | #pragma clang diagnostic push | ||
| 13 | #pragma clang diagnostic ignored "-Wimplicit-fallthrough" | ||
| 14 | #endif | ||
| 15 | #include <SDL.h> | 10 | #include <SDL.h> |
| 16 | #ifdef __clang__ | ||
| 17 | #pragma clang diagnostic pop | ||
| 18 | #endif | ||
| 19 | 11 | ||
| 20 | #include <fmt/format.h> | 12 | #include <fmt/format.h> |
| 21 | #include <glad/glad.h> | 13 | #include <glad/glad.h> |
diff --git a/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp b/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp index 3401ad4b4..152e56db8 100644 --- a/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp +++ b/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp | |||
| @@ -15,16 +15,13 @@ | |||
| 15 | #include "video_core/renderer_vulkan/renderer_vulkan.h" | 15 | #include "video_core/renderer_vulkan/renderer_vulkan.h" |
| 16 | #include "yuzu_cmd/emu_window/emu_window_sdl2_vk.h" | 16 | #include "yuzu_cmd/emu_window/emu_window_sdl2_vk.h" |
| 17 | 17 | ||
| 18 | // Include these late to avoid polluting everything with Xlib macros | 18 | #ifdef YUZU_USE_EXTERNAL_SDL2 |
| 19 | // Ignore -Wimplicit-fallthrough due to https://github.com/libsdl-org/SDL/issues/4307 | 19 | // Include this before SDL.h to prevent the external from including a dummy |
| 20 | #ifdef __clang__ | 20 | #define USING_GENERATED_CONFIG_H |
| 21 | #pragma clang diagnostic push | 21 | #include <SDL_config.h> |
| 22 | #pragma clang diagnostic ignored "-Wimplicit-fallthrough" | ||
| 23 | #endif | 22 | #endif |
| 23 | |||
| 24 | #include <SDL.h> | 24 | #include <SDL.h> |
| 25 | #ifdef __clang__ | ||
| 26 | #pragma clang diagnostic pop | ||
| 27 | #endif | ||
| 28 | #include <SDL_syswm.h> | 25 | #include <SDL_syswm.h> |
| 29 | 26 | ||
| 30 | EmuWindow_SDL2_VK::EmuWindow_SDL2_VK(InputCommon::InputSubsystem* input_subsystem) | 27 | EmuWindow_SDL2_VK::EmuWindow_SDL2_VK(InputCommon::InputSubsystem* input_subsystem) |
| @@ -51,6 +48,11 @@ EmuWindow_SDL2_VK::EmuWindow_SDL2_VK(InputCommon::InputSubsystem* input_subsyste | |||
| 51 | window_info.type = Core::Frontend::WindowSystemType::Windows; | 48 | window_info.type = Core::Frontend::WindowSystemType::Windows; |
| 52 | window_info.render_surface = reinterpret_cast<void*>(wm.info.win.window); | 49 | window_info.render_surface = reinterpret_cast<void*>(wm.info.win.window); |
| 53 | break; | 50 | break; |
| 51 | #else | ||
| 52 | case SDL_SYSWM_TYPE::SDL_SYSWM_WINDOWS: | ||
| 53 | LOG_CRITICAL(Frontend, "Window manager subsystem Windows not compiled"); | ||
| 54 | std::exit(EXIT_FAILURE); | ||
| 55 | break; | ||
| 54 | #endif | 56 | #endif |
| 55 | #ifdef SDL_VIDEO_DRIVER_X11 | 57 | #ifdef SDL_VIDEO_DRIVER_X11 |
| 56 | case SDL_SYSWM_TYPE::SDL_SYSWM_X11: | 58 | case SDL_SYSWM_TYPE::SDL_SYSWM_X11: |
| @@ -58,6 +60,11 @@ EmuWindow_SDL2_VK::EmuWindow_SDL2_VK(InputCommon::InputSubsystem* input_subsyste | |||
| 58 | window_info.display_connection = wm.info.x11.display; | 60 | window_info.display_connection = wm.info.x11.display; |
| 59 | window_info.render_surface = reinterpret_cast<void*>(wm.info.x11.window); | 61 | window_info.render_surface = reinterpret_cast<void*>(wm.info.x11.window); |
| 60 | break; | 62 | break; |
| 63 | #else | ||
| 64 | case SDL_SYSWM_TYPE::SDL_SYSWM_X11: | ||
| 65 | LOG_CRITICAL(Frontend, "Window manager subsystem X11 not compiled"); | ||
| 66 | std::exit(EXIT_FAILURE); | ||
| 67 | break; | ||
| 61 | #endif | 68 | #endif |
| 62 | #ifdef SDL_VIDEO_DRIVER_WAYLAND | 69 | #ifdef SDL_VIDEO_DRIVER_WAYLAND |
| 63 | case SDL_SYSWM_TYPE::SDL_SYSWM_WAYLAND: | 70 | case SDL_SYSWM_TYPE::SDL_SYSWM_WAYLAND: |
| @@ -65,6 +72,11 @@ EmuWindow_SDL2_VK::EmuWindow_SDL2_VK(InputCommon::InputSubsystem* input_subsyste | |||
| 65 | window_info.display_connection = wm.info.wl.display; | 72 | window_info.display_connection = wm.info.wl.display; |
| 66 | window_info.render_surface = wm.info.wl.surface; | 73 | window_info.render_surface = wm.info.wl.surface; |
| 67 | break; | 74 | break; |
| 75 | #else | ||
| 76 | case SDL_SYSWM_TYPE::SDL_SYSWM_WAYLAND: | ||
| 77 | LOG_CRITICAL(Frontend, "Window manager subsystem Wayland not compiled"); | ||
| 78 | std::exit(EXIT_FAILURE); | ||
| 79 | break; | ||
| 68 | #endif | 80 | #endif |
| 69 | default: | 81 | default: |
| 70 | LOG_CRITICAL(Frontend, "Window manager subsystem not implemented"); | 82 | LOG_CRITICAL(Frontend, "Window manager subsystem not implemented"); |