diff options
Diffstat (limited to 'CMakeLists.txt')
| -rw-r--r-- | CMakeLists.txt | 36 |
1 files changed, 28 insertions, 8 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt index e70f29636..ba207dfd1 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt | |||
| @@ -13,11 +13,11 @@ 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 | CMAKE_DEPENDENT_OPTION(YUZU_ALLOW_SYSTEM_SDL2 "Try using system SDL2 before fallling back to one from externals" NOT UNIX "ENABLE_SDL2" OFF) | 16 | option(YUZU_ALLOW_SYSTEM_SDL2 "Try using system SDL2 before fallling back to one from externals" 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) |
| 20 | CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_QT "Download bundled Qt binaries" ON "ENABLE_QT;MSVC" OFF) | 20 | CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_QT "Download bundled Qt binaries" "${MSVC}" "ENABLE_QT" OFF) |
| 21 | 21 | ||
| 22 | option(ENABLE_WEB_SERVICE "Enable web services (telemetry, etc.)" ON) | 22 | option(ENABLE_WEB_SERVICE "Enable web services (telemetry, etc.)" ON) |
| 23 | 23 | ||
| @@ -240,6 +240,7 @@ yuzu_find_packages() | |||
| 240 | 240 | ||
| 241 | # Qt5 requires that we find components, so it doesn't fit our pretty little find package function | 241 | # Qt5 requires that we find components, so it doesn't fit our pretty little find package function |
| 242 | if(ENABLE_QT) | 242 | if(ENABLE_QT) |
| 243 | set(QT_VERSION 5.12) | ||
| 243 | # We want to load the generated conan qt config so that we get the QT_ROOT var so that we can use the official | 244 | # We want to load the generated conan qt config so that we get the QT_ROOT var so that we can use the official |
| 244 | # Qt5Config inside the root folder instead of the conan generated one. | 245 | # Qt5Config inside the root folder instead of the conan generated one. |
| 245 | if(EXISTS ${CMAKE_BINARY_DIR}/qtConfig.cmake) | 246 | if(EXISTS ${CMAKE_BINARY_DIR}/qtConfig.cmake) |
| @@ -247,22 +248,40 @@ if(ENABLE_QT) | |||
| 247 | list(APPEND CMAKE_MODULE_PATH "${CONAN_QT_ROOT_RELEASE}") | 248 | list(APPEND CMAKE_MODULE_PATH "${CONAN_QT_ROOT_RELEASE}") |
| 248 | list(APPEND CMAKE_PREFIX_PATH "${CONAN_QT_ROOT_RELEASE}") | 249 | list(APPEND CMAKE_PREFIX_PATH "${CONAN_QT_ROOT_RELEASE}") |
| 249 | endif() | 250 | endif() |
| 251 | |||
| 252 | # Check for system Qt on Linux, fallback to bundled Qt | ||
| 253 | if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") | ||
| 254 | if (NOT YUZU_USE_BUNDLED_QT) | ||
| 255 | find_package(Qt5 ${QT_VERSION} COMPONENTS Widgets QUIET) | ||
| 256 | if (NOT Qt5_FOUND) | ||
| 257 | set(YUZU_USE_BUNDLED_QT ON CACHE BOOL "Download bundled Qt" FORCE) | ||
| 258 | endif() | ||
| 259 | endif() | ||
| 260 | if (YUZU_USE_BUNDLED_QT) | ||
| 261 | # Binary package currently does not support Qt webengine, so make sure it's disabled | ||
| 262 | set(YUZU_USE_QT_WEB_ENGINE OFF CACHE BOOL "Use Qt Webengine" FORCE) | ||
| 263 | endif() | ||
| 264 | endif() | ||
| 265 | |||
| 250 | # Workaround for an issue where conan tries to build Qt from scratch instead of download prebuilt binaries | 266 | # Workaround for an issue where conan tries to build Qt from scratch instead of download prebuilt binaries |
| 251 | set(QT_PREFIX_HINT) | 267 | set(QT_PREFIX_HINT) |
| 268 | |||
| 252 | if(YUZU_USE_BUNDLED_QT) | 269 | if(YUZU_USE_BUNDLED_QT) |
| 253 | if ((MSVC_VERSION GREATER_EQUAL 1910 AND MSVC_VERSION LESS 1930) AND ARCHITECTURE_x86_64) | 270 | if ((MSVC_VERSION GREATER_EQUAL 1910 AND MSVC_VERSION LESS 1930) AND ARCHITECTURE_x86_64) |
| 254 | set(QT_VER qt-5.12.8-msvc2017_64) | 271 | set(QT_BUILD qt-5.12.8-msvc2017_64) |
| 272 | elseif ((${CMAKE_SYSTEM_NAME} STREQUAL "Linux") AND NOT MINGW AND ARCHITECTURE_x86_64) | ||
| 273 | set(QT_BUILD qt5_5_15_2) | ||
| 255 | else() | 274 | else() |
| 256 | message(FATAL_ERROR "No bundled Qt binaries for your toolchain. Disable YUZU_USE_BUNDLED_QT and provide your own.") | 275 | message(FATAL_ERROR "No bundled Qt binaries for your toolchain. Disable YUZU_USE_BUNDLED_QT and provide your own.") |
| 257 | endif() | 276 | endif() |
| 258 | 277 | ||
| 259 | if (DEFINED QT_VER) | 278 | if (DEFINED QT_BUILD) |
| 260 | download_bundled_external("qt/" ${QT_VER} QT_PREFIX) | 279 | download_bundled_external("qt/" ${QT_BUILD} QT_PREFIX) |
| 261 | endif() | 280 | endif() |
| 262 | 281 | ||
| 263 | set(QT_PREFIX_HINT HINTS "${QT_PREFIX}") | 282 | set(QT_PREFIX_HINT HINTS "${QT_PREFIX}") |
| 264 | endif() | 283 | endif() |
| 265 | find_package(Qt5 5.9 COMPONENTS Widgets ${QT_PREFIX_HINT}) | 284 | find_package(Qt5 ${QT_VERSION} REQUIRED COMPONENTS Widgets ${QT_PREFIX_HINT} NO_CMAKE_SYSTEM_PATH) |
| 266 | if (YUZU_USE_QT_WEB_ENGINE) | 285 | if (YUZU_USE_QT_WEB_ENGINE) |
| 267 | find_package(Qt5 COMPONENTS WebEngineCore WebEngineWidgets) | 286 | find_package(Qt5 COMPONENTS WebEngineCore WebEngineWidgets) |
| 268 | endif() | 287 | endif() |
| @@ -271,6 +290,7 @@ if(ENABLE_QT) | |||
| 271 | find_package(Qt5 REQUIRED COMPONENTS LinguistTools ${QT_PREFIX_HINT}) | 290 | find_package(Qt5 REQUIRED COMPONENTS LinguistTools ${QT_PREFIX_HINT}) |
| 272 | endif() | 291 | endif() |
| 273 | endif() | 292 | endif() |
| 293 | |||
| 274 | # find SDL2 exports a bunch of variables that are needed, so its easier to do this outside of the yuzu_find_package | 294 | # find SDL2 exports a bunch of variables that are needed, so its easier to do this outside of the yuzu_find_package |
| 275 | if (ENABLE_SDL2) | 295 | if (ENABLE_SDL2) |
| 276 | if (YUZU_USE_BUNDLED_SDL2) | 296 | if (YUZU_USE_BUNDLED_SDL2) |
| @@ -379,7 +399,7 @@ if (CONAN_REQUIRED_LIBS) | |||
| 379 | if(ENABLE_QT) | 399 | if(ENABLE_QT) |
| 380 | list(APPEND CMAKE_MODULE_PATH "${CONAN_QT_ROOT_RELEASE}") | 400 | list(APPEND CMAKE_MODULE_PATH "${CONAN_QT_ROOT_RELEASE}") |
| 381 | list(APPEND CMAKE_PREFIX_PATH "${CONAN_QT_ROOT_RELEASE}") | 401 | list(APPEND CMAKE_PREFIX_PATH "${CONAN_QT_ROOT_RELEASE}") |
| 382 | find_package(Qt5 5.9 REQUIRED COMPONENTS Widgets) | 402 | find_package(Qt5 5.12 REQUIRED COMPONENTS Widgets) |
| 383 | if (YUZU_USE_QT_WEB_ENGINE) | 403 | if (YUZU_USE_QT_WEB_ENGINE) |
| 384 | find_package(Qt5 REQUIRED COMPONENTS WebEngineCore WebEngineWidgets) | 404 | find_package(Qt5 REQUIRED COMPONENTS WebEngineCore WebEngineWidgets) |
| 385 | endif() | 405 | endif() |
| @@ -406,7 +426,7 @@ if(NOT APPLE) | |||
| 406 | endif() | 426 | endif() |
| 407 | if (NOT LIBUSB_FOUND) | 427 | if (NOT LIBUSB_FOUND) |
| 408 | add_subdirectory(externals/libusb) | 428 | add_subdirectory(externals/libusb) |
| 409 | set(LIBUSB_INCLUDE_DIR "") | 429 | set(LIBUSB_INCLUDE_DIR "${CMAKE_CURRENT_SOURCE_DIR}/externals/libusb/libusb/libusb") |
| 410 | set(LIBUSB_LIBRARIES usb) | 430 | set(LIBUSB_LIBRARIES usb) |
| 411 | endif() | 431 | endif() |
| 412 | 432 | ||