summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar lat9nq2021-05-19 17:18:33 -0400
committerGravatar lat9nq2021-05-26 15:29:45 -0400
commit52cc25ccbf5faf3ae0ee33e9e28e998440f5c424 (patch)
treec390fd461611f32a69274fbb53f45da4d18fa697
parentMerge pull request #6339 from Morph1984/swkbd-queuedconnection (diff)
downloadyuzu-52cc25ccbf5faf3ae0ee33e9e28e998440f5c424.tar.gz
yuzu-52cc25ccbf5faf3ae0ee33e9e28e998440f5c424.tar.xz
yuzu-52cc25ccbf5faf3ae0ee33e9e28e998440f5c424.zip
cmake: Download Qt binaries on Linux if needed
If the local version of Qt is older than the minimum version required by yuzu, download a pre-built binary package from yuzu-emu/ext-linux-bin and build yuzu with it, instead. This also requires linking yuzu to the correct libraries after building it, and copying over the required binaries when building yuzu. This sets the Qt requirement to 5.12, which is intentionally behind the versions used by our toolchains since they are not all updated yet to 5.15.
-rw-r--r--CMakeLists.txt32
-rw-r--r--CMakeModules/CopyYuzuQt5Deps.cmake135
-rw-r--r--src/yuzu/CMakeLists.txt13
3 files changed, 134 insertions, 46 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e70f29636..b17bc9c0f 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -17,7 +17,7 @@ CMAKE_DEPENDENT_OPTION(YUZU_ALLOW_SYSTEM_SDL2 "Try using system SDL2 before fall
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)
20CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_QT "Download bundled Qt binaries" ON "ENABLE_QT;MSVC" OFF) 20CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_QT "Download bundled Qt binaries" MSVC "ENABLE_QT" OFF)
21 21
22option(ENABLE_WEB_SERVICE "Enable web services (telemetry, etc.)" ON) 22option(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
242if(ENABLE_QT) 242if(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()
273endif() 292endif()
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
275if (ENABLE_SDL2) 295if (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()
diff --git a/CMakeModules/CopyYuzuQt5Deps.cmake b/CMakeModules/CopyYuzuQt5Deps.cmake
index 59343b1ca..4a6aeebbb 100644
--- a/CMakeModules/CopyYuzuQt5Deps.cmake
+++ b/CMakeModules/CopyYuzuQt5Deps.cmake
@@ -1,52 +1,111 @@
1function(copy_yuzu_Qt5_deps target_dir) 1function(copy_yuzu_Qt5_deps target_dir)
2 include(WindowsCopyFiles) 2 include(WindowsCopyFiles)
3 set(DLL_DEST "${CMAKE_BINARY_DIR}/bin/$<CONFIG>/") 3 if (MSVC)
4 set(Qt5_DLL_DIR "${Qt5_DIR}/../../../bin") 4 set(DLL_DEST "${CMAKE_BINARY_DIR}/bin/$<CONFIG>/")
5 set(Qt5_DLL_DIR "${Qt5_DIR}/../../../bin")
6 else()
7 set(DLL_DEST "${CMAKE_BINARY_DIR}/bin/")
8 set(Qt5_DLL_DIR "${Qt5_DIR}/../../../lib/")
9 endif()
5 set(Qt5_PLATFORMS_DIR "${Qt5_DIR}/../../../plugins/platforms/") 10 set(Qt5_PLATFORMS_DIR "${Qt5_DIR}/../../../plugins/platforms/")
11 set(Qt5_PLATFORMTHEMES_DIR "${Qt5_DIR}/../../../plugins/platformthemes/")
12 set(Qt5_PLATFORMINPUTCONTEXTS_DIR "${Qt5_DIR}/../../../plugins/platforminputcontexts/")
13 set(Qt5_XCBGLINTEGRATIONS_DIR "${Qt5_DIR}/../../../plugins/xcbglintegrations/")
6 set(Qt5_STYLES_DIR "${Qt5_DIR}/../../../plugins/styles/") 14 set(Qt5_STYLES_DIR "${Qt5_DIR}/../../../plugins/styles/")
7 set(Qt5_IMAGEFORMATS_DIR "${Qt5_DIR}/../../../plugins/imageformats/") 15 set(Qt5_IMAGEFORMATS_DIR "${Qt5_DIR}/../../../plugins/imageformats/")
8 set(Qt5_RESOURCES_DIR "${Qt5_DIR}/../../../resources/") 16 set(Qt5_RESOURCES_DIR "${Qt5_DIR}/../../../resources/")
9 set(PLATFORMS ${DLL_DEST}plugins/platforms/) 17 set(PLATFORMS ${DLL_DEST}plugins/platforms/)
10 set(STYLES ${DLL_DEST}plugins/styles/) 18 set(STYLES ${DLL_DEST}plugins/styles/)
11 set(IMAGEFORMATS ${DLL_DEST}plugins/imageformats/) 19 set(IMAGEFORMATS ${DLL_DEST}plugins/imageformats/)
12 windows_copy_files(${target_dir} ${Qt5_DLL_DIR} ${DLL_DEST} 20 if (MSVC)
13 icudt*.dll 21 windows_copy_files(${target_dir} ${Qt5_DLL_DIR} ${DLL_DEST}
14 icuin*.dll 22 icudt*.dll
15 icuuc*.dll 23 icuin*.dll
16 Qt5Core$<$<CONFIG:Debug>:d>.* 24 icuuc*.dll
17 Qt5Gui$<$<CONFIG:Debug>:d>.* 25 Qt5Core$<$<CONFIG:Debug>:d>.*
18 Qt5Widgets$<$<CONFIG:Debug>:d>.* 26 Qt5Gui$<$<CONFIG:Debug>:d>.*
19 ) 27 Qt5Widgets$<$<CONFIG:Debug>:d>.*
20
21 if (YUZU_USE_QT_WEB_ENGINE)
22 windows_copy_files(${target_dir} ${Qt5_DLL_DIR} ${DLL_DEST}
23 Qt5Network$<$<CONFIG:Debug>:d>.*
24 Qt5Positioning$<$<CONFIG:Debug>:d>.*
25 Qt5PrintSupport$<$<CONFIG:Debug>:d>.*
26 Qt5Qml$<$<CONFIG:Debug>:d>.*
27 Qt5Quick$<$<CONFIG:Debug>:d>.*
28 Qt5QuickWidgets$<$<CONFIG:Debug>:d>.*
29 Qt5WebChannel$<$<CONFIG:Debug>:d>.*
30 Qt5WebEngine$<$<CONFIG:Debug>:d>.*
31 Qt5WebEngineCore$<$<CONFIG:Debug>:d>.*
32 Qt5WebEngineWidgets$<$<CONFIG:Debug>:d>.*
33 QtWebEngineProcess$<$<CONFIG:Debug>:d>.*
34 ) 28 )
35 29
36 windows_copy_files(${target_dir} ${Qt5_RESOURCES_DIR} ${DLL_DEST} 30 if (YUZU_USE_QT_WEB_ENGINE)
37 qtwebengine_resources.pak 31 windows_copy_files(${target_dir} ${Qt5_DLL_DIR} ${DLL_DEST}
38 qtwebengine_devtools_resources.pak 32 Qt5Network$<$<CONFIG:Debug>:d>.*
39 qtwebengine_resources_100p.pak 33 Qt5Positioning$<$<CONFIG:Debug>:d>.*
40 qtwebengine_resources_200p.pak 34 Qt5PrintSupport$<$<CONFIG:Debug>:d>.*
41 icudtl.dat 35 Qt5Qml$<$<CONFIG:Debug>:d>.*
42 ) 36 Qt5Quick$<$<CONFIG:Debug>:d>.*
43 endif () 37 Qt5QuickWidgets$<$<CONFIG:Debug>:d>.*
44 windows_copy_files(yuzu ${Qt5_PLATFORMS_DIR} ${PLATFORMS} qwindows$<$<CONFIG:Debug>:d>.*) 38 Qt5WebChannel$<$<CONFIG:Debug>:d>.*
45 windows_copy_files(yuzu ${Qt5_STYLES_DIR} ${STYLES} qwindowsvistastyle$<$<CONFIG:Debug>:d>.*) 39 Qt5WebEngine$<$<CONFIG:Debug>:d>.*
46 windows_copy_files(yuzu ${Qt5_IMAGEFORMATS_DIR} ${IMAGEFORMATS} 40 Qt5WebEngineCore$<$<CONFIG:Debug>:d>.*
47 qjpeg$<$<CONFIG:Debug>:d>.* 41 Qt5WebEngineWidgets$<$<CONFIG:Debug>:d>.*
48 qgif$<$<CONFIG:Debug>:d>.* 42 QtWebEngineProcess$<$<CONFIG:Debug>:d>.*
49 ) 43 )
44
45 windows_copy_files(${target_dir} ${Qt5_RESOURCES_DIR} ${DLL_DEST}
46 qtwebengine_resources.pak
47 qtwebengine_devtools_resources.pak
48 qtwebengine_resources_100p.pak
49 qtwebengine_resources_200p.pak
50 icudtl.dat
51 )
52 endif ()
53 windows_copy_files(yuzu ${Qt5_PLATFORMS_DIR} ${PLATFORMS} qwindows$<$<CONFIG:Debug>:d>.*)
54 windows_copy_files(yuzu ${Qt5_STYLES_DIR} ${STYLES} qwindowsvistastyle$<$<CONFIG:Debug>:d>.*)
55 windows_copy_files(yuzu ${Qt5_IMAGEFORMATS_DIR} ${IMAGEFORMATS}
56 qjpeg$<$<CONFIG:Debug>:d>.*
57 qgif$<$<CONFIG:Debug>:d>.*
58 )
59 else()
60 set(Qt5_DLLS
61 "${Qt5_DLL_DIR}libQt5Core.so.5"
62 "${Qt5_DLL_DIR}libQt5DBus.so.5"
63 "${Qt5_DLL_DIR}libQt5Gui.so.5"
64 "${Qt5_DLL_DIR}libQt5Widgets.so.5"
65 "${Qt5_DLL_DIR}libQt5XcbQpa.so.5"
66 "${Qt5_DLL_DIR}libicudata.so.60"
67 "${Qt5_DLL_DIR}libicui18n.so.60"
68 "${Qt5_DLL_DIR}libicuuc.so.60"
69 )
70 set(Qt5_IMAGEFORMAT_DLLS
71 "${Qt5_IMAGEFORMATS_DIR}libqjpeg.so"
72 "${Qt5_IMAGEFORMATS_DIR}libqgif.so"
73 "${Qt5_IMAGEFORMATS_DIR}libqico.so"
74 )
75 set(Qt5_PLATFORMTHEME_DLLS
76 "${Qt5_PLATFORMTHEMES_DIR}libqgtk3.so"
77 "${Qt5_PLATFORMTHEMES_DIR}libqxdgdesktopportal.so"
78 )
79 set(Qt5_PLATFORM_DLLS
80 "${Qt5_PLATFORMS_DIR}libqxcb.so"
81 )
82 set(Qt5_PLATFORMINPUTCONTEXT_DLLS
83 "${Qt5_PLATFORMINPUTCONTEXTS_DIR}libcomposeplatforminputcontextplugin.so"
84 "${Qt5_PLATFORMINPUTCONTEXTS_DIR}libibusplatforminputcontextplugin.so"
85 )
86 set(Qt5_XCBGLINTEGRATION_DLLS
87 "${Qt5_XCBGLINTEGRATIONS_DIR}libqxcb-glx-integration.so"
88 )
89 foreach(LIB ${Qt5_DLLS})
90 file(COPY ${LIB} DESTINATION "${DLL_DEST}/lib" FOLLOW_SYMLINK_CHAIN)
91 endforeach()
92 foreach(LIB ${Qt5_IMAGEFORMAT_DLLS})
93 file(COPY ${LIB} DESTINATION "${DLL_DEST}plugins/imageformats/" FOLLOW_SYMLINK_CHAIN)
94 endforeach()
95 foreach(LIB ${Qt5_PLATFORMTHEME_DLLS})
96 file(COPY ${LIB} DESTINATION "${DLL_DEST}plugins/platformthemes/" FOLLOW_SYMLINK_CHAIN)
97 endforeach()
98 foreach(LIB ${Qt5_PLATFORM_DLLS})
99 file(COPY ${LIB} DESTINATION "${DLL_DEST}plugins/platforms/" FOLLOW_SYMLINK_CHAIN)
100 endforeach()
101 foreach(LIB ${Qt5_PLATFORMINPUTCONTEXT_DLLS})
102 file(COPY ${LIB} DESTINATION "${DLL_DEST}plugins/platforminputcontexts/" FOLLOW_SYMLINK_CHAIN)
103 endforeach()
104 foreach(LIB ${Qt5_XCBGLINTEGRATION_DLLS})
105 file(COPY ${LIB} DESTINATION "${DLL_DEST}plugins/xcbglintegrations/" FOLLOW_SYMLINK_CHAIN)
106 endforeach()
107
108 endif()
50 # Create an empty qt.conf file. Qt will detect that this file exists, and use the folder that its in as the root folder. 109 # Create an empty qt.conf file. Qt will detect that this file exists, and use the folder that its in as the root folder.
51 # This way it'll look for plugins in the root/plugins/ folder 110 # This way it'll look for plugins in the root/plugins/ folder
52 add_custom_command(TARGET yuzu POST_BUILD 111 add_custom_command(TARGET yuzu POST_BUILD
diff --git a/src/yuzu/CMakeLists.txt b/src/yuzu/CMakeLists.txt
index cc0790e07..634fe66a5 100644
--- a/src/yuzu/CMakeLists.txt
+++ b/src/yuzu/CMakeLists.txt
@@ -4,6 +4,12 @@ set(CMAKE_AUTOUIC ON)
4set(CMAKE_INCLUDE_CURRENT_DIR ON) 4set(CMAKE_INCLUDE_CURRENT_DIR ON)
5set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules) 5set(CMAKE_MODULE_PATH ${CMAKE_MODULE_PATH} ${PROJECT_SOURCE_DIR}/CMakeModules)
6 6
7# Set the RPATH for Qt Libraries
8# This must be done before the `yuzu` target is created
9if (YUZU_USE_BUNDLED_QT AND (${CMAKE_SYSTEM_NAME} STREQUAL "Linux"))
10 set(CMAKE_BUILD_RPATH "${CMAKE_BINARY_DIR}/bin/lib/")
11endif()
12
7add_executable(yuzu 13add_executable(yuzu
8 Info.plist 14 Info.plist
9 about_dialog.cpp 15 about_dialog.cpp
@@ -278,11 +284,14 @@ if(UNIX AND NOT APPLE)
278 install(TARGETS yuzu RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin") 284 install(TARGETS yuzu RUNTIME DESTINATION "${CMAKE_INSTALL_PREFIX}/bin")
279endif() 285endif()
280 286
281if (MSVC) 287if (YUZU_USE_BUNDLED_QT)
282 include(CopyYuzuQt5Deps) 288 include(CopyYuzuQt5Deps)
289 copy_yuzu_Qt5_deps(yuzu)
290endif()
291
292if (MSVC)
283 include(CopyYuzuSDLDeps) 293 include(CopyYuzuSDLDeps)
284 include(CopyYuzuFFmpegDeps) 294 include(CopyYuzuFFmpegDeps)
285 copy_yuzu_Qt5_deps(yuzu)
286 copy_yuzu_SDL_deps(yuzu) 295 copy_yuzu_SDL_deps(yuzu)
287 copy_yuzu_FFmpeg_deps(yuzu) 296 copy_yuzu_FFmpeg_deps(yuzu)
288endif() 297endif()