mirror of
https://github.com/yuzu-emu/yuzu-mainline.git
synced 2024-12-23 20:15:35 +00: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
58 lines
1.7 KiB
CMake
58 lines
1.7 KiB
CMake
# SPDX-FileCopyrightText: 2020 yuzu Emulator Project
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
find_package(PkgConfig QUIET)
|
|
pkg_check_modules(PC_zstd QUIET libzstd)
|
|
|
|
find_path(zstd_INCLUDE_DIR
|
|
NAMES zstd.h
|
|
PATHS ${PC_zstd_INCLUDE_DIRS}
|
|
)
|
|
find_library(zstd_LIBRARY
|
|
NAMES zstd
|
|
PATHS ${PC_zstd_LIBRARY_DIRS}
|
|
)
|
|
|
|
if(zstd_INCLUDE_DIR)
|
|
file(STRINGS "${zstd_INCLUDE_DIR}/zstd.h" _zstd_version_lines
|
|
REGEX "#define[ \t]+ZSTD_VERSION_(MAJOR|MINOR|RELEASE)")
|
|
string(REGEX REPLACE ".*ZSTD_VERSION_MAJOR *\([0-9]*\).*" "\\1" _zstd_version_major "${_zstd_version_lines}")
|
|
string(REGEX REPLACE ".*ZSTD_VERSION_MINOR *\([0-9]*\).*" "\\1" _zstd_version_minor "${_zstd_version_lines}")
|
|
string(REGEX REPLACE ".*ZSTD_VERSION_RELEASE *\([0-9]*\).*" "\\1" _zstd_version_release "${_zstd_version_lines}")
|
|
set(zstd_VERSION "${_zstd_version_major}.${_zstd_version_minor}.${_zstd_version_release}")
|
|
unset(_zstd_version_major)
|
|
unset(_zstd_version_minor)
|
|
unset(_zstd_version_release)
|
|
unset(_zstd_version_lines)
|
|
endif()
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
find_package_handle_standard_args(zstd
|
|
FOUND_VAR zstd_FOUND
|
|
REQUIRED_VARS
|
|
zstd_LIBRARY
|
|
zstd_INCLUDE_DIR
|
|
zstd_VERSION
|
|
VERSION_VAR zstd_VERSION
|
|
)
|
|
|
|
if(zstd_FOUND)
|
|
set(zstd_LIBRARIES ${zstd_LIBRARY})
|
|
set(zstd_INCLUDE_DIRS ${zstd_INCLUDE_DIR})
|
|
set(zstd_DEFINITIONS ${PC_zstd_CFLAGS_OTHER})
|
|
endif()
|
|
|
|
if(zstd_FOUND AND NOT TARGET zstd::zstd)
|
|
add_library(zstd::zstd UNKNOWN IMPORTED)
|
|
set_target_properties(zstd::zstd PROPERTIES
|
|
IMPORTED_LOCATION "${zstd_LIBRARY}"
|
|
INTERFACE_COMPILE_OPTIONS "${PC_zstd_CFLAGS_OTHER}"
|
|
INTERFACE_INCLUDE_DIRECTORIES "${zstd_INCLUDE_DIR}"
|
|
)
|
|
endif()
|
|
|
|
mark_as_advanced(
|
|
zstd_INCLUDE_DIR
|
|
zstd_LIBRARY
|
|
)
|