Warning, /graphics/glaxnimate/cmake/modules/FindLibav.cmake is written in an unsupported language. File is not indexed.

0001 #
0002 # Copyright (C) 2015-2020 Mattia Basaglia
0003 #
0004 # This program is free software: you can redistribute it and/or modify
0005 # it under the terms of the GNU General Public License as published by
0006 # the Free Software Foundation, either version 3 of the License, or
0007 # (at your option) any later version.
0008 #
0009 # This program is distributed in the hope that it will be useful,
0010 # but WITHOUT ANY WARRANTY; without even the implied warranty of
0011 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
0012 # GNU General Public License for more details.
0013 #
0014 # You should have received a copy of the GNU General Public License
0015 # along with this program.  If not, see <http://www.gnu.org/licenses/>.
0016 #
0017 # Tries to find libav
0018 #
0019 # Input:
0020 #   Libav_PREFIX
0021 #   Libav_LIBRARIES
0022 #   Libav_INCLUDE_DIRS
0023 #
0024 # Output:
0025 #   Libav_FOUND
0026 #   Libav_LIBRARIES
0027 #   Libav_INCLUDE_DIRS
0028 # For each component:
0029 #   Libav_<component>_FOUND
0030 #   Libav_<component>_INCLUDE_DIR
0031 #   Libav_<component>_LIBRARY
0032 #
0033 # Components:
0034 #   codec
0035 #   filter
0036 #   format
0037 #   device
0038 #   util
0039 #   resample
0040 #   swscale
0041 
0042 set(Libav_PREFIX "${CMAKE_SYSTEM_PREFIX_PATH}" CACHE PATH "libav installation prefix")
0043 
0044 if(Libav_LIBRARIES AND Libav_INCLUDE_DIRS)
0045     set(Libav_FOUND TRUE)
0046 else()
0047     set(Libav_LIBRARIES)
0048     set(Libav_INCLUDE_DIRS)
0049 
0050     foreach(comp_short ${Libav_FIND_COMPONENTS})
0051         if(comp_short MATCHES "^sw.*" )
0052             set(component ${comp_short})
0053         else()
0054             set(component "av${comp_short}")
0055         endif()
0056 
0057         find_path(
0058             Libav_${comp_short}_INCLUDE_DIR
0059             NAMES
0060                 "lib${component}/${component}.h"
0061             PATHS
0062                 ${Libav_PREFIX}/include
0063                 /usr/local/include
0064                 /usr/include
0065                 /usr/local/homebrew/opt/ffmpeg/include/
0066                 /usr/include/ffmpeg
0067         )
0068 
0069         find_library(
0070             Libav_${comp_short}_LIBRARY
0071             NAMES
0072                 ${component}
0073             PATHS
0074                 ${Libav_PREFIX}/lib
0075                 /usr/local/lib
0076                 /usr/local/lib/x86_64-linux-gnu
0077                 /usr/lib
0078                 /usr/lib/x86_64-linux-gnu
0079                 /usr/local/homebrew/opt/ffmpeg/lib/
0080                 /usr/lib64
0081         )
0082 
0083         if(Libav_${comp_short}_INCLUDE_DIR AND Libav_${comp_short}_LIBRARY)
0084             set(Libav_${comp_short}_FOUND TRUE)
0085             list(APPEND Libav_LIBRARIES ${Libav_${comp_short}_LIBRARY})
0086             list(APPEND Libav_INCLUDE_DIRS ${Libav_${comp_short}_INCLUDE_DIR})
0087         else()
0088             set(Libav_${comp_short}_FOUND FALSE)
0089         endif()
0090     endforeach()
0091 
0092     list(REMOVE_DUPLICATES Libav_INCLUDE_DIRS)
0093 
0094     include(FindPackageHandleStandardArgs)
0095     find_package_handle_standard_args(
0096         Libav
0097         REQUIRED_VARS
0098             Libav_LIBRARIES
0099             Libav_INCLUDE_DIRS
0100         HANDLE_COMPONENTS
0101     )
0102 endif()