mirror of
https://github.com/yuzu-emu/yuzu-mainline.git
synced 2024-12-12 20:54:22 +01:00
cdb240f3d4
[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 01cf05bc75
52 lines
2.0 KiB
CMake
52 lines
2.0 KiB
CMake
# SPDX-FileCopyrightText: 2020 yuzu Emulator Project
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
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
|
|
)
|
|
|
|
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()
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
find_package_handle_standard_args(nlohmann_json
|
|
FOUND_VAR nlohmann_json_FOUND
|
|
REQUIRED_VARS
|
|
nlohmann_json_INCLUDE_DIR
|
|
nlohmann_json_VERSION
|
|
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
|
|
)
|