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-14 20:06:02 -04:00
|
|
|
# SPDX-FileCopyrightText: 2020 yuzu Emulator Project
|
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
2020-05-08 17:09:29 -04:00
|
|
|
|
|
|
|
find_package(PkgConfig QUIET)
|
|
|
|
pkg_check_modules(PC_nlohmann_json QUIET nlohmann_json)
|
|
|
|
|
|
|
|
find_path(nlohmann_json_INCLUDE_DIR
|
|
|
|
NAMES json.hpp
|
|
|
|
PATHS ${PC_nlohmann_json_INCLUDE_DIRS}
|
|
|
|
PATH_SUFFIXES nlohmann
|
|
|
|
)
|
|
|
|
|
2020-05-09 05:46:03 -04:00
|
|
|
if(nlohmann_json_INCLUDE_DIR)
|
|
|
|
file(STRINGS "${nlohmann_json_INCLUDE_DIR}/json.hpp" _nlohmann_json_version_lines
|
|
|
|
REGEX "#define[ \t]+NLOHMANN_JSON_VERSION_(MAJOR|MINOR|PATCH)")
|
|
|
|
string(REGEX REPLACE ".*NLOHMANN_JSON_VERSION_MAJOR +\([0-9]+\).*" "\\1" _nlohmann_json_version_major "${_nlohmann_json_version_lines}")
|
|
|
|
string(REGEX REPLACE ".*NLOHMANN_JSON_VERSION_MINOR +\([0-9]+\).*" "\\1" _nlohmann_json_version_minor "${_nlohmann_json_version_lines}")
|
|
|
|
string(REGEX REPLACE ".*NLOHMANN_JSON_VERSION_PATCH +\([0-9]+\).*" "\\1" _nlohmann_json_version_patch "${_nlohmann_json_version_lines}")
|
|
|
|
set(nlohmann_json_VERSION "${_nlohmann_json_version_major}.${_nlohmann_json_version_minor}.${_nlohmann_json_version_patch}")
|
|
|
|
unset(_nlohmann_json_version_major)
|
|
|
|
unset(_nlohmann_json_version_minor)
|
|
|
|
unset(_nlohmann_json_version_patch)
|
|
|
|
unset(_nlohmann_json_version_lines)
|
|
|
|
endif()
|
|
|
|
|
2020-05-08 17:09:29 -04:00
|
|
|
include(FindPackageHandleStandardArgs)
|
|
|
|
find_package_handle_standard_args(nlohmann_json
|
|
|
|
FOUND_VAR nlohmann_json_FOUND
|
|
|
|
REQUIRED_VARS
|
|
|
|
nlohmann_json_INCLUDE_DIR
|
2020-05-09 05:46:03 -04:00
|
|
|
nlohmann_json_VERSION
|
2020-05-08 17:09:29 -04:00
|
|
|
VERSION_VAR nlohmann_json_VERSION
|
|
|
|
)
|
|
|
|
|
|
|
|
if(nlohmann_json_FOUND)
|
|
|
|
set(nlohmann_json_INCLUDE_DIRS ${nlohmann_json_INCLUDE_DIR})
|
|
|
|
set(nlohmann_json_DEFINITIONS ${PC_nlohmann_json_CFLAGS_OTHER})
|
|
|
|
endif()
|
|
|
|
|
|
|
|
if(nlohmann_json_FOUND AND NOT TARGET nlohmann_json::nlohmann_json)
|
|
|
|
add_library(nlohmann_json::nlohmann_json UNKNOWN IMPORTED)
|
|
|
|
set_target_properties(nlohmann_json::nlohmann_json PROPERTIES
|
|
|
|
IMPORTED_LOCATION "${nlohmann_json_LIBRARY}"
|
|
|
|
INTERFACE_COMPILE_OPTIONS "${PC_nlohmann_json_CFLAGS_OTHER}"
|
|
|
|
INTERFACE_INCLUDE_DIRECTORIES "${nlohmann_json_INCLUDE_DIR}"
|
|
|
|
)
|
|
|
|
endif()
|
|
|
|
|
|
|
|
mark_as_advanced(
|
|
|
|
nlohmann_json_INCLUDE_DIR
|
|
|
|
)
|