summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorGravatar lat9nq2021-06-13 03:13:10 -0400
committerGravatar lat9nq2021-06-13 03:13:10 -0400
commit2bb0cc86245bd4ae47123b1804f06edec2a84255 (patch)
tree979c35f040d5136135de8bcd49eeedacf18e8bd8
parentcmake: Fix find_program usage for 3.15 (diff)
downloadyuzu-2bb0cc86245bd4ae47123b1804f06edec2a84255.tar.gz
yuzu-2bb0cc86245bd4ae47123b1804f06edec2a84255.tar.xz
yuzu-2bb0cc86245bd4ae47123b1804f06edec2a84255.zip
cmake: Check dependencies for Linux Qt package
Currently Qt will download whether or not the target system supports the package. Normally this isn't an issue since the package manager would work out the dependencies for us, but in this case we must make sure everything is in place before downloading the package. This checks for the package's requirements, as well as tries to provides hints as to what is required on some of the more cryptic dependencies.
Diffstat (limited to '')
-rw-r--r--CMakeLists.txt79
1 files changed, 75 insertions, 4 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index f0e892a97..9c2ab2330 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -253,11 +253,82 @@ if(ENABLE_QT)
253 253
254 # Check for system Qt on Linux, fallback to bundled Qt 254 # Check for system Qt on Linux, fallback to bundled Qt
255 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") 255 if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
256 if (NOT YUZU_USE_BUNDLED_QT) 256 find_package(Qt5 ${QT_VERSION} COMPONENTS Widgets)
257 find_package(Qt5 ${QT_VERSION} COMPONENTS Widgets QUIET) 257 if (NOT Qt5_FOUND OR YUZU_USE_BUNDLED_QT)
258 if (NOT Qt5_FOUND) 258 # Check for dependencies, then enable bundled Qt download
259 set(YUZU_USE_BUNDLED_QT ON CACHE BOOL "Download bundled Qt" FORCE) 259
260 # Check that the system GLIBCXX version is compatible
261 find_program(OBJDUMP objdump)
262 if ("${OBJDUMP}" STREQUAL "OBJDUMP-NOTFOUND")
263 message(FATAL_ERROR "Required program `objdump` not found.")
260 endif() 264 endif()
265 find_library(LIBSTDCXX libstdc++.so.6)
266 execute_process(
267 COMMAND
268 ${OBJDUMP} -T ${LIBSTDCXX}
269 COMMAND
270 grep GLIBCXX_3.4.28
271 COMMAND
272 sed "s/[0-9a-f]*.* //"
273 COMMAND
274 sed "s/ .*//"
275 COMMAND
276 sort -u
277 OUTPUT_VARIABLE
278 GLIBCXX_MET
279 )
280 if (NOT GLIBCXX_MET)
281 message(FATAL_ERROR "Qt too old or not found, and bundled Qt package is not \
282 compatible with this system. Either install Qt ${QT_VERSION}, or provide the path \
283 to Qt by setting the variable Qt5_ROOT.")
284 endif()
285
286 # Check for headers
287 Include(FindPkgConfig REQUIRED)
288 pkg_check_modules(QT_DEP_GLU QUIET glu>=9.0.0)
289 if (NOT QT_DEP_GLU_FOUND)
290 message(FATAL_ERROR "Qt bundled pacakge dependency `glu` not found. \
291 Perhaps `libglu1-mesa-dev` needs to be installed?")
292 endif()
293 pkg_check_modules(QT_DEP_MESA QUIET dri>=20.0.8)
294 if (NOT QT_DEP_MESA_FOUND)
295 message(FATAL_ERROR "Qt bundled pacakge dependency `dri` not found. \
296 Perhaps `mesa-common-dev` needs to be installed?")
297 endif()
298
299 # Check for X libraries
300 set(BUNDLED_QT_REQUIREMENTS
301 libxcb-icccm.so.4
302 libxcb-image.so.0
303 libxcb-keysyms.so.1
304 libxcb-randr.so.0
305 libxcb-render-util.so.0
306 libxcb-render.so.0
307 libxcb-shape.so.0
308 libxcb-shm.so.0
309 libxcb-sync.so.1
310 libxcb-xfixes.so.0
311 libxcb-xinerama.so.0
312 libxcb-xkb.so.1
313 libxcb.so.1
314 libxkbcommon-x11.so.0
315 libxkbcommon.so.0
316 )
317 set(UNRESOLVED_QT_DEPS "")
318 foreach (REQUIREMENT ${BUNDLED_QT_REQUIREMENTS})
319 find_library(BUNDLED_QT_${REQUIREMENT} ${REQUIREMENT})
320 if ("${BUNDLED_QT_${REQUIREMENT}}" STREQUAL "BUNDLED_QT_${REQUIREMENT}-NOTFOUND")
321 set(UNRESOLVED_QT_DEPS ${UNRESOLVED_QT_DEPS} ${REQUIREMENT})
322 endif()
323 unset(BUNDLED_QT_${REQUIREMENT})
324 endforeach()
325 unset(BUNDLED_QT_REQUIREMENTS)
326
327 if (NOT "${UNRESOLVED_QT_DEPS}" STREQUAL "")
328 message(FATAL_ERROR "Bundled Qt package missing required dependencies: ${UNRESOLVED_QT_DEPS}")
329 endif()
330
331 set(YUZU_USE_BUNDLED_QT ON CACHE BOOL "Download bundled Qt" FORCE)
261 endif() 332 endif()
262 if (YUZU_USE_BUNDLED_QT) 333 if (YUZU_USE_BUNDLED_QT)
263 # Binary package currently does not support Qt webengine, so make sure it's disabled 334 # Binary package currently does not support Qt webengine, so make sure it's disabled