diff options
| author | Briar <205427297+icybriarr@users.noreply.github.com> | 2025-03-31 18:33:05 +0200 |
|---|---|---|
| committer | Briar <205427297+icybriarr@users.noreply.github.com> | 2025-04-04 03:23:31 +0200 |
| commit | 6c3381a608ece965c88d05e45d990bfaaf9d7d23 (patch) | |
| tree | 92dfcbc7cd5102c5ec9e3bd09a2745ad65b7c03c /CMakeModules | |
| parent | 345a2af636e7c9b98b6f7cb193470a37fa567aa8 (diff) | |
qt: 6.7.3 Implementation
Co-authored-by: Kleidis <167202775+kleidis@users.noreply.github.com>
Diffstat (limited to 'CMakeModules')
| -rw-r--r-- | CMakeModules/CopyYuzuQt5Deps.cmake | 125 | ||||
| -rw-r--r-- | CMakeModules/CopyYuzuQt6Deps.cmake | 61 | ||||
| -rw-r--r-- | CMakeModules/DownloadExternals.cmake | 176 | ||||
| -rw-r--r-- | CMakeModules/aqt_config.ini | 31 |
4 files changed, 265 insertions, 128 deletions
diff --git a/CMakeModules/CopyYuzuQt5Deps.cmake b/CMakeModules/CopyYuzuQt5Deps.cmake deleted file mode 100644 index b3a65c3476..0000000000 --- a/CMakeModules/CopyYuzuQt5Deps.cmake +++ /dev/null @@ -1,125 +0,0 @@ -# SPDX-FileCopyrightText: 2016 Citra Emulator Project -# SPDX-License-Identifier: GPL-2.0-or-later - -function(copy_yuzu_Qt5_deps target_dir) - include(WindowsCopyFiles) - if (MSVC) - set(DLL_DEST "$<TARGET_FILE_DIR:${target_dir}>/") - set(Qt5_DLL_DIR "${Qt5_DIR}/../../../bin") - else() - set(DLL_DEST "${CMAKE_BINARY_DIR}/bin/") - set(Qt5_DLL_DIR "${Qt5_DIR}/../../../lib/") - endif() - set(Qt5_PLATFORMS_DIR "${Qt5_DIR}/../../../plugins/platforms/") - set(Qt5_PLATFORMTHEMES_DIR "${Qt5_DIR}/../../../plugins/platformthemes/") - set(Qt5_PLATFORMINPUTCONTEXTS_DIR "${Qt5_DIR}/../../../plugins/platforminputcontexts/") - set(Qt5_MEDIASERVICE_DIR "${Qt5_DIR}/../../../plugins/mediaservice/") - set(Qt5_XCBGLINTEGRATIONS_DIR "${Qt5_DIR}/../../../plugins/xcbglintegrations/") - set(Qt5_STYLES_DIR "${Qt5_DIR}/../../../plugins/styles/") - set(Qt5_IMAGEFORMATS_DIR "${Qt5_DIR}/../../../plugins/imageformats/") - set(Qt5_RESOURCES_DIR "${Qt5_DIR}/../../../resources/") - set(PLATFORMS ${DLL_DEST}plugins/platforms/) - set(MEDIASERVICE ${DLL_DEST}mediaservice/) - set(STYLES ${DLL_DEST}plugins/styles/) - set(IMAGEFORMATS ${DLL_DEST}plugins/imageformats/) - if (MSVC) - windows_copy_files(${target_dir} ${Qt5_DLL_DIR} ${DLL_DEST} - Qt5Core$<$<CONFIG:Debug>:d>.* - Qt5Gui$<$<CONFIG:Debug>:d>.* - Qt5Widgets$<$<CONFIG:Debug>:d>.* - Qt5Network$<$<CONFIG:Debug>:d>.* - ) - if (YUZU_USE_QT_MULTIMEDIA) - windows_copy_files(${target_dir} ${Qt5_DLL_DIR} ${DLL_DEST} - Qt5Multimedia$<$<CONFIG:Debug>:d>.* - ) - endif() - if (YUZU_USE_QT_WEB_ENGINE) - windows_copy_files(${target_dir} ${Qt5_DLL_DIR} ${DLL_DEST} - Qt5Network$<$<CONFIG:Debug>:d>.* - Qt5Positioning$<$<CONFIG:Debug>:d>.* - Qt5PrintSupport$<$<CONFIG:Debug>:d>.* - Qt5Qml$<$<CONFIG:Debug>:d>.* - Qt5QmlModels$<$<CONFIG:Debug>:d>.* - Qt5Quick$<$<CONFIG:Debug>:d>.* - Qt5QuickWidgets$<$<CONFIG:Debug>:d>.* - Qt5WebChannel$<$<CONFIG:Debug>:d>.* - Qt5WebEngineCore$<$<CONFIG:Debug>:d>.* - Qt5WebEngineWidgets$<$<CONFIG:Debug>:d>.* - QtWebEngineProcess$<$<CONFIG:Debug>:d>.* - ) - - windows_copy_files(${target_dir} ${Qt5_RESOURCES_DIR} ${DLL_DEST} - icudtl.dat - qtwebengine_devtools_resources.pak - qtwebengine_resources.pak - qtwebengine_resources_100p.pak - qtwebengine_resources_200p.pak - ) - endif () - windows_copy_files(yuzu ${Qt5_PLATFORMS_DIR} ${PLATFORMS} qwindows$<$<CONFIG:Debug>:d>.*) - windows_copy_files(yuzu ${Qt5_STYLES_DIR} ${STYLES} qwindowsvistastyle$<$<CONFIG:Debug>:d>.*) - windows_copy_files(yuzu ${Qt5_IMAGEFORMATS_DIR} ${IMAGEFORMATS} - qjpeg$<$<CONFIG:Debug>:d>.* - qgif$<$<CONFIG:Debug>:d>.* - ) - windows_copy_files(yuzu ${Qt5_MEDIASERVICE_DIR} ${MEDIASERVICE} - dsengine$<$<CONFIG:Debug>:d>.* - wmfengine$<$<CONFIG:Debug>:d>.* - ) - else() - set(Qt5_DLLS - "${Qt5_DLL_DIR}libQt5Core.so.5" - "${Qt5_DLL_DIR}libQt5DBus.so.5" - "${Qt5_DLL_DIR}libQt5Gui.so.5" - "${Qt5_DLL_DIR}libQt5Widgets.so.5" - "${Qt5_DLL_DIR}libQt5XcbQpa.so.5" - "${Qt5_DLL_DIR}libicudata.so.60" - "${Qt5_DLL_DIR}libicui18n.so.60" - "${Qt5_DLL_DIR}libicuuc.so.60" - ) - set(Qt5_IMAGEFORMAT_DLLS - "${Qt5_IMAGEFORMATS_DIR}libqjpeg.so" - "${Qt5_IMAGEFORMATS_DIR}libqgif.so" - "${Qt5_IMAGEFORMATS_DIR}libqico.so" - ) - set(Qt5_PLATFORMTHEME_DLLS - "${Qt5_PLATFORMTHEMES_DIR}libqgtk3.so" - "${Qt5_PLATFORMTHEMES_DIR}libqxdgdesktopportal.so" - ) - set(Qt5_PLATFORM_DLLS - "${Qt5_PLATFORMS_DIR}libqxcb.so" - ) - set(Qt5_PLATFORMINPUTCONTEXT_DLLS - "${Qt5_PLATFORMINPUTCONTEXTS_DIR}libcomposeplatforminputcontextplugin.so" - "${Qt5_PLATFORMINPUTCONTEXTS_DIR}libibusplatforminputcontextplugin.so" - ) - set(Qt5_XCBGLINTEGRATION_DLLS - "${Qt5_XCBGLINTEGRATIONS_DIR}libqxcb-glx-integration.so" - ) - foreach(LIB ${Qt5_DLLS}) - file(COPY ${LIB} DESTINATION "${DLL_DEST}/lib" FOLLOW_SYMLINK_CHAIN) - endforeach() - foreach(LIB ${Qt5_IMAGEFORMAT_DLLS}) - file(COPY ${LIB} DESTINATION "${DLL_DEST}plugins/imageformats/" FOLLOW_SYMLINK_CHAIN) - endforeach() - foreach(LIB ${Qt5_PLATFORMTHEME_DLLS}) - file(COPY ${LIB} DESTINATION "${DLL_DEST}plugins/platformthemes/" FOLLOW_SYMLINK_CHAIN) - endforeach() - foreach(LIB ${Qt5_PLATFORM_DLLS}) - file(COPY ${LIB} DESTINATION "${DLL_DEST}plugins/platforms/" FOLLOW_SYMLINK_CHAIN) - endforeach() - foreach(LIB ${Qt5_PLATFORMINPUTCONTEXT_DLLS}) - file(COPY ${LIB} DESTINATION "${DLL_DEST}plugins/platforminputcontexts/" FOLLOW_SYMLINK_CHAIN) - endforeach() - foreach(LIB ${Qt5_XCBGLINTEGRATION_DLLS}) - file(COPY ${LIB} DESTINATION "${DLL_DEST}plugins/xcbglintegrations/" FOLLOW_SYMLINK_CHAIN) - endforeach() - - endif() - # Create an empty qt.conf file. Qt will detect that this file exists, and use the folder that its in as the root folder. - # This way it'll look for plugins in the root/plugins/ folder - add_custom_command(TARGET yuzu POST_BUILD - COMMAND ${CMAKE_COMMAND} -E touch ${DLL_DEST}qt.conf - ) -endfunction(copy_yuzu_Qt5_deps) diff --git a/CMakeModules/CopyYuzuQt6Deps.cmake b/CMakeModules/CopyYuzuQt6Deps.cmake new file mode 100644 index 0000000000..b07781a59c --- /dev/null +++ b/CMakeModules/CopyYuzuQt6Deps.cmake @@ -0,0 +1,61 @@ +# SPDX-FileCopyrightText: 2024 Citron HomeBrew Emulator Project +# SPDX-FileCopyrightText: 2024 kleidis + +function(copy_yuzu_Qt6_deps target_dir) + include(WindowsCopyFiles) + if (MSVC) + set(DLL_DEST "$<TARGET_FILE_DIR:${target_dir}>/") + set(Qt6_DLL_DIR "${Qt6_DIR}/../../../bin") + else() + set(DLL_DEST "${CMAKE_BINARY_DIR}/bin/") + set(Qt6_DLL_DIR "${Qt6_DIR}/../../../lib/") + endif() + set(Qt6_PLATFORMS_DIR "${Qt6_DIR}/../../../plugins/platforms/") + set(Qt6_STYLES_DIR "${Qt6_DIR}/../../../plugins/styles/") + set(Qt6_IMAGEFORMATS_DIR "${Qt6_DIR}/../../../plugins/imageformats/") + set(Qt6_RESOURCES_DIR "${Qt6_DIR}/../../../resources/") + set(PLATFORMS ${DLL_DEST}plugins/platforms/) + set(STYLES ${DLL_DEST}plugins/styles/) + set(IMAGEFORMATS ${DLL_DEST}plugins/imageformats/) + + if (MSVC) + windows_copy_files(${target_dir} ${Qt6_DLL_DIR} ${DLL_DEST} + Qt6Core$<$<CONFIG:Debug>:d>.* + Qt6Gui$<$<CONFIG:Debug>:d>.* + Qt6Widgets$<$<CONFIG:Debug>:d>.* + Qt6Network$<$<CONFIG:Debug>:d>.* + ) + if (CITRON_USE_QT_MULTIMEDIA) + windows_copy_files(${target_dir} ${Qt6_DLL_DIR} ${DLL_DEST} + Qt6Multimedia$<$<CONFIG:Debug>:d>.* + ) + endif() + if (CITRON_USE_QT_WEB_ENGINE) + windows_copy_files(${target_dir} ${Qt6_DLL_DIR} ${DLL_DEST} + Qt6WebEngineCore$<$<CONFIG:Debug>:d>.* + Qt6WebEngineWidgets$<$<CONFIG:Debug>:d>.* + QtWebEngineProcess$<$<CONFIG:Debug>:d>.* + ) + windows_copy_files(${target_dir} ${Qt6_RESOURCES_DIR} ${DLL_DEST} + icudtl.dat + qtwebengine_devtools_resources.pak + qtwebengine_resources.pak + qtwebengine_resources_100p.pak + qtwebengine_resources_200p.pak + ) + endif() + windows_copy_files(yuzu ${Qt6_PLATFORMS_DIR} ${PLATFORMS} qwindows$<$<CONFIG:Debug>:d>.*) + windows_copy_files(yuzu ${Qt6_STYLES_DIR} ${STYLES} qwindowsvistastyle$<$<CONFIG:Debug>:d>.*) + windows_copy_files(yuzu ${Qt6_IMAGEFORMATS_DIR} ${IMAGEFORMATS} + qjpeg$<$<CONFIG:Debug>:d>.* + qgif$<$<CONFIG:Debug>:d>.* + ) + else() + # Update for non-MSVC platforms if needed + endif() + + # Create an empty qt.conf file + add_custom_command(TARGET yuzu POST_BUILD + COMMAND ${CMAKE_COMMAND} -E touch ${DLL_DEST}qt.conf + ) +endfunction(copy_yuzu_Qt6_deps) diff --git a/CMakeModules/DownloadExternals.cmake b/CMakeModules/DownloadExternals.cmake index d6336cb57c..3fe15a16c4 100644 --- a/CMakeModules/DownloadExternals.cmake +++ b/CMakeModules/DownloadExternals.cmake @@ -1,10 +1,11 @@ -# SPDX-FileCopyrightText: 2017 yuzu Emulator Project -# SPDX-License-Identifier: GPL-2.0-or-later +# SPDX-FileCopyrightText: Copyright yuzu/Citra Emulator Project / Eden Emulator Project +# SPDX-License-Identifier: GPL-3.0-or-later # This function downloads a binary library package from our external repo. # Params: # remote_path: path to the file to download, relative to the remote repository root # prefix_var: name of a variable which will be set with the path to the extracted contents +set(CURRENT_MODULE_DIR ${CMAKE_CURRENT_LIST_DIR}) function(download_bundled_external remote_path lib_name prefix_var) set(package_base_url "https://github.com/eden-emulator/") @@ -16,7 +17,7 @@ if (WIN32) elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux") set(package_repo "ext-linux-bin/raw/main/") set(package_extension ".tar.xz") -elseif (ANDROID) +elseif (ANDROID) set(package_repo "ext-android-bin/raw/main/") set(package_extension ".tar.xz") else() @@ -54,3 +55,172 @@ function(download_moltenvk_external platform version) list(APPEND CMAKE_PREFIX_PATH "${MOLTENVK_DIR}/MoltenVK/dylib/${platform}") set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} PARENT_SCOPE) endfunction() + +# Determine installation parameters for OS, architecture, and compiler +function(determine_qt_parameters target host_out type_out arch_out arch_path_out host_type_out host_arch_out host_arch_path_out) + if (WIN32) + set(host "windows") + set(type "desktop") + + if (NOT tool) + if (MINGW) + set(arch "win64_mingw") + set(arch_path "mingw_64") + elseif (MSVC) + if ("arm64" IN_LIST ARCHITECTURE) + set(arch_path "msvc2019_arm64") + elseif ("x86_64" IN_LIST ARCHITECTURE) + set(arch_path "msvc2019_64") + else() + message(FATAL_ERROR "Unsupported bundled Qt architecture. Enable USE_SYSTEM_QT and provide your own.") + endif() + set(arch "win64_${arch_path}") + + if (CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "AMD64") + set(host_arch_path "msvc2019_64") + elseif (CMAKE_HOST_SYSTEM_PROCESSOR STREQUAL "ARM64") + set(host_arch_path "msvc2019_64") + endif() + set(host_arch "win64_${host_arch_path}") + else() + message(FATAL_ERROR "Unsupported bundled Qt toolchain. Enable USE_SYSTEM_QT and provide your own.") + endif() + endif() + elseif (APPLE) + set(host "mac") + set(type "desktop") + set(arch "clang_64") + set(arch_path "macos") + else() + set(host "linux") + set(type "desktop") + set(arch "gcc_64") + set(arch_path "linux") + endif() + + set(${host_out} "${host}" PARENT_SCOPE) + set(${type_out} "${type}" PARENT_SCOPE) + set(${arch_out} "${arch}" PARENT_SCOPE) + set(${arch_path_out} "${arch_path}" PARENT_SCOPE) + if (DEFINED host_type) + set(${host_type_out} "${host_type}" PARENT_SCOPE) + else() + set(${host_type_out} "${type}" PARENT_SCOPE) + endif() + if (DEFINED host_arch) + set(${host_arch_out} "${host_arch}" PARENT_SCOPE) + else() + set(${host_arch_out} "${arch}" PARENT_SCOPE) + endif() + if (DEFINED host_arch_path) + set(${host_arch_path_out} "${host_arch_path}" PARENT_SCOPE) + else() + set(${host_arch_path_out} "${arch_path}" PARENT_SCOPE) + endif() +endfunction() + +# Download Qt binaries for a specific configuration. +function(download_qt_configuration prefix_out target host type arch arch_path base_path) + if (target MATCHES "tools_.*") + set(tool ON) + else() + set(tool OFF) + endif() + + set(install_args -c "${CURRENT_MODULE_DIR}/aqt_config.ini") + if (tool) + set(prefix "${base_path}/Tools") + set(install_args ${install_args} install-tool --outputdir ${base_path} ${host} desktop ${target}) + else() + set(prefix "${base_path}/${target}/${arch_path}") + set(install_args ${install_args} install-qt --outputdir ${base_path} ${host} ${type} ${target} ${arch} + -m qtmultimedia --archives qttranslations qttools qtsvg qtbase) + endif() + + if (NOT EXISTS "${prefix}") + message(STATUS "Downloading Qt binaries for ${target}:${host}:${type}:${arch}:${arch_path}") + set(AQT_PREBUILD_BASE_URL "https://github.com/miurahr/aqtinstall/releases/download/v3.1.18") + if (WIN32) + set(aqt_path "${base_path}/aqt.exe") + if (NOT EXISTS "${aqt_path}") + file(DOWNLOAD + ${AQT_PREBUILD_BASE_URL}/aqt.exe + ${aqt_path} SHOW_PROGRESS) + endif() + execute_process(COMMAND ${aqt_path} ${install_args} + WORKING_DIRECTORY ${base_path}) + elseif (APPLE) + set(aqt_path "${base_path}/aqt-macos") + if (NOT EXISTS "${aqt_path}") + file(DOWNLOAD + ${AQT_PREBUILD_BASE_URL}/aqt-macos + ${aqt_path} SHOW_PROGRESS) + endif() + execute_process(COMMAND chmod +x ${aqt_path}) + execute_process(COMMAND ${aqt_path} ${install_args} + WORKING_DIRECTORY ${base_path}) + else() + set(aqt_install_path "${base_path}/aqt") + file(MAKE_DIRECTORY "${aqt_install_path}") + + execute_process(COMMAND python3 -m pip install --target=${aqt_install_path} aqtinstall + WORKING_DIRECTORY ${base_path}) + execute_process(COMMAND ${CMAKE_COMMAND} -E env PYTHONPATH=${aqt_install_path} python3 -m aqt ${install_args} + WORKING_DIRECTORY ${base_path}) + endif() + + message(STATUS "Downloaded Qt binaries for ${target}:${host}:${type}:${arch}:${arch_path} to ${prefix}") + endif() + + set(${prefix_out} "${prefix}" PARENT_SCOPE) +endfunction() + +# This function downloads Qt using aqt. +# The path of the downloaded content will be added to the CMAKE_PREFIX_PATH. +# QT_TARGET_PATH is set to the Qt for the compile target platform. +# QT_HOST_PATH is set to a host-compatible Qt, for running tools. +# Params: +# target: Qt dependency to install. Specify a version number to download Qt, or "tools_(name)" for a specific build tool. +function(download_qt target) + determine_qt_parameters("${target}" host type arch arch_path host_type host_arch host_arch_path) + + get_external_prefix(qt base_path) + file(MAKE_DIRECTORY "${base_path}") + + download_qt_configuration(prefix "${target}" "${host}" "${type}" "${arch}" "${arch_path}" "${base_path}") + if (DEFINED host_arch_path AND NOT "${host_arch_path}" STREQUAL "${arch_path}") + download_qt_configuration(host_prefix "${target}" "${host}" "${host_type}" "${host_arch}" "${host_arch_path}" "${base_path}") + else() + set(host_prefix "${prefix}") + endif() + + set(QT_TARGET_PATH "${prefix}" CACHE STRING "") + set(QT_HOST_PATH "${host_prefix}" CACHE STRING "") + + list(APPEND CMAKE_PREFIX_PATH "${prefix}") + set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} PARENT_SCOPE) +endfunction() + +function(download_moltenvk) +set(MOLTENVK_PLATFORM "macOS") + +set(MOLTENVK_DIR "${CMAKE_BINARY_DIR}/externals/MoltenVK") +set(MOLTENVK_TAR "${CMAKE_BINARY_DIR}/externals/MoltenVK.tar") +if (NOT EXISTS ${MOLTENVK_DIR}) +if (NOT EXISTS ${MOLTENVK_TAR}) + file(DOWNLOAD https://github.com/KhronosGroup/MoltenVK/releases/download/v1.2.10-rc2/MoltenVK-all.tar + ${MOLTENVK_TAR} SHOW_PROGRESS) +endif() + +execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf "${MOLTENVK_TAR}" + WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/externals") +endif() + +# Add the MoltenVK library path to the prefix so find_library can locate it. +list(APPEND CMAKE_PREFIX_PATH "${MOLTENVK_DIR}/MoltenVK/dylib/${MOLTENVK_PLATFORM}") +set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} PARENT_SCOPE) +endfunction() + +function(get_external_prefix lib_name prefix_var) + set(${prefix_var} "${CMAKE_BINARY_DIR}/externals/${lib_name}" PARENT_SCOPE) +endfunction() diff --git a/CMakeModules/aqt_config.ini b/CMakeModules/aqt_config.ini new file mode 100644 index 0000000000..0ad399adab --- /dev/null +++ b/CMakeModules/aqt_config.ini @@ -0,0 +1,31 @@ +# SPDX-FileCopyrightText: 2024 Citron HomeBrew Emulator Project +# SPDX-FileCopyrightText: 2024 kleidis + +[aqt] +concurrency: 2 + +[mirrors] +trusted_mirrors: + https://download.qt.io +blacklist: + https://qt.mirror.constant.com + https://mirrors.ocf.berkeley.edu + https://mirrors.ustc.edu.cn + https://mirrors.tuna.tsinghua.edu.cn + https://mirrors.geekpie.club + https://mirrors-wan.geekpie.club + https://mirrors.sjtug.sjtu.edu.cn +fallbacks: + https://qtproject.mirror.liquidtelecom.com/ + https://mirrors.aliyun.com/qt/ + https://ftp.jaist.ac.jp/pub/qtproject/ + https://ftp.yz.yamagata-u.ac.jp/pub/qtproject/ + https://qt-mirror.dannhauer.de/ + https://ftp.fau.de/qtproject/ + https://mirror.netcologne.de/qtproject/ + https://mirrors.dotsrc.org/qtproject/ + https://www.nic.funet.fi/pub/mirrors/download.qt-project.org/ + https://master.qt.io/ + https://mirrors.ukfast.co.uk/sites/qt.io/ + https://ftp2.nluug.nl/languages/qt/ + https://ftp1.nluug.nl/languages/qt/ |
