summaryrefslogtreecommitdiffstats
path: root/CMakeLists.txt
diff options
context:
space:
mode:
authorKyle Kienapfel <Docteh@users.noreply.github.com>2022-10-18 01:55:40 +0200
committerKyle Kienapfel <Docteh@users.noreply.github.com>2022-11-24 15:28:42 +0100
commita75542ad2dd028f9aa3adfb00e92817ada12ccd8 (patch)
tree1ee95f8a10eb450aebd88c8940f1ea371bf226af /CMakeLists.txt
parentqt: Add Qt version to LogRuntimes (diff)
downloadyuzu-a75542ad2dd028f9aa3adfb00e92817ada12ccd8.tar
yuzu-a75542ad2dd028f9aa3adfb00e92817ada12ccd8.tar.gz
yuzu-a75542ad2dd028f9aa3adfb00e92817ada12ccd8.tar.bz2
yuzu-a75542ad2dd028f9aa3adfb00e92817ada12ccd8.tar.lz
yuzu-a75542ad2dd028f9aa3adfb00e92817ada12ccd8.tar.xz
yuzu-a75542ad2dd028f9aa3adfb00e92817ada12ccd8.tar.zst
yuzu-a75542ad2dd028f9aa3adfb00e92817ada12ccd8.zip
Diffstat (limited to 'CMakeLists.txt')
-rw-r--r--CMakeLists.txt251
1 files changed, 147 insertions, 104 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 1d13dc74e..2d2761ec1 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -19,6 +19,9 @@ CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_SDL2 "Download bundled SDL2 binaries" ON
CMAKE_DEPENDENT_OPTION(YUZU_USE_EXTERNAL_SDL2 "Compile external SDL2" ON "ENABLE_SDL2;NOT MSVC" OFF)
option(ENABLE_QT "Enable the Qt frontend" ON)
+option(ENABLE_QT6 "Allow usage of Qt6 to be attempted" OFF)
+set(QT6_LOCATION "" CACHE PATH "Additional Location to search for Qt6 libraries like C:/Qt/6.3.1/msvc2019_64/")
+
option(ENABLE_QT_TRANSLATION "Enable translations for the Qt frontend" OFF)
CMAKE_DEPENDENT_OPTION(YUZU_USE_BUNDLED_QT "Download bundled Qt binaries" "${MSVC}" "ENABLE_QT" OFF)
@@ -28,6 +31,8 @@ option(YUZU_USE_BUNDLED_LIBUSB "Compile bundled libusb" OFF)
option(YUZU_USE_BUNDLED_FFMPEG "Download/Build bundled FFmpeg" "${WIN32}")
+option(YUZU_USE_QT_MULTIMEDIA "Use QtMultimedia for Camera" OFF)
+
option(YUZU_USE_QT_WEB_ENGINE "Use QtWebEngine for web applet implementation" OFF)
option(ENABLE_CUBEB "Enables the cubeb audio backend" ON)
@@ -213,128 +218,166 @@ if (MINGW)
find_library(MSWSOCK_LIBRARY mswsock REQUIRED)
endif()
+# Please consider this as a stub
+if(ENABLE_QT6 AND Qt6_LOCATION)
+ list(APPEND CMAKE_PREFIX_PATH "${Qt6_LOCATION}")
+endif()
+
+function(set_yuzu_qt_components)
+ # Best practice is to ask for all components at once, so they are from the same version
+ set(YUZU_QT_COMPONENTS2 Core Widgets Concurrent)
+ if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
+ list(APPEND YUZU_QT_COMPONENTS2 DBus)
+ endif()
+ if (YUZU_USE_QT_MULTIMEDIA)
+ list(APPEND YUZU_QT_COMPONENTS2 Multimedia)
+ endif()
+ if (YUZU_USE_QT_WEB_ENGINE)
+ list(APPEND YUZU_QT_COMPONENTS2 WebEngineCore WebEngineWidgets)
+ endif()
+ if (ENABLE_QT_TRANSLATION)
+ list(APPEND YUZU_QT_COMPONENTS2 LinguistTools)
+ endif()
+ set(YUZU_QT_COMPONENTS ${YUZU_QT_COMPONENTS2} PARENT_SCOPE)
+endfunction(set_yuzu_qt_components)
+
# Qt5 requires that we find components, so it doesn't fit our pretty little find package function
if(ENABLE_QT)
set(QT_VERSION 5.15)
+ # These are used to specify minimum versions
+ set(QT5_VERSION 5.15)
+ set(QT6_VERSION 6.3.1)
- # Check for system Qt on Linux, fallback to bundled Qt
- if (UNIX AND NOT APPLE)
- if (NOT YUZU_USE_BUNDLED_QT)
- find_package(Qt5 ${QT_VERSION} COMPONENTS Widgets DBus Multimedia)
- endif()
- if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND (NOT Qt5_FOUND OR YUZU_USE_BUNDLED_QT))
- # Check for dependencies, then enable bundled Qt download
-
- # Check that the system GLIBCXX version is compatible
- find_program(OBJDUMP objdump)
- if ("${OBJDUMP}" STREQUAL "OBJDUMP-NOTFOUND")
- message(FATAL_ERROR "Required program `objdump` not found.")
- endif()
- find_library(LIBSTDCXX libstdc++.so.6)
- execute_process(
- COMMAND
- ${OBJDUMP} -T ${LIBSTDCXX}
- COMMAND
- grep GLIBCXX_3.4.28
- COMMAND
- sed "s/[0-9a-f]*.* //"
- COMMAND
- sed "s/ .*//"
- COMMAND
- sort -u
- OUTPUT_VARIABLE
- GLIBCXX_MET
- )
- if (NOT GLIBCXX_MET)
- message(FATAL_ERROR "Qt too old or not found, and bundled Qt package is not \
- compatible with this system. Either install Qt ${QT_VERSION}, or provide the path \
- to Qt by setting the variable Qt5_ROOT.")
+ set_yuzu_qt_components()
+ if (ENABLE_QT6)
+ find_package(Qt6 ${QT6_VERSION} COMPONENTS ${YUZU_QT_COMPONENTS})
+ endif()
+ if (Qt6_FOUND)
+ message(STATUS "yuzu/CMakeLists.txt: Qt6Widgets_VERSION ${Qt6Widgets_VERSION}, setting QT_VERSION")
+ set(QT_VERSION ${Qt6Widgets_VERSION})
+ set(QT_MAJOR_VERSION 6)
+ # Qt6 sets cxx_std_17 and we need to undo that
+ set_target_properties(Qt6::Platform PROPERTIES INTERFACE_COMPILE_FEATURES "")
+ else()
+ message(STATUS "yuzu/CMakeLists.txt: Qt6 not found/not selected, trying for Qt5")
+ # When Qt6 partially found, need this set to use Qt5 when not specifying version
+ set(QT_DEFAULT_MAJOR_VERSION 5)
+ set(QT_MAJOR_VERSION 5)
+
+ set(YUZU_USE_QT_MULTIMEDIA ON)
+ # Check for system Qt on Linux, fallback to bundled Qt
+ if (UNIX AND NOT APPLE)
+ if (NOT YUZU_USE_BUNDLED_QT)
+ find_package(Qt5 ${QT5_VERSION} COMPONENTS Widgets DBus Multimedia)
endif()
+ if (${CMAKE_SYSTEM_NAME} STREQUAL "Linux" AND (NOT Qt5_FOUND OR YUZU_USE_BUNDLED_QT))
+ # Check for dependencies, then enable bundled Qt download
- # Check for headers
- find_package(PkgConfig REQUIRED)
- pkg_check_modules(QT_DEP_GLU QUIET glu>=9.0.0)
- if (NOT QT_DEP_GLU_FOUND)
- message(FATAL_ERROR "Qt bundled pacakge dependency `glu` not found. \
- Perhaps `libglu1-mesa-dev` needs to be installed?")
- endif()
- pkg_check_modules(QT_DEP_MESA QUIET dri>=20.0.8)
- if (NOT QT_DEP_MESA_FOUND)
- message(FATAL_ERROR "Qt bundled pacakge dependency `dri` not found. \
- Perhaps `mesa-common-dev` needs to be installed?")
- endif()
+ # Check that the system GLIBCXX version is compatible
+ find_program(OBJDUMP objdump)
+ if (NOT OBJDUMP)
+ message(FATAL_ERROR "Required program `objdump` not found.")
+ endif()
+ find_library(LIBSTDCXX libstdc++.so.6)
+ execute_process(
+ COMMAND
+ ${OBJDUMP} -T ${LIBSTDCXX}
+ COMMAND
+ grep GLIBCXX_3.4.28
+ COMMAND
+ sed "s/[0-9a-f]*.* //"
+ COMMAND
+ sed "s/ .*//"
+ COMMAND
+ sort -u
+ OUTPUT_VARIABLE
+ GLIBCXX_MET
+ )
+ if (NOT GLIBCXX_MET)
+ message(FATAL_ERROR "Qt too old or not found, and bundled Qt package is not \
+ compatible with this system. Either install Qt ${QT_VERSION}, or provide the path \
+ to Qt by setting the variable Qt5_ROOT.")
+ endif()
- # Check for X libraries
- set(BUNDLED_QT_REQUIREMENTS
- libxcb-icccm.so.4
- libxcb-image.so.0
- libxcb-keysyms.so.1
- libxcb-randr.so.0
- libxcb-render-util.so.0
- libxcb-render.so.0
- libxcb-shape.so.0
- libxcb-shm.so.0
- libxcb-sync.so.1
- libxcb-xfixes.so.0
- libxcb-xinerama.so.0
- libxcb-xkb.so.1
- libxcb.so.1
- libxkbcommon-x11.so.0
- libxkbcommon.so.0
- )
- set(UNRESOLVED_QT_DEPS "")
- foreach (REQUIREMENT ${BUNDLED_QT_REQUIREMENTS})
- find_library(BUNDLED_QT_${REQUIREMENT} ${REQUIREMENT})
- if ("${BUNDLED_QT_${REQUIREMENT}}" STREQUAL "BUNDLED_QT_${REQUIREMENT}-NOTFOUND")
- set(UNRESOLVED_QT_DEPS ${UNRESOLVED_QT_DEPS} ${REQUIREMENT})
+ # Check for headers
+ find_package(PkgConfig REQUIRED)
+ pkg_check_modules(QT_DEP_GLU QUIET glu>=9.0.0)
+ if (NOT QT_DEP_GLU_FOUND)
+ message(FATAL_ERROR "Qt bundled pacakge dependency `glu` not found. \
+ Perhaps `libglu1-mesa-dev` needs to be installed?")
+ endif()
+ pkg_check_modules(QT_DEP_MESA QUIET dri>=20.0.8)
+ if (NOT QT_DEP_MESA_FOUND)
+ message(FATAL_ERROR "Qt bundled pacakge dependency `dri` not found. \
+ Perhaps `mesa-common-dev` needs to be installed?")
endif()
- unset(BUNDLED_QT_${REQUIREMENT})
- endforeach()
- unset(BUNDLED_QT_REQUIREMENTS)
- if (NOT "${UNRESOLVED_QT_DEPS}" STREQUAL "")
- message(FATAL_ERROR "Bundled Qt package missing required dependencies: ${UNRESOLVED_QT_DEPS}")
- endif()
+ # Check for X libraries
+ set(BUNDLED_QT_REQUIREMENTS
+ libxcb-icccm.so.4
+ libxcb-image.so.0
+ libxcb-keysyms.so.1
+ libxcb-randr.so.0
+ libxcb-render-util.so.0
+ libxcb-render.so.0
+ libxcb-shape.so.0
+ libxcb-shm.so.0
+ libxcb-sync.so.1
+ libxcb-xfixes.so.0
+ libxcb-xinerama.so.0
+ libxcb-xkb.so.1
+ libxcb.so.1
+ libxkbcommon-x11.so.0
+ libxkbcommon.so.0
+ )
+ set(UNRESOLVED_QT_DEPS "")
+ foreach (REQUIREMENT ${BUNDLED_QT_REQUIREMENTS})
+ find_library(BUNDLED_QT_${REQUIREMENT} ${REQUIREMENT})
+ if (NOT BUNDLED_QT_${REQUIREMENT})
+ set(UNRESOLVED_QT_DEPS ${UNRESOLVED_QT_DEPS} ${REQUIREMENT})
+ endif()
+ unset(BUNDLED_QT_${REQUIREMENT})
+ endforeach()
+ unset(BUNDLED_QT_REQUIREMENTS)
+
+ if (NOT "${UNRESOLVED_QT_DEPS}" STREQUAL "")
+ message(FATAL_ERROR "Bundled Qt package missing required dependencies: ${UNRESOLVED_QT_DEPS}")
+ endif()
- set(YUZU_USE_BUNDLED_QT ON CACHE BOOL "Download bundled Qt" FORCE)
- endif()
- if (YUZU_USE_BUNDLED_QT)
- # Binary package currently does not support Qt webengine, so make sure it's disabled
- set(YUZU_USE_QT_WEB_ENGINE OFF CACHE BOOL "Use Qt Webengine" FORCE)
+ set(YUZU_USE_BUNDLED_QT ON CACHE BOOL "Download bundled Qt" FORCE)
+ endif()
+ if (YUZU_USE_BUNDLED_QT)
+ # Binary package currently does not support Qt webengine, so make sure it's disabled
+ set(YUZU_USE_QT_WEB_ENGINE OFF CACHE BOOL "Use Qt Webengine" FORCE)
+ endif()
endif()
- endif()
- set(YUZU_QT_NO_CMAKE_SYSTEM_PATH)
+ set(YUZU_QT_NO_CMAKE_SYSTEM_PATH)
- if(YUZU_USE_BUNDLED_QT)
- if ((MSVC_VERSION GREATER_EQUAL 1920 AND MSVC_VERSION LESS 1940) AND ARCHITECTURE_x86_64)
- set(QT_BUILD qt-5.15.2-msvc2019_64)
- elseif ((${CMAKE_SYSTEM_NAME} STREQUAL "Linux") AND NOT MINGW AND ARCHITECTURE_x86_64)
- set(QT_BUILD qt5_5_15_2)
- else()
- message(FATAL_ERROR "No bundled Qt binaries for your toolchain. Disable YUZU_USE_BUNDLED_QT and provide your own.")
- endif()
+ if(YUZU_USE_BUNDLED_QT)
+ if ((MSVC_VERSION GREATER_EQUAL 1920 AND MSVC_VERSION LESS 1940) AND ARCHITECTURE_x86_64)
+ set(QT_BUILD qt-5.15.2-msvc2019_64)
+ elseif ((${CMAKE_SYSTEM_NAME} STREQUAL "Linux") AND NOT MINGW AND ARCHITECTURE_x86_64)
+ set(QT_BUILD qt5_5_15_2)
+ else()
+ message(FATAL_ERROR "No bundled Qt binaries for your toolchain. Disable YUZU_USE_BUNDLED_QT and provide your own.")
+ endif()
- if (DEFINED QT_BUILD)
- download_bundled_external("qt/" ${QT_BUILD} QT_PREFIX)
- endif()
+ if (DEFINED QT_BUILD)
+ download_bundled_external("qt/" ${QT_BUILD} QT_PREFIX)
+ endif()
- set(QT_PREFIX_HINT HINTS "${QT_PREFIX}")
+ set(QT_PREFIX_HINT HINTS "${QT_PREFIX}")
- set(YUZU_QT_NO_CMAKE_SYSTEM_PATH "NO_CMAKE_SYSTEM_PATH")
- endif()
- if (UNIX AND NOT APPLE AND YUZU_USE_BUNDLED_QT)
- find_package(Qt5 ${QT_VERSION} REQUIRED COMPONENTS Widgets Concurrent Multimedia DBus ${QT_PREFIX_HINT} ${YUZU_QT_NO_CMAKE_SYSTEM_PATH})
- else()
- find_package(Qt5 ${QT_VERSION} REQUIRED COMPONENTS Widgets Concurrent Multimedia ${QT_PREFIX_HINT} ${YUZU_QT_NO_CMAKE_SYSTEM_PATH})
- endif()
- if (YUZU_USE_QT_WEB_ENGINE)
- find_package(Qt5 REQUIRED COMPONENTS WebEngineCore WebEngineWidgets)
- endif()
+ set(YUZU_QT_NO_CMAKE_SYSTEM_PATH "NO_CMAKE_SYSTEM_PATH")
+ # Binary package for Qt5 has Qt Multimedia
+ set(YUZU_USE_QT_MULTIMEDIA ON CACHE BOOL "Use Qt Multimedia" FORCE)
+ endif()
- if (ENABLE_QT_TRANSLATION)
- find_package(Qt5 REQUIRED COMPONENTS LinguistTools ${QT_PREFIX_HINT})
+ set_yuzu_qt_components()
+ find_package(Qt5 ${QT5_VERSION} COMPONENTS ${YUZU_QT_COMPONENTS} ${QT_PREFIX_HINT} ${YUZU_QT_NO_CMAKE_SYSTEM_PATH})
endif()
+
endif()
# find SDL2 exports a bunch of variables that are needed, so its easier to do this outside of the yuzu_find_package