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 03:06:02 +03:00
|
|
|
# SPDX-FileCopyrightText: 2019 Citra Emulator Project
|
|
|
|
# SPDX-License-Identifier: GPL-2.0-or-later
|
|
|
|
|
2021-02-05 23:39:19 +03:00
|
|
|
# FindFFmpeg
|
|
|
|
# ----------
|
2020-10-27 06:07:36 +03:00
|
|
|
#
|
2021-02-05 23:39:19 +03:00
|
|
|
# Find the native FFmpeg includes and libraries
|
2020-10-27 06:07:36 +03:00
|
|
|
#
|
2021-02-05 23:39:19 +03:00
|
|
|
# This module defines the following variables:
|
|
|
|
#
|
|
|
|
# FFmpeg_INCLUDE_<component>: where to find <component>.h
|
|
|
|
# FFmpeg_LIBRARY_<component>: where to find the <component> library
|
|
|
|
# FFmpeg_INCLUDE_DIR: aggregate all the include paths
|
|
|
|
# FFmpeg_LIBRARIES: aggregate all the paths to the libraries
|
|
|
|
# FFmpeg_FOUND: True if all components have been found
|
|
|
|
#
|
|
|
|
# This module defines the following targets, which are prefered over variables:
|
|
|
|
#
|
|
|
|
# FFmpeg::<component>: Target to use <component> directly, with include path,
|
|
|
|
# library and dependencies set up. If you are using a static build, you are
|
|
|
|
# responsible for adding any external dependencies (such as zlib, bzlib...).
|
|
|
|
#
|
|
|
|
# <component> can be one of:
|
|
|
|
# avcodec
|
2021-02-06 11:14:11 +03:00
|
|
|
# avdevice
|
|
|
|
# avfilter
|
|
|
|
# avformat
|
2021-02-05 23:39:19 +03:00
|
|
|
# avutil
|
2021-02-06 11:14:11 +03:00
|
|
|
# postproc
|
|
|
|
# swresample
|
2021-02-05 23:39:19 +03:00
|
|
|
# swscale
|
2020-10-27 06:07:36 +03:00
|
|
|
#
|
|
|
|
|
2021-02-05 23:39:19 +03:00
|
|
|
set(_FFmpeg_ALL_COMPONENTS
|
2021-02-06 11:14:11 +03:00
|
|
|
avcodec
|
|
|
|
avdevice
|
|
|
|
avfilter
|
|
|
|
avformat
|
|
|
|
avutil
|
|
|
|
postproc
|
|
|
|
swresample
|
|
|
|
swscale
|
2020-10-27 06:07:36 +03:00
|
|
|
)
|
|
|
|
|
2021-02-05 23:39:19 +03:00
|
|
|
set(_FFmpeg_DEPS_avcodec avutil)
|
|
|
|
set(_FFmpeg_DEPS_avdevice avcodec avformat avutil)
|
|
|
|
set(_FFmpeg_DEPS_avfilter avutil)
|
|
|
|
set(_FFmpeg_DEPS_avformat avcodec avutil)
|
|
|
|
set(_FFmpeg_DEPS_postproc avutil)
|
|
|
|
set(_FFmpeg_DEPS_swresample avutil)
|
|
|
|
set(_FFmpeg_DEPS_swscale avutil)
|
|
|
|
|
|
|
|
function(find_ffmpeg LIBNAME)
|
|
|
|
if(DEFINED ENV{FFMPEG_DIR})
|
|
|
|
set(FFMPEG_DIR $ENV{FFMPEG_DIR})
|
2020-10-27 06:07:36 +03:00
|
|
|
endif()
|
|
|
|
|
2021-02-05 23:39:19 +03:00
|
|
|
if(FFMPEG_DIR)
|
|
|
|
list(APPEND INCLUDE_PATHS
|
|
|
|
${FFMPEG_DIR}
|
|
|
|
${FFMPEG_DIR}/ffmpeg
|
|
|
|
${FFMPEG_DIR}/lib${LIBNAME}
|
|
|
|
${FFMPEG_DIR}/include/lib${LIBNAME}
|
|
|
|
${FFMPEG_DIR}/include/ffmpeg
|
|
|
|
${FFMPEG_DIR}/include
|
|
|
|
NO_DEFAULT_PATH
|
|
|
|
NO_CMAKE_FIND_ROOT_PATH
|
|
|
|
)
|
|
|
|
list(APPEND LIB_PATHS
|
|
|
|
${FFMPEG_DIR}
|
|
|
|
${FFMPEG_DIR}/lib
|
|
|
|
${FFMPEG_DIR}/lib${LIBNAME}
|
|
|
|
NO_DEFAULT_PATH
|
|
|
|
NO_CMAKE_FIND_ROOT_PATH
|
|
|
|
)
|
|
|
|
else()
|
|
|
|
list(APPEND INCLUDE_PATHS
|
|
|
|
/usr/local/include/ffmpeg
|
|
|
|
/usr/local/include/lib${LIBNAME}
|
|
|
|
/usr/include/ffmpeg
|
|
|
|
/usr/include/lib${LIBNAME}
|
|
|
|
/usr/include/ffmpeg/lib${LIBNAME}
|
|
|
|
)
|
2020-10-27 06:07:36 +03:00
|
|
|
|
2021-02-05 23:39:19 +03:00
|
|
|
list(APPEND LIB_PATHS
|
2020-10-27 06:07:36 +03:00
|
|
|
/usr/local/lib
|
|
|
|
/usr/lib
|
2021-02-05 23:39:19 +03:00
|
|
|
)
|
2020-10-27 06:07:36 +03:00
|
|
|
endif()
|
|
|
|
|
2021-02-05 23:39:19 +03:00
|
|
|
find_path(FFmpeg_INCLUDE_${LIBNAME} lib${LIBNAME}/${LIBNAME}.h
|
|
|
|
HINTS ${INCLUDE_PATHS}
|
|
|
|
)
|
|
|
|
|
|
|
|
find_library(FFmpeg_LIBRARY_${LIBNAME} ${LIBNAME}
|
|
|
|
HINTS ${LIB_PATHS}
|
|
|
|
)
|
|
|
|
|
|
|
|
if(NOT FFMPEG_DIR AND (NOT FFmpeg_LIBRARY_${LIBNAME} OR NOT FFmpeg_INCLUDE_${LIBNAME}))
|
|
|
|
# Didn't find it in the usual paths, try pkg-config
|
|
|
|
find_package(PkgConfig QUIET)
|
|
|
|
pkg_check_modules(FFmpeg_PKGCONFIG_${LIBNAME} QUIET lib${LIBNAME})
|
|
|
|
|
|
|
|
find_path(FFmpeg_INCLUDE_${LIBNAME} lib${LIBNAME}/${LIBNAME}.h
|
|
|
|
${FFmpeg_PKGCONFIG_${LIBNAME}_INCLUDE_DIRS}
|
|
|
|
)
|
|
|
|
|
|
|
|
find_library(FFmpeg_LIBRARY_${LIBNAME} ${LIBNAME}
|
|
|
|
${FFmpeg_PKGCONFIG_${LIBNAME}_LIBRARY_DIRS}
|
|
|
|
)
|
2020-10-27 06:07:36 +03:00
|
|
|
endif()
|
|
|
|
|
2021-02-05 23:39:19 +03:00
|
|
|
if(FFmpeg_INCLUDE_${LIBNAME} AND FFmpeg_LIBRARY_${LIBNAME})
|
|
|
|
set(FFmpeg_INCLUDE_${LIBNAME} "${FFmpeg_INCLUDE_${LIBNAME}}" PARENT_SCOPE)
|
|
|
|
set(FFmpeg_LIBRARY_${LIBNAME} "${FFmpeg_LIBRARY_${LIBNAME}}" PARENT_SCOPE)
|
|
|
|
|
|
|
|
# Extract FFmpeg version from version.h
|
|
|
|
foreach(v MAJOR MINOR MICRO)
|
|
|
|
set(FFmpeg_${LIBNAME}_VERSION_${v} 0)
|
|
|
|
endforeach()
|
|
|
|
string(TOUPPER ${LIBNAME} LIBNAME_UPPER)
|
|
|
|
file(STRINGS "${FFmpeg_INCLUDE_${LIBNAME}}/lib${LIBNAME}/version.h" _FFmpeg_VERSION_H_CONTENTS REGEX "#define LIB${LIBNAME_UPPER}_VERSION_(MAJOR|MINOR|MICRO) ")
|
|
|
|
set(_FFmpeg_VERSION_REGEX "([0-9]+)")
|
|
|
|
foreach(v MAJOR MINOR MICRO)
|
|
|
|
if("${_FFmpeg_VERSION_H_CONTENTS}" MATCHES "#define LIB${LIBNAME_UPPER}_VERSION_${v}[\\t ]+${_FFmpeg_VERSION_REGEX}")
|
|
|
|
set(FFmpeg_${LIBNAME}_VERSION_${v} "${CMAKE_MATCH_1}")
|
|
|
|
endif()
|
|
|
|
endforeach()
|
|
|
|
set(FFmpeg_${LIBNAME}_VERSION "${FFmpeg_${LIBNAME}_VERSION_MAJOR}.${FFmpeg_${LIBNAME}_VERSION_MINOR}.${FFmpeg_${LIBNAME}_VERSION_MICRO}")
|
|
|
|
set(FFmpeg_${c}_VERSION "${FFmpeg_${LIBNAME}_VERSION}" PARENT_SCOPE)
|
|
|
|
unset(_FFmpeg_VERSION_REGEX)
|
|
|
|
unset(_FFmpeg_VERSION_H_CONTENTS)
|
|
|
|
|
|
|
|
set(FFmpeg_${c}_FOUND TRUE PARENT_SCOPE)
|
|
|
|
if(NOT FFmpeg_FIND_QUIETLY)
|
|
|
|
message("-- Found ${LIBNAME}: ${FFmpeg_INCLUDE_${LIBNAME}} ${FFmpeg_LIBRARY_${LIBNAME}} (version: ${FFmpeg_${LIBNAME}_VERSION})")
|
2020-10-27 06:07:36 +03:00
|
|
|
endif()
|
2021-02-05 23:39:19 +03:00
|
|
|
endif()
|
|
|
|
endfunction()
|
|
|
|
|
|
|
|
foreach(c ${_FFmpeg_ALL_COMPONENTS})
|
|
|
|
find_ffmpeg(${c})
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
foreach(c ${_FFmpeg_ALL_COMPONENTS})
|
|
|
|
if(FFmpeg_${c}_FOUND)
|
|
|
|
list(APPEND FFmpeg_INCLUDE_DIR ${FFmpeg_INCLUDE_${c}})
|
|
|
|
list(APPEND FFmpeg_LIBRARIES ${FFmpeg_LIBRARY_${c}})
|
|
|
|
|
|
|
|
add_library(FFmpeg::${c} IMPORTED UNKNOWN)
|
|
|
|
set_target_properties(FFmpeg::${c} PROPERTIES
|
|
|
|
IMPORTED_LOCATION ${FFmpeg_LIBRARY_${c}}
|
|
|
|
INTERFACE_INCLUDE_DIRECTORIES ${FFmpeg_INCLUDE_${c}}
|
|
|
|
)
|
|
|
|
if(_FFmpeg_DEPS_${c})
|
|
|
|
set(deps)
|
|
|
|
foreach(dep ${_FFmpeg_DEPS_${c}})
|
|
|
|
list(APPEND deps FFmpeg::${dep})
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
set_target_properties(FFmpeg::${c} PROPERTIES
|
|
|
|
INTERFACE_LINK_LIBRARIES "${deps}"
|
|
|
|
)
|
|
|
|
unset(deps)
|
2020-10-27 06:07:36 +03:00
|
|
|
endif()
|
|
|
|
endif()
|
2021-02-05 23:39:19 +03:00
|
|
|
endforeach()
|
|
|
|
|
|
|
|
if(FFmpeg_INCLUDE_DIR)
|
|
|
|
list(REMOVE_DUPLICATES FFmpeg_INCLUDE_DIR)
|
2020-10-27 06:07:36 +03:00
|
|
|
endif()
|
2021-02-05 23:39:19 +03:00
|
|
|
|
|
|
|
foreach(c ${FFmpeg_FIND_COMPONENTS})
|
|
|
|
list(APPEND _FFmpeg_REQUIRED_VARS FFmpeg_INCLUDE_${c} FFmpeg_LIBRARY_${c})
|
|
|
|
endforeach()
|
|
|
|
|
|
|
|
include(FindPackageHandleStandardArgs)
|
|
|
|
find_package_handle_standard_args(FFmpeg
|
|
|
|
REQUIRED_VARS ${_FFmpeg_REQUIRED_VARS}
|
|
|
|
HANDLE_COMPONENTS
|
|
|
|
)
|
|
|
|
|
|
|
|
foreach(c ${_FFmpeg_ALL_COMPONENTS})
|
|
|
|
unset(_FFmpeg_DEPS_${c})
|
|
|
|
endforeach()
|
|
|
|
unset(_FFmpeg_ALL_COMPONENTS)
|
|
|
|
unset(_FFmpeg_REQUIRED_VARS)
|