summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to '')
-rw-r--r--CMakeLists.txt30
-rw-r--r--externals/CMakeLists.txt2
-rw-r--r--src/yuzu_cmd/CMakeLists.txt5
-rw-r--r--src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp6
4 files changed, 24 insertions, 19 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 716256cd5..214d5a4a7 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -13,7 +13,7 @@ project(yuzu)
13option(ENABLE_SDL2 "Enable the SDL2 frontend" ON) 13option(ENABLE_SDL2 "Enable the SDL2 frontend" ON)
14CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_SDL2 "Download bundled SDL2 binaries" ON "ENABLE_SDL2;MSVC" OFF) 14CMAKE_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
16option(YUZU_ALLOW_SYSTEM_SDL2 "Try using system SDL2 before fallling back to one from externals" OFF) 16CMAKE_DEPENDENT_OPTION(YUZU_USE_EXTERNAL_SDL2 "Compile external SDL2" ON "ENABLE_SDL2;NOT MSVC" OFF)
17 17
18option(ENABLE_QT "Enable the Qt frontend" ON) 18option(ENABLE_QT "Enable the Qt frontend" ON)
19option(ENABLE_QT_TRANSLATION "Enable translations for the Qt frontend" OFF) 19option(ENABLE_QT_TRANSLATION "Enable translations for the Qt frontend" OFF)
@@ -387,26 +387,20 @@ if (ENABLE_SDL2)
387 add_library(SDL2 INTERFACE) 387 add_library(SDL2 INTERFACE)
388 target_link_libraries(SDL2 INTERFACE "${SDL2_LIBRARY}") 388 target_link_libraries(SDL2 INTERFACE "${SDL2_LIBRARY}")
389 target_include_directories(SDL2 INTERFACE "${SDL2_INCLUDE_DIR}") 389 target_include_directories(SDL2 INTERFACE "${SDL2_INCLUDE_DIR}")
390 elseif (YUZU_USE_EXTERNAL_SDL2)
391 message(STATUS "Using SDL2 from externals.")
390 else() 392 else()
391 if (YUZU_ALLOW_SYSTEM_SDL2) 393 find_package(SDL2 2.0.15 REQUIRED)
392 find_package(SDL2 2.0.15 QUIET)
393
394 if (SDL2_FOUND)
395 # Some installations don't set SDL2_LIBRARIES
396 if("${SDL2_LIBRARIES}" STREQUAL "")
397 message(WARNING "SDL2_LIBRARIES wasn't set, manually setting to SDL2::SDL2")
398 set(SDL2_LIBRARIES "SDL2::SDL2")
399 endif()
400 394
401 include_directories(SYSTEM ${SDL2_INCLUDE_DIRS}) 395 # Some installations don't set SDL2_LIBRARIES
402 add_library(SDL2 INTERFACE) 396 if("${SDL2_LIBRARIES}" STREQUAL "")
403 target_link_libraries(SDL2 INTERFACE "${SDL2_LIBRARIES}") 397 message(WARNING "SDL2_LIBRARIES wasn't set, manually setting to SDL2::SDL2")
404 else() 398 set(SDL2_LIBRARIES "SDL2::SDL2")
405 message(STATUS "SDL2 2.0.15 or newer not found, falling back to externals.")
406 endif()
407 else()
408 message(STATUS "Using SDL2 from externals.")
409 endif() 399 endif()
400
401 include_directories(SYSTEM ${SDL2_INCLUDE_DIRS})
402 add_library(SDL2 INTERFACE)
403 target_link_libraries(SDL2 INTERFACE "${SDL2_LIBRARIES}")
410 endif() 404 endif()
411endif() 405endif()
412 406
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)
51endif() 51endif()
52 52
53# SDL2 53# SDL2
54if (NOT SDL2_FOUND AND ENABLE_SDL2) 54if (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/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
39target_include_directories(yuzu-cmd PRIVATE ../../externals/Vulkan-Headers/include) 39target_include_directories(yuzu-cmd PRIVATE ../../externals/Vulkan-Headers/include)
40 40
41if (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)
44endif()
45
41if(UNIX AND NOT APPLE) 46if(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")
43endif() 48endif()
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..b6049b032 100644
--- a/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp
+++ b/src/yuzu_cmd/emu_window/emu_window_sdl2_vk.cpp
@@ -15,6 +15,12 @@
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#ifdef YUZU_USE_EXTERNAL_SDL2
19// Include this before SDL.h to prevent the external from including a dummy
20#define USING_GENERATED_CONFIG_H
21#include <SDL_config.h>
22#endif
23
18// Include these late to avoid polluting everything with Xlib macros 24// Include these late to avoid polluting everything with Xlib macros
19// Ignore -Wimplicit-fallthrough due to https://github.com/libsdl-org/SDL/issues/4307 25// Ignore -Wimplicit-fallthrough due to https://github.com/libsdl-org/SDL/issues/4307
20#ifdef __clang__ 26#ifdef __clang__