diff options
Diffstat (limited to '')
| -rw-r--r-- | CMakeLists.txt | 30 | ||||
| -rw-r--r-- | externals/CMakeLists.txt | 12 |
2 files changed, 30 insertions, 12 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index c8e9ebf8a..3faa2b5ac 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
| @@ -12,6 +12,8 @@ project(yuzu) | |||
| 12 | # OFF by default, but if ENABLE_SDL2 and MSVC are true then ON | 12 | # OFF by default, but if ENABLE_SDL2 and MSVC are true then ON |
| 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 | ||
| 16 | CMAKE_DEPENDENT_OPTION(YUZU_ALLOW_SYSTEM_SDL2 "Try using system SDL2 before fallling back to one from externals" NOT UNIX "ENABLE_SDL2" OFF) | ||
| 15 | 17 | ||
| 16 | option(ENABLE_QT "Enable the Qt frontend" ON) | 18 | option(ENABLE_QT "Enable the Qt frontend" ON) |
| 17 | option(ENABLE_QT_TRANSLATION "Enable translations for the Qt frontend" OFF) | 19 | option(ENABLE_QT_TRANSLATION "Enable translations for the Qt frontend" OFF) |
| @@ -292,20 +294,24 @@ if (ENABLE_SDL2) | |||
| 292 | target_link_libraries(SDL2 INTERFACE "${SDL2_LIBRARY}") | 294 | target_link_libraries(SDL2 INTERFACE "${SDL2_LIBRARY}") |
| 293 | target_include_directories(SDL2 INTERFACE "${SDL2_INCLUDE_DIR}") | 295 | target_include_directories(SDL2 INTERFACE "${SDL2_INCLUDE_DIR}") |
| 294 | else() | 296 | else() |
| 295 | find_package(SDL2 2.0.15 QUIET) | 297 | if (YUZU_ALLOW_SYSTEM_SDL2) |
| 296 | 298 | find_package(SDL2 2.0.15 QUIET) | |
| 297 | if (SDL2_FOUND) | 299 | |
| 298 | # Some installations don't set SDL2_LIBRARIES | 300 | if (SDL2_FOUND) |
| 299 | if("${SDL2_LIBRARIES}" STREQUAL "") | 301 | # Some installations don't set SDL2_LIBRARIES |
| 300 | message(WARNING "SDL2_LIBRARIES wasn't set, manually setting to SDL2::SDL2") | 302 | if("${SDL2_LIBRARIES}" STREQUAL "") |
| 301 | set(SDL2_LIBRARIES "SDL2::SDL2") | 303 | message(WARNING "SDL2_LIBRARIES wasn't set, manually setting to SDL2::SDL2") |
| 304 | set(SDL2_LIBRARIES "SDL2::SDL2") | ||
| 305 | endif() | ||
| 306 | |||
| 307 | include_directories(SYSTEM ${SDL2_INCLUDE_DIRS}) | ||
| 308 | add_library(SDL2 INTERFACE) | ||
| 309 | target_link_libraries(SDL2 INTERFACE "${SDL2_LIBRARIES}") | ||
| 310 | else() | ||
| 311 | message(STATUS "SDL2 2.0.15 or newer not found, falling back to externals.") | ||
| 302 | endif() | 312 | endif() |
| 303 | |||
| 304 | include_directories(SYSTEM ${SDL2_INCLUDE_DIRS}) | ||
| 305 | add_library(SDL2 INTERFACE) | ||
| 306 | target_link_libraries(SDL2 INTERFACE "${SDL2_LIBRARIES}") | ||
| 307 | else() | 313 | else() |
| 308 | message(STATUS "SDL2 2.0.15 or newer not found, falling back to externals.") | 314 | message(STATUS "Using SDL2 from externals.") |
| 309 | endif() | 315 | endif() |
| 310 | endif() | 316 | endif() |
| 311 | endif() | 317 | endif() |
diff --git a/externals/CMakeLists.txt b/externals/CMakeLists.txt index e280e53d7..fe1c088ca 100644 --- a/externals/CMakeLists.txt +++ b/externals/CMakeLists.txt | |||
| @@ -47,8 +47,20 @@ target_include_directories(unicorn-headers INTERFACE ./unicorn/include) | |||
| 47 | 47 | ||
| 48 | # SDL2 | 48 | # SDL2 |
| 49 | if (NOT SDL2_FOUND AND ENABLE_SDL2) | 49 | if (NOT SDL2_FOUND AND ENABLE_SDL2) |
| 50 | # Yuzu itself needs: Events Joystick Haptic Sensor Timers | ||
| 51 | # Yuzu-cmd also needs: Video (depends on Loadso/Dlopen) | ||
| 52 | set(SDL_UNUSED_SUBSYSTEMS | ||
| 53 | Atomic Audio Render Power Threads | ||
| 54 | File CPUinfo Filesystem Locale) | ||
| 55 | foreach(_SUB ${SDL_UNUSED_SUBSYSTEMS}) | ||
| 56 | string(TOUPPER ${_SUB} _OPT) | ||
| 57 | option(SDL_${_OPT} "" OFF) | ||
| 58 | endforeach() | ||
| 59 | |||
| 50 | set(SDL_STATIC ON) | 60 | set(SDL_STATIC ON) |
| 51 | set(SDL_SHARED OFF) | 61 | set(SDL_SHARED OFF) |
| 62 | option(HIDAPI "" ON) | ||
| 63 | |||
| 52 | add_subdirectory(SDL EXCLUDE_FROM_ALL) | 64 | add_subdirectory(SDL EXCLUDE_FROM_ALL) |
| 53 | add_library(SDL2 ALIAS SDL2-static) | 65 | add_library(SDL2 ALIAS SDL2-static) |
| 54 | endif() | 66 | endif() |