2024-03-24 02:15:57 +01:00
|
|
|
# SPDX-FileCopyrightText: 2017 yuzu Emulator Project
|
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
|
|
|
|
function(download_bundled_external remote_path lib_name prefix_var)
|
2021-04-21 07:51:28 +02:00
|
|
|
|
2024-03-06 03:19:13 +01:00
|
|
|
set(package_base_url "https://gitlab.com/suyu-emu/")
|
2021-04-21 07:51:28 +02:00
|
|
|
set(package_repo "no_platform")
|
|
|
|
set(package_extension "no_platform")
|
2024-03-06 06:55:02 +01:00
|
|
|
set(package_head "?ref_type=heads")
|
2021-04-21 07:51:28 +02:00
|
|
|
if (WIN32)
|
2024-03-06 03:19:13 +01:00
|
|
|
set(package_repo "ext-windows-bin/-/raw/master/")
|
2021-04-21 07:51:28 +02:00
|
|
|
set(package_extension ".7z")
|
|
|
|
elseif (${CMAKE_SYSTEM_NAME} STREQUAL "Linux")
|
2024-03-06 03:19:13 +01:00
|
|
|
set(package_repo "ext-linux-bin/-/raw/main/")
|
2021-04-21 07:51:28 +02:00
|
|
|
set(package_extension ".tar.xz")
|
2024-03-13 14:00:31 +01:00
|
|
|
# elseif (APPLE)
|
|
|
|
# set(package_repo "ext-osx-bin/-/raw/main/")
|
|
|
|
# set(package_extension ".dmg")
|
2022-12-30 09:29:53 +01:00
|
|
|
elseif (ANDROID)
|
2024-03-06 03:19:13 +01: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
|
2024-03-06 06:55:02 +01:00
|
|
|
${package_url}${remote_path}${lib_name}${package_extension}${package_head}
|
2021-04-21 07:51:28 +02:00
|
|
|
"${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()
|