2025-01-12 04:26:22 +01:00
|
|
|
# SPDX-FileCopyrightText: 2025 Citron Homebrew Emulator Project & vampiric_x 2025
|
chore: make yuzu REUSE compliant
[REUSE] is a specification that aims at making file copyright
information consistent, so that it can be both human and machine
readable. It basically requires that all files have a header containing
copyright and licensing information. When this isn't possible, like
when dealing with binary assets, generated files or embedded third-party
dependencies, it is permitted to insert copyright information in the
`.reuse/dep5` file.
Oh, and it also requires that all the licenses used in the project are
present in the `LICENSES` folder, that's why the diff is so huge.
This can be done automatically with `reuse download --all`.
The `reuse` tool also contains a handy subcommand that analyzes the
project and tells whether or not the project is (still) compliant,
`reuse lint`.
Following REUSE has a few advantages over the current approach:
- Copyright information is easy to access for users / downstream
- Files like `dist/license.md` do not need to exist anymore, as
`.reuse/dep5` is used instead
- `reuse lint` makes it easy to ensure that copyright information of
files like binary assets / images is always accurate and up to date
To add copyright information of files that didn't have it I looked up
who committed what and when, for each file. As yuzu contributors do not
have to sign a CLA or similar I couldn't assume that copyright ownership
was of the "yuzu Emulator Project", so I used the name and/or email of
the commit author instead.
[REUSE]: https://reuse.software
Follow-up to 01cf05bc75b1e47beb08937439f3ed9339e7b254
2022-05-15 02:06:02 +02:00
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
2017-09-09 19:24:13 +02:00
|
|
|
|
|
|
|
# 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
|
2025-01-12 04:26:22 +01:00
|
|
|
set(CURRENT_MODULE_DIR ${CMAKE_CURRENT_LIST_DIR})
|
2017-09-09 19:24:13 +02:00
|
|
|
function(download_bundled_external remote_path lib_name prefix_var)
|
2021-04-21 07:51:28 +02:00
|
|
|
|
2024-12-31 08:07:49 +01:00
|
|
|
set(package_base_url "https://github.com/yuzu-mirror/")
|
2021-04-21 07:51:28 +02:00
|
|
|
set(package_repo "no_platform")
|
|
|
|
set(package_extension "no_platform")
|
|
|
|
if (WIN32)
|
|
|
|
set(package_repo "ext-windows-bin/raw/master/")
|
|
|
|
set(package_extension ".7z")
|
|
|
|
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
|
|
|
set(package_repo "ext-linux-bin/raw/main/")
|
|
|
|
set(package_extension ".tar.xz")
|
2025-01-12 04:26:22 +01:00
|
|
|
elseif (ANDROID)
|
2023-06-01 00:06:21 +02:00
|
|
|
set(package_repo "ext-android-bin/raw/main/")
|
2023-03-16 19:41:27 +01:00
|
|
|
set(package_extension ".tar.xz")
|
2021-04-21 07:51:28 +02:00
|
|
|
else()
|
|
|
|
message(FATAL_ERROR "No package available for this platform")
|
|
|
|
endif()
|
2022-12-30 09:29:53 +01:00
|
|
|
set(package_url "${package_base_url}${package_repo}")
|
2021-04-21 07:51:28 +02:00
|
|
|
|
2017-09-09 19:24:13 +02:00
|
|
|
set(prefix "${CMAKE_BINARY_DIR}/externals/${lib_name}")
|
|
|
|
if (NOT EXISTS "${prefix}")
|
|
|
|
message(STATUS "Downloading binaries for ${lib_name}...")
|
|
|
|
file(DOWNLOAD
|
2021-04-21 07:51:28 +02:00
|
|
|
${package_url}${remote_path}${lib_name}${package_extension}
|
|
|
|
"${CMAKE_BINARY_DIR}/externals/${lib_name}${package_extension}" SHOW_PROGRESS)
|
|
|
|
execute_process(COMMAND ${CMAKE_COMMAND} -E tar xf "${CMAKE_BINARY_DIR}/externals/${lib_name}${package_extension}"
|
2017-09-09 19:24:13 +02:00
|
|
|
WORKING_DIRECTORY "${CMAKE_BINARY_DIR}/externals")
|
|
|
|
endif()
|
|
|
|
message(STATUS "Using bundled binaries at ${prefix}")
|
|
|
|
set(${prefix_var} "${prefix}" PARENT_SCOPE)
|
2021-04-21 07:51:28 +02:00
|
|
|
endfunction()
|
2023-08-17 03:17:56 +02:00
|
|
|
|
|
|
|
function(download_moltenvk_external platform version)
|
|
|
|
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/${version}/MoltenVK-${platform}.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/${platform}")
|
|
|
|
set(CMAKE_PREFIX_PATH ${CMAKE_PREFIX_PATH} PARENT_SCOPE)
|
|
|
|
endfunction()
|
2025-01-12 04:26:22 +01:00
|
|
|
|
|
|
|
# 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()
|